target-mips queue
Hi,
This is the v2 of the pull-req for target-mips.
The warning treated as error has been fixed and the file is now isolated for mips64el only. Boston has further update to have default -drive to if=ide.
Regards,
Yongbok
The following changes since commit 796b288f7be875045670f963ce99991b3c8e96ac:
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2017-02-21 15:48:22 +0000)
are available in the git repository at:
git://github.com/yongbok/upstream-qemu.git tags/mips-20170222
for you to fetch changes up to d3473e147a754e999718bf6fcb015d9978c6a1ee:
hw/mips: MIPS Boston board support (2017-02-21 23:49:30 +0000)
----------------------------------------------------------------
MIPS patches 2017-02-22
Changes:
* Add MIPS Boston board support
----------------------------------------------------------------
Paul Burton (8):
hw/mips_cmgcr: allow GCR base to be moved hw/mips_gictimer: provide API for retrieving frequency hw/mips_gic: Update pin state on mask changes
target-mips: Provide function to test if a CPU supports an ISA
dtc: Update requirement to v1.4.2
loader: Support Flattened Image Trees (FIT images)
hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller hw/mips: MIPS Boston board support
configure | 8 +- default-configs/mips64el-softmmu.mak | 3 + dtc | 2 +- hw/core/Makefile.objs | 1 + hw/core/loader-fit.c | 325 ++++++++++++++++++++ hw/core/loader.c | 7 +- hw/intc/mips_gic.c | 56 ++-- hw/mips/Makefile.objs | 1 + hw/mips/boston.c | 577 +++++++++++++++++++++++++++++++++++ hw/misc/mips_cmgcr.c | 17 ++ hw/pci-host/Makefile.objs | 1 + hw/pci-host/xilinx-pcie.c | 328 ++++++++++++++++++++ hw/timer/mips_gictimer.c | 5 + include/hw/loader-fit.h | 41 +++ include/hw/loader.h | 6 + include/hw/misc/mips_cmgcr.h | 3 + include/hw/pci-host/xilinx-pcie.h | 68 +++++ include/hw/timer/mips_gictimer.h | 1 + target/mips/cpu.h | 1 + target/mips/translate.c | 10 + 20 files changed, 1425 insertions(+), 36 deletions(-) create mode 100644 hw/core/loader-fit.c create mode 100644 hw/mips/boston.c create mode 100644 hw/pci-host/xilinx-pcie.c create mode 100644 include/hw/loader-fit.h create mode 100644 include/hw/pci-host/xilinx-pcie.h
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 1/8] hw/mips_cmgcr: allow GCR base to be moved
From: Paul Burton <[email protected]>
Support moving the GCR base address & updating the CPU's CP0 CMGCRBase register appropriately. This is required if a platform needs to move its GCRs away from other memory, as the MIPS Boston development board does to avoid its flash memory.
--- hw/misc/mips_cmgcr.c | 17 +++++++++++++++++ include/hw/misc/mips_cmgcr.h | 3 +++ 2 files changed, 20 insertions(+)
hw/misc/mips_cmgcr.c +17 -0
@@ -29,6 +29,20 @@ static inline bool is_gic_connected(MIPSGCRState *s)return s->gic_mr !=NULL ; } +static inline void update_gcr_base (MIPSGCRState *gcr,uint64_t val) +{ +CPUState *cpu; +MIPSCPU *mips_cpu; + + gcr->gcr_base = val &GCR_BASE_GCRBASE_MSK ; +memory_region_set_address (&gcr->iomem, gcr->gcr_base); + +CPU_FOREACH (cpu) { + mips_cpu =MIPS_CPU (cpu); + mips_cpu->env.CP0_CMGCRBase = gcr->gcr_base >>4 ; + } +} +static inline void update_cpc_base (MIPSGCRState *gcr,uint64_t val) {if (is_cpc_connected (gcr)) {
@@ -117,6 +131,9 @@ static void gcr_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)MIPSGCRVPState *other_vps = &gcr->vps[current_vps->other];switch (addr) { +case GCR_BASE_OFS : +update_gcr_base (gcr, data); +break ;case GCR_GIC_BASE_OFS :update_gic_base (gcr, data);break ;
include/hw/misc/mips_cmgcr.h +3 -0
@@ -41,6 +41,9 @@#define GCR_L2_CONFIG_BYPASS_SHF 20#define GCR_L2_CONFIG_BYPASS_MSK ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF) +/* GCR_BASE register fields */ +#define GCR_BASE_GCRBASE_MSK 0xffffffff8000ULL +/* GCR_GIC_BASE register fields */ #define GCR_GIC_BASE_GICEN_MSK 1#define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 3/8] hw/mips_gic: Update pin state on mask changes
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
If the GIC interrupt mask is changed by a write to the smask (set mask) or rmask (reset mask) registers, we need to re-evaluate the state of the pins/IRQs fed to the CPU. Without doing so we risk leaving a pin high despite the interrupt that led to that state being masked, or losing interrupts if an already pending interrupt is unmasked.
--- hw/intc/mips_gic.c | 56 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 25 deletions(-)
hw/intc/mips_gic.c +31 -25
@@ -20,31 +20,29 @@#include "kvm_mips.h" #include "hw/intc/mips_gic.h" -static void mips_gic_set_vp_irq (MIPSGICState *gic,int vp,int pin,int level) +static void mips_gic_set_vp_irq (MIPSGICState *gic,int vp,int pin) { -int ored_level = level; +int ored_level =0 ;int i;/* ORing pending registers sharing same pin */ -if (!ored_level) { -for (i =0 ; i < gic->num_irq; i++) { -if ((gic->irq_state[i].map_pin &GIC_MAP_MSK ) == pin && - gic->irq_state[i].map_vp == vp && - gic->irq_state[i].enabled) { - ored_level |= gic->irq_state[i].pending; - } -if (ored_level) { -/* no need to iterate all interrupts */ -break ; - } +for (i =0 ; i < gic->num_irq; i++) { +if ((gic->irq_state[i].map_pin &GIC_MAP_MSK ) == pin && + gic->irq_state[i].map_vp == vp && + gic->irq_state[i].enabled) { + ored_level |= gic->irq_state[i].pending; } -if (((gic->vps[vp].compare_map &GIC_MAP_MSK ) == pin) && - (gic->vps[vp].mask &GIC_VP_MASK_CMP_MSK )) { -/* ORing with local pending register (count/compare) */ - ored_level |= (gic->vps[vp].pend &GIC_VP_MASK_CMP_MSK ) >> -GIC_VP_MASK_CMP_SHF ; +if (ored_level) { +/* no need to iterate all interrupts */ +break ; } } +if (((gic->vps[vp].compare_map &GIC_MAP_MSK ) == pin) && + (gic->vps[vp].mask &GIC_VP_MASK_CMP_MSK )) { +/* ORing with local pending register (count/compare) */ + ored_level |= (gic->vps[vp].pend &GIC_VP_MASK_CMP_MSK ) >> +GIC_VP_MASK_CMP_SHF ; + }if (kvm_enabled ()) { kvm_mips_set_ipi_interrupt(mips_env_get_cpu(gic->vps[vp].env), pin + GIC_CPU_PIN_OFFSET,
@@ -55,21 +53,27 @@ static void mips_gic_set_vp_irq(MIPSGICState *gic, int vp, int pin, int level) } } -static void gic_set_irq (void *opaque,int n_IRQ,int level) +static void gic_update_pin_for_irq (MIPSGICState *gic,int n_IRQ) { -MIPSGICState *gic = (MIPSGICState *) opaque;int vp = gic->irq_state[n_IRQ].map_vp;int pin = gic->irq_state[n_IRQ].map_pin &GIC_MAP_MSK ; +if (vp <0 || vp >= gic->num_vps) { +return ; + } +mips_gic_set_vp_irq (gic, vp, pin); +} + +static void gic_set_irq (void *opaque,int n_IRQ,int level) +{ +MIPSGICState *gic = (MIPSGICState *) opaque; + gic->irq_state[n_IRQ].pending = (uint8_t ) level;if (!gic->irq_state[n_IRQ].enabled) {/* GIC interrupt source disabled */ return ; } -if (vp <0 || vp >= gic->num_vps) { -return ; - } -mips_gic_set_vp_irq (gic, vp, pin, level); +gic_update_pin_for_irq (gic, n_IRQ); }#define OFFSET_CHECK (c) \
@@ -209,7 +213,7 @@ static void gic_timer_store_vp_compare(MIPSGICState *gic, uint32_t vp_index, gic->vps[vp_index].pend &= ~(1 <<GIC_LOCAL_INT_COMPARE );if (gic->vps[vp_index].compare_map &GIC_MAP_TO_PIN_MSK ) {uint32_t pin = (gic->vps[vp_index].compare_map &GIC_MAP_MSK ); -mips_gic_set_vp_irq (gic, vp_index, pin,0 ); +mips_gic_set_vp_irq (gic, vp_index, pin); }mips_gictimer_store_vp_compare (gic->gic_timer, vp_index, compare); }
@@ -286,6 +290,7 @@ static void gic_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)OFFSET_CHECK ((base + size *8 ) <= gic->num_irq);for (i =0 ; i < size *8 ; i++) { gic->irq_state[base + i].enabled &= !((data >> i) &1 ); +gic_update_pin_for_irq (gic, base + i); }break ;case GIC_SH_WEDGE_OFS :
@@ -305,6 +310,7 @@ static void gic_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)OFFSET_CHECK ((base + size *8 ) <= gic->num_irq);for (i =0 ; i < size *8 ; i++) { gic->irq_state[base + i].enabled |= (data >> i) &1 ; +gic_update_pin_for_irq (gic, base + i); }break ; case GIC_SH_MAP0_PIN_OFS ... GIC_SH_MAP255_PIN_OFS:
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 4/8] target-mips: Provide function to test if a CPU supports an ISA
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
Provide a new cpu_supports_isa function which allows callers to determine whether a CPU supports one of the ISA_ flags, by testing whether the associated struct mips_def_t sets the ISA flags in its insn_flags field.
An example use of this is to allow boards which generate bootloader code to determine the properties of the CPU that will be used, for example whether the CPU is 64 bit or which architecture revision it implements.
--- target/mips/cpu.h | 1 + target/mips/translate.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
target/mips/cpu.h +1 -0
@@ -815,6 +815,7 @@ int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);#define cpu_init (cpu_model) CPU(cpu_mips_init(cpu_model))bool cpu_supports_cps_smp (const char *cpu_model); +bool cpu_supports_isa (const char *cpu_model,unsigned int isa);void cpu_set_exception_base (int vp_index,target_ulong address);/* TODO QOM'ify CPU reset and remove */
target/mips/translate.c +10 -0
@@ -20233,6 +20233,16 @@ bool cpu_supports_cps_smp(const char *cpu_model)return (def->CP0_Config3 & (1 <<CP0C3_CMGCR )) !=0 ; } +bool cpu_supports_isa (const char *cpu_model,unsigned int isa) +{ +const mips_def_t *def =cpu_mips_find_by_name (cpu_model); +if (!def) { +return false; + } + +return (def->insn_flags & isa) !=0 ; +} +void cpu_set_exception_base (int vp_index,target_ulong address) {MIPSCPU *vp =MIPS_CPU (qemu_get_cpu (vp_index));
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 5/8] dtc: Update requirement to v1.4.2
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
In order to obtain fdt_first_subnode & fdt_next_subnode symbols from libfdt for use by a later patch, bump the requirement for dtc to v1.4.2 & the submodule to that same version.
--- configure | 6 +++--- dtc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
configure +3 -3
@@ -3396,11 +3396,11 @@ fi if test "$fdt" != "no" ; then fdt_libs="-lfdt" # explicitly check for libfdt_env.h as it is missing in some stable installs - # and test for required functions to make sure we are on a version >= 1.4.0 + # and test for required functions to make sure we are on a version >= 1.4.2 cat > $TMPC << EOF #include <libfdt.h> #include <libfdt_env.h> -int main(void) { fdt_get_property_by_offset(0, 0, 0); return 0; } +int main(void) { fdt_first_subnode(0, 0); return 0; } EOF if compile_prog "" "$fdt_libs" ; then # system DTC is good - use it
@@ -3418,7 +3418,7 @@ EOF fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" elif test "$fdt" = "yes" ; then # have neither and want - prompt for system/submodule install - error_exit "DTC (libfdt) version >= 1.4.0 not present. Your options:" \ + error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \ " (1) Preferred: Install the DTC (libfdt) devel package" \ " (2) Fetch the DTC submodule, using:" \ " git submodule update --init dtc"
dtc +1 -1
@@ -1 +1 @@ -Subproject commit 65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf +Subproject commit ec02b34c05be04f249ffaaca4b666f5246877dea
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 6/8] loader: Support Flattened Image Trees (FIT images)
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
Introduce support for loading Flattened Image Trees, as used by modern U-Boot. FIT images are essentially flattened device tree files which contain binary images such as kernels, FDTs or ramdisks along with one or more configuration nodes describing boot configurations.
The MIPS Boston board typically boots kernels in the form of FIT images, and will make use of this code.
[[email protected]:
fixed potential memory leaks,
isolated building option]
--- hw/core/Makefile.objs | 1 + hw/core/loader-fit.c | 325 ++++++++++++++++++++++++++++++++++++++++++++++++ hw/core/loader.c | 7 +- include/hw/loader-fit.h | 41 ++++++ include/hw/loader.h | 6 + 5 files changed, 374 insertions(+), 6 deletions(-) create mode 100644 hw/core/loader-fit.c create mode 100644 include/hw/loader-fit.h
hw/core/Makefile.objs +1 -0
@@ -13,6 +13,7 @@ common-obj-$(CONFIG_PTIMER) += ptimer.o common-obj-$(CONFIG_SOFTMMU) += sysbus.o common-obj-$(CONFIG_SOFTMMU) += machine.o common-obj-$(CONFIG_SOFTMMU) += loader.o +common-obj-$(CONFIG_FITLOADER) += loader-fit.o common-obj-$(CONFIG_SOFTMMU) += qdev-properties-system.o common-obj-$(CONFIG_SOFTMMU) += register.o common-obj-$(CONFIG_SOFTMMU) += or-irq.o
hw/core/loader-fit.c new file +325 -0
325 lines not on this page · raw message
hw/core/loader.c +1 -6
@@ -527,12 +527,7 @@ static void zfree(void *x, void *addr)#define DEFLATED 8 -/* This is the usual maximum in uboot, so if a uImage overflows this, it would -* overflow on real hardware too. */ -#define UBOOT_MAX_GUNZIP_BYTES (64 << 20) - -static ssize_t gunzip (void *dst,size_t dstlen,uint8_t *src, -size_t srclen) +ssize_t gunzip (void *dst,size_t dstlen,uint8_t *src,size_t srclen) {z_stream s;ssize_t dstbytes;
include/hw/loader-fit.h new file +41 -0
41 lines not on this page · raw message
include/hw/loader.h +6 -0
@@ -164,6 +164,8 @@ int load_uimage(const char *filename, hwaddr *ep,*/ int load_ramdisk (const char *filename,hwaddr addr,uint64_t max_sz); +ssize_t gunzip (void *dst,size_t dstlen,uint8_t *src,size_t srclen); +ssize_t read_targphys (const char *name,int fd,hwaddr dst_addr,size_t nbytes); void pstrcpy_targphys(const char *name,
@@ -214,4 +216,8 @@ void hmp_info_roms(Monitor *mon, const QDict *qdict);int rom_add_vga (const char *file);int rom_add_option (const char *file,int32_t bootindex); +/* This is the usual maximum in uboot, so if a uImage overflows this, it would +* overflow on real hardware too. */ +#define UBOOT_MAX_GUNZIP_BYTES (64 << 20) +#endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 7/8] hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
Add support for emulating the Xilinx AXI Root Port Bridge for PCI Express as described by Xilinx' PG055 document. This is a PCIe controller that can be used with certain series of Xilinx FPGAs, and is used on the MIPS Boston board which will make use of this code.
[[email protected]:
removed returning on !level,
updated IRQ connection with GPIO logic,
moved xilinx_pcie_init() to boston.c
replaced stw_le_p() with pci_set_word()
and other cosmetic changes]
--- hw/pci-host/Makefile.objs | 1 + hw/pci-host/xilinx-pcie.c | 328 ++++++++++++++++++++++++++++++++++++++ include/hw/pci-host/xilinx-pcie.h | 68 ++++++++ 3 files changed, 397 insertions(+) create mode 100644 hw/pci-host/xilinx-pcie.c create mode 100644 include/hw/pci-host/xilinx-pcie.h
hw/pci-host/Makefile.objs +1 -0
@@ -16,3 +16,4 @@ common-obj-$(CONFIG_FULONG) += bonito.o common-obj-$(CONFIG_PCI_PIIX) += piix.o common-obj-$(CONFIG_PCI_Q35) += q35.o common-obj-$(CONFIG_PCI_GENERIC) += gpex.o +common-obj-$(CONFIG_PCI_XILINX) += xilinx-pcie.o
hw/pci-host/xilinx-pcie.c new file +328 -0
328 lines not on this page · raw message
include/hw/pci-host/xilinx-pcie.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL v2 7/8] hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
Quoted 26 lines · Yongbok Kim
From: Paul Burton <[email protected]>
Add support for emulating the Xilinx AXI Root Port Bridge for PCI Express as described by Xilinx' PG055 document. This is a PCIe controller that can be used with certain series of Xilinx FPGAs, and is used on the MIPS Boston board which will make use of this code.
Signed-off-by Paul Burton <[email protected]>[[email protected]:
removed returning on !level,
updated IRQ connection with GPIO logic,
movedxilinx_pcie_init()toboston.c
replacedstw_le_p()withpci_set_word()
and other cosmetic changes]Signed-off-by Yongbok Kim <[email protected]>---
hw/pci-host/xilinx-pcie.c new file +9
-0+static void xilinx_pcie_host_realize (DeviceState *dev,Error **errp) +{ +PCIHostState *pci =PCI_HOST_BRIDGE (dev); +XilinxPCIEHost *s =XILINX_PCIE_HOST (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +PCIExpressHost *pex =PCIE_HOST_BRIDGE (dev); + +snprintf (s->name,sizeof (s->name),"pcie%u" , s->bus_nr); +
hw/pci-host/xilinx-pcie.c line 124
Quoted 10 lines
hw/pci-host/xilinx-pcie.c new file +10
-0+/* PCI configuration space */ +pcie_host_mmcfg_init (pex, s->cfg_size); + +/* MMIO region */ +memory_region_init (&s->mmio,OBJECT (s),"mmio" ,UINT64_MAX ); +memory_region_set_enabled (&s->mmio, false); + +/* dummy I/O region */ +memory_region_init_ram (&s->io,OBJECT (s),"io" ,16 ,NULL ); +memory_region_set_enabled (&s->io, false);
Hi; I was looking at the code for this PCI controller as part of identifying RAM memory regions that don't migrate their contents, and this looks kind of odd. Can you explain why this is using a RAM region for the PCI bus's IO memory space? None of our other PCI controller models do this, so I suspect this is a bug. (The effect would be that PCI IO accesses to addresses which don't have a PCI BAR mapped there will behave as reads-as-written, which seems pretty unlikely to be what the hardware does.)
What is the intended semantics for PCI IO accesses with this controller? (It seems to only be used with the MIPS boston board model.)
thanks
-- PMM
Re: [Qemu-devel] [PULL v2 7/8] hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
Hi Peter,
Quoted 48 lines · Peter Maydell
Quoted 26 lines · Yongbok Kim
From: Paul Burton <[email protected]>
Add support for emulating the Xilinx AXI Root Port Bridge for PCI Express as described by Xilinx' PG055 document. This is a PCIe controller that can be used with certain series of Xilinx FPGAs, and is used on the MIPS Boston board which will make use of this code.
Signed-off-by Paul Burton <[email protected]>[[email protected]:
removed returning on !level,
updated IRQ connection with GPIO logic,
movedxilinx_pcie_init()toboston.c
replacedstw_le_p()withpci_set_word()
and other cosmetic changes]Signed-off-by Yongbok Kim <[email protected]>---
hw/pci-host/xilinx-pcie.c new file +9
-0+static void xilinx_pcie_host_realize (DeviceState *dev,Error **errp) +{ +PCIHostState *pci =PCI_HOST_BRIDGE (dev); +XilinxPCIEHost *s =XILINX_PCIE_HOST (dev); +SysBusDevice *sbd =SYS_BUS_DEVICE (dev); +PCIExpressHost *pex =PCIE_HOST_BRIDGE (dev); + +snprintf (s->name,sizeof (s->name),"pcie%u" , s->bus_nr); +hw/pci-host/xilinx-pcie.c line 124
Quoted 10 lines
hw/pci-host/xilinx-pcie.c new file +10
-0+/* PCI configuration space */ +pcie_host_mmcfg_init (pex, s->cfg_size); + +/* MMIO region */ +memory_region_init (&s->mmio,OBJECT (s),"mmio" ,UINT64_MAX ); +memory_region_set_enabled (&s->mmio, false); + +/* dummy I/O region */ +memory_region_init_ram (&s->io,OBJECT (s),"io" ,16 ,NULL ); +memory_region_set_enabled (&s->io, false);Hi; I was looking at the code for this PCI controller as part of identifying RAM memory regions that don't migrate their contents, and this looks kind of odd. Can you explain why this is using a RAM region for the PCI bus's IO memory space? None of our other PCI controller models do this, so I suspect this is a bug. (The effect would be that PCI IO accesses to addresses which don't have a PCI BAR mapped there will behave as reads-as-written, which seems pretty unlikely to be what the hardware does.)
Quoted 6 lines
What is the intended semantics for PCI IO accesses with this controller? (It seems to only be used with the MIPS boston board model.)
thanks
-- PMM
The controller here simply doesn't support I/O accesses, and the dummy region is there to prevent the rest of QEMU's PCI code & device emulation from needing to care about that fact. The region is never mapped into the system memory and so software running on the emulated system has no way to access it.
Thanks,
Paul
Re: [Qemu-devel] [PULL v2 7/8] hw: xilinx-pcie: Add support for Xilinx AXI PCIe Controller
Quoted 17 lines · Paul Burton
Hi Peter,
Quoted 10 lines · Peter Maydell
Hi; I was looking at the code for this PCI controller as part of identifying RAM memory regions that don't migrate their contents, and this looks kind of odd. Can you explain why this is using a RAM region for the PCI bus's IO memory space? None of our other PCI controller models do this, so I suspect this is a bug. (The effect would be that PCI IO accesses to addresses which don't have a PCI BAR mapped there will behave as reads-as-written, which seems pretty unlikely to be what the hardware does.)
Quoted 3 lines
What is the intended semantics for PCI IO accesses with this controller? (It seems to only be used with the MIPS boston board model.)
Quoted 5 lines
The controller here simply doesn't support I/O accesses, and the dummy region is there to prevent the rest of QEMU's PCI code & device emulation from needing to care about that fact. The region is never mapped into the system memory and so software running on the emulated system has no way to access it.
Right, I wondered if that was the case. The region should not be RAM, then, it should be a dummy does-nothing region. I'll put a patch together at some point.
thanks
-- PMM
[Qemu-devel] [PULL v2 2/8] hw/mips_gictimer: provide API for retrieving frequency
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
Provide a new function mips_gictimer_get_freq() which returns the frequency at which a GIC timer will count. This will be useful for boards which perform setup based upon this frequency.
--- hw/timer/mips_gictimer.c | 5 +++++ include/hw/timer/mips_gictimer.h | 1 + 2 files changed, 6 insertions(+)
hw/timer/mips_gictimer.c +5 -0
@@ -14,6 +14,11 @@#define TIMER_PERIOD 10/* 10 ns period for 100 Mhz frequency */ +uint32_t mips_gictimer_get_freq (MIPSGICTimerState *gic) +{ +return NANOSECONDS_PER_SECOND /TIMER_PERIOD ; +} +static void gic_vptimer_update (MIPSGICTimerState *gictimer,uint32_t vp_index,uint64_t now) {
include/hw/timer/mips_gictimer.h +1 -0
@@ -31,6 +31,7 @@ struct MIPSGICTimerState {MIPSGICTimerCB *cb; }; +uint32_t mips_gictimer_get_freq (MIPSGICTimerState *gic);uint32_t mips_gictimer_get_sh_count (MIPSGICTimerState *gic);void mips_gictimer_store_sh_count (MIPSGICTimerState *gic,uint64_t count); uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer,
Signature · 1 line
2.7.4
[Qemu-devel] [PULL v2 8/8] hw/mips: MIPS Boston board support
In reply to Yongbok KimFrom: Paul Burton <[email protected]>
Introduce support for emulating the MIPS Boston development board. The Boston board is built around an FPGA & 3 PCIe controllers, one of which is connected to an Intel EG20T Platform Controller Hub. It is used during the development & debug of new CPUs and the software intended to run on them, and is essentially the successor to the older MIPS Malta board.
This patch does not implement the EG20T, instead connecting an already supported ICH-9 AHCI controller. Whilst this isn't accurate it's enough for typical stock Boston software (eg. Linux kernels) to work with hard disks given that both the ICH-9 & EG20T implement the AHCI specification.
Boston boards typically boot kernels in the FIT image format, and this patch will treat kernels provided to QEMU as such. When loading a kernel directly, the board code will generate minimal firmware much as the Malta board code does. This firmware will set up the CM, CPC & GIC register base addresses then set argument registers & jump to the kernel entry point. Alternatively, bootloader code may be loaded using the bios argument in which case no firmware will be generated & execution will proceed from the start of the boot code at the default MIPS boot exception vector (offset 0x1fc00000 into (c)kseg1).
Currently real Boston boards are always used with FPGA bitfiles that include a Global Interrupt Controller (GIC), so the interrupt configuration is only defined for such cases. Therefore the board will only allow use of CPUs which implement the CPS components, including the GIC, and will otherwise exit with a message.
[[email protected]:
isolated boston machine support for mips64el.
updated for recent Chardev changes.
ignore missing bios/kernel for qtest.
added default -drive to if=ide explicitly]
--- configure | 2 +- default-configs/mips64el-softmmu.mak | 3 + hw/mips/Makefile.objs | 1 + hw/mips/boston.c | 577 +++++++++++++++++++++++++++++++++++ 4 files changed, 582 insertions(+), 1 deletion(-) create mode 100644 hw/mips/boston.c
configure +1 -1
@@ -3378,7 +3378,7 @@ fi fdt_required=no for target in $target_list; do case $target in - aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu) + aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu) fdt_required=yes ;; esac
default-configs/mips64el-softmmu.mak +3 -0
@@ -10,3 +10,6 @@ CONFIG_JAZZ=y CONFIG_G364FB=y CONFIG_JAZZ_LED=y CONFIG_VT82C686=y +CONFIG_MIPS_BOSTON=y +CONFIG_FITLOADER=y +CONFIG_PCI_XILINX=y
hw/mips/Makefile.objs +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_JAZZ) += mips_jazz.o obj-$(CONFIG_FULONG) += mips_fulong2e.o obj-y += gt64xxx_pci.o obj-$(CONFIG_MIPS_CPS) += cps.o +obj-$(CONFIG_MIPS_BOSTON) += boston.o
hw/mips/boston.c new file +577 -0
577 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL v2 8/8] hw/mips: MIPS Boston board support
Quoted 31 lines · Yongbok Kim
From: Paul Burton <[email protected]>
Introduce support for emulating the MIPS Boston development board. The Boston board is built around an FPGA & 3 PCIe controllers, one of which is connected to an Intel EG20T Platform Controller Hub. It is used during the development & debug of new CPUs and the software intended to run on them, and is essentially the successor to the older MIPS Malta board.
This patch does not implement the EG20T, instead connecting an already supported ICH-9 AHCI controller. Whilst this isn't accurate it's enough for typical stock Boston software (eg. Linux kernels) to work with hard disks given that both the ICH-9 & EG20T implement the AHCI specification.
Boston boards typically boot kernels in the FIT image format, and this patch will treat kernels provided to QEMU as such. When loading a kernel directly, the board code will generate minimal firmware much as the Malta board code does. This firmware will set up the CM, CPC & GIC register base addresses then set argument registers & jump to the kernel entry point. Alternatively, bootloader code may be loaded using the bios argument in which case no firmware will be generated & execution will proceed from the start of the boot code at the default MIPS boot exception vector (offset
0x1fc00000into (c)kseg1).Currently real Boston boards are always used with FPGA bitfiles that include a Global Interrupt Controller (GIC), so the interrupt configuration is only defined for such cases. Therefore the board will only allow use of CPUs which implement the CPS components, including the GIC, and will otherwise exit with a message.
hw/mips/boston.c line 575
Quoted 8 lines
hw/mips/boston.c new file +8
-0+static void boston_mach_class_init (MachineClass *mc) +{ + mc->desc ="MIPS Boston" ; + mc->init = boston_mach_init; + mc->block_default_type =IF_IDE ; + mc->default_ram_size =2 *G_BYTE ; + mc->max_cpus =16 ; +}
I only just noticed, but this breaks "make check" on 32-bit hosts:
TEST: tests/qom-test... (pid=16740)
/mips64el/qom/boston:
qemu-system-mips64el: at most 2047 MB RAM can be simulated Broken pipe
FAIL
because vl.c has
/* On 32-bit hosts, QEMU is limited by virtual address space */
if (ram_size > (2047 << 20) && HOST_LONG_BITS == 32) {
error_report("at most 2047 MB RAM can be simulated");
exit(1);
}Unfortunately I didn't notice before I pushed your pull request. Luckily this is the last patch in the pullreq, so I can just revert this one commit (d3473e147a754e999718bf6fcb015d9978c6a1ee)...
Please fix the board model patch and resend it. You'll need the board to default to a ram size that works on all hosts.
(I'm taking the revert option because we're getting pretty close to freeze and I have a bunch of pull requests in the queue that I'd prefer not to delay while we fix this up.)
thanks
-- PMM
Re: [Qemu-devel] [PULL v2 8/8] hw/mips: MIPS Boston board support
Quoted 63 lines · Peter Maydell
Quoted 31 lines · Yongbok Kim
From: Paul Burton <[email protected]>
Introduce support for emulating the MIPS Boston development board. The Boston board is built around an FPGA & 3 PCIe controllers, one of which is connected to an Intel EG20T Platform Controller Hub. It is used during the development & debug of new CPUs and the software intended to run on them, and is essentially the successor to the older MIPS Malta board.
This patch does not implement the EG20T, instead connecting an already supported ICH-9 AHCI controller. Whilst this isn't accurate it's enough for typical stock Boston software (eg. Linux kernels) to work with hard disks given that both the ICH-9 & EG20T implement the AHCI specification.
Boston boards typically boot kernels in the FIT image format, and this patch will treat kernels provided to QEMU as such. When loading a kernel directly, the board code will generate minimal firmware much as the Malta board code does. This firmware will set up the CM, CPC & GIC register base addresses then set argument registers & jump to the kernel entry point. Alternatively, bootloader code may be loaded using the bios argument in which case no firmware will be generated & execution will proceed from the start of the boot code at the default MIPS boot exception vector (offset
0x1fc00000into (c)kseg1).Currently real Boston boards are always used with FPGA bitfiles that include a Global Interrupt Controller (GIC), so the interrupt configuration is only defined for such cases. Therefore the board will only allow use of CPUs which implement the CPS components, including the GIC, and will otherwise exit with a message.
hw/mips/boston.c line 575
Quoted 8 lines
hw/mips/boston.c new file +8
-0+static void boston_mach_class_init (MachineClass *mc) +{ + mc->desc ="MIPS Boston" ; + mc->init = boston_mach_init; + mc->block_default_type =IF_IDE ; + mc->default_ram_size =2 *G_BYTE ; + mc->max_cpus =16 ; +}I only just noticed, but this breaks "make check" on 32-bit hosts:
TEST: tests/qom-test... (pid=16740)
/mips64el/qom/boston:
qemu-system-mips64el: at most 2047 MB RAM can be simulated Broken pipe
FAILbecause
vl.chas/* On 32-bit hosts, QEMU is limited by virtual address space */ if (ram_size > (2047 << 20) && HOST_LONG_BITS == 32) { error_report("at most 2047 MB RAM can be simulated"); exit(1); }Unfortunately I didn't notice before I pushed your pull request. Luckily this is the last patch in the pullreq, so I can just revert this one commit (
d3473e147a754e999718bf6fcb015d9978c6a1ee)...Please fix the board model patch and resend it. You'll need the board to default to a ram size that works on all hosts.
Quoted 7 lines
(I'm taking the revert option because we're getting pretty close to freeze and I have a bunch of pull requests in the queue that I'd prefer not to delay while we fix this up.)
thanks
-- PMM
My apologies for the inconvenience! I missed to check it on the 32-bit hosts.
I am not seeing the revert commit on the master?
I've sent a modified patch with the fix and a pull request containing reverting the commit by myself and the updated Boston patch.
Regards,
Yongbok
Re: [Qemu-devel] [PULL v2 8/8] hw/mips: MIPS Boston board support
Quoted 3 lines · Yongbok Kim
My apologies for the inconvenience! I missed to check it on the 32-bit hosts.
I am not seeing the revert commit on the master?
It didn't finish testing before I went home yesterday. I've just pushed it out now.
thanks
-- PMM
Quoted 19 lines · Yongbok Kim
Hi,
This is the v2 of the pull-req for target-mips.
The warning treated as error has been fixed and the file is now isolated for mips64el only. Boston has further update to have default -drive to if=ide.Regards,
YongbokThe following changes since commit
796b288f7be875045670f963ce99991b3c8e96ac:Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2017-02-21 15:48:22 +0000)
are available in the git repository at:
git://github.com/yongbok/upstream-qemu.gittags/mips-20170222for you to fetch changes up to
d3473e147a754e999718bf6fcb015d9978c6a1ee:
Quoted 7 lines
hw/mips: MIPS Boston board support (2017-02-21 23:49:30 +0000)
----------------------------------------------------------------
MIPS patches 2017-02-22Changes:
* Add MIPS Boston board support
This seems to cause a lot of new clang sanitizer warnings:/home/petmay01/linaro/qemu-for-merges/dtc/libfdt/fdt_rw.c:288:21:
runtime error: null pointer passed as argument 2, which is declared to never be null
which are all for the memcpy() in fdt_setprop() when fdt_setprop() is passed a NULL pointer.
On the other hand the implementation of fdt_setprop() hasn't changed in years so I'm not quite sure why this warning is only showing up now. It may be that the clang build used to pull in system libfdt but now has built its own.
On that basis I've pushed this to master and we'll figure out the sanitizer issues separately.
Please make sure you update the 'Build dependencies' section of
http://wiki.qemu-project.org/ChangeLog/2.9
to flag up the new libfdt version dependency to users.
thanks
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 3 lines · Yongbok Kim
This is the v2 of the pull-req for target-mips.
The warning treated as error has been fixed and the file is now isolated for mips64el only. Boston has further update to have default -drive to if=ide.Please make sure you update the 'Build dependencies' section of
http://wiki.qemu-project.org/ChangeLog/2.9
to flag up the new libfdt version dependency to users
Reminder: please update
http://wiki.qemu-project.org/ChangeLog/2.9#Build_dependencies
to mention the new libfdt version dependency.
thanks
-- PMM
I updated the section before?
Build dependencies
QEMU now requires a minimum dtc version of 1.4.2.
Do you mean to update it like "dtc (libfdt)"?
Regards,
Yongbok
Quoted 17 lines · Peter Maydell
Quoted 8 lines · Peter Maydell
Quoted 3 lines · Yongbok Kim
This is the v2 of the pull-req for target-mips.
The warning treated as error has been fixed and the file is now isolated for mips64el only. Boston has further update to have default -drive to if=ide.Please make sure you update the 'Build dependencies' section of
http://wiki.qemu-project.org/ChangeLog/2.9
to flag up the new libfdt version dependency to usersReminder: please update
http://wiki.qemu-project.org/ChangeLog/2.9#Build_dependencies
to mention the new libfdt version dependency.thanks
-- PMM
Quoted 8 lines · Yongbok Kim
I updated the section before?
Build dependencies
QEMU now requires a minimum dtc version of 1.4.2.
Do you mean to update it like "dtc (libfdt)"?
No, that's fine. Sorry, I must have somehow been looking at a stale version of the page or the wrong copy or something.
thanks
-- PMM