ppc-for-2.12 queue 20180306
The following changes since commit f2bb2d14c2958f3f5aef456bd2cdb1ff99f4a562:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-05 16:41:20 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-2.12-20180306
for you to fetch changes up to 21b786f607b11d888f90bbb8c3414500515d11e7:
PowerPC: Add TS bits into msr_mask (2018-03-06 13:16:29 +1100)
----------------------------------------------------------------
ppc patch queue 2018-03-06
This pull request supersedes ppc-for-2.12-20180302 which had compile problems with some gcc versions. It also contains a few additional patches.
Highlights are:
* New Sam460ex machine type
* Yet more fixes related to vcpu id allocation for spapr
* Numerous macio cleanupsr
* Some enhancements to the Spectre/Meltdown fixes for pseries, allowing use of a better mitigation for indirect branch based exploits
* New pseries machine types with Spectre/Meltdown mitigations enabled (stop gap until libvirt and management understands the machine options)
* A handful of other fixes
----------------------------------------------------------------
BALATON Zoltan (5):
ppc440_uc: Fix unintialized variable warning with older gcc
ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)
pc-bios: Added u-boot-sam460 firmware binary
ppc: Add aCube Sam460ex board
David Engraf (1):
PPC: e500: Fix duplicate kernel load and device tree overlap
Greg Kurz (3):
spapr: fix missing CPU core nodes in DT when running with TCG
spapr: register dummy ICPs later
spapr: harden code that depends on VSMT
Mark Cave-Ayland (13):
macio: embed DBDMA device directly within macio
macio: move ESCC device within the macio device
heathrow: QOMify heathrow PIC
heathrow: convert to trace-events
heathrow: change heathrow_pic_init() to return the heathrow device
macio: move macio related structures and defines into separate macio.h file
mac_oldworld: use object link to pass heathrow PIC object to macio
openpic: move KVM-specific declarations into separate openpic_kvm.h file
openpic: move OpenPIC state and related definitions to openpic.h
mac_newworld: use object link to pass OpenPIC object to macio
macio: move setting of CUDA timebase frequency to macio_common_realize()
macio: remove macio_init() function
adb: add trace-events for monitoring keyboard/mouse during bus enumeration
Nikunj A Dadhania (1):
hw/ppc/spapr,e500: Use new property "stdout-path" for boot console
Simon Guo (1):
PowerPC: Add TS bits into msr_mask
Suraj Jitindar Singh (6):
target/ppc: Check mask when setting cap_ppc_safe_indirect_branch ppc/spapr-caps: Add support for custom spapr_capabilities ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap ppc/spapr-caps: Convert cap-ibs to custom spapr-cap ppc/spapr-caps: Define the pseries-2.12-sxxm machine type
.gitmodules | 3 + Makefile | 4 +- default-configs/ppc-softmmu.mak | 2 + default-configs/ppcemb-softmmu.mak | 1 + hw/input/adb-kbd.c | 4 + hw/input/adb-mouse.c | 5 + hw/input/trace-events | 5 + hw/intc/heathrow_pic.c | 166 +++++----- hw/intc/openpic.c | 157 ---------- hw/intc/openpic_kvm.c | 1 + hw/intc/trace-events | 5 + hw/misc/macio/macio.c | 150 +++++---- hw/ppc/Makefile.objs | 3 +- hw/ppc/e500.c | 124 +++++--- hw/ppc/mac.h | 10 +- hw/ppc/mac_newworld.c | 56 ++-- hw/ppc/mac_oldworld.c | 50 ++- hw/ppc/ppc440_pcix.c | 528 ++++++++++++++++++++++++++++++++ hw/ppc/ppc440_uc.c | 3 + hw/ppc/sam460ex.c | 603 +++++++++++++++++++++++++++++++++++++ hw/ppc/spapr.c | 176 ++++++----- hw/ppc/spapr_caps.c | 153 +++++++--- hw/ppc/spapr_hcall.c | 5 +- hw/ppc/trace-events | 8 + include/hw/intc/heathrow_pic.h | 49 +++ include/hw/misc/macio/macio.h | 79 +++++ include/hw/ppc/openpic.h | 160 +++++++++- include/hw/ppc/openpic_kvm.h | 7 + include/hw/ppc/spapr.h | 5 +- pc-bios/canyonlands.dtb | Bin 0 -> 9779 bytes pc-bios/canyonlands.dts | 566 ++++++++++++++++++++++++++++++++++ pc-bios/u-boot-sam460-20100605.bin | Bin 0 -> 524288 bytes roms/Makefile | 7 + roms/u-boot-sam460ex | 1 + target/ppc/kvm-stub.c | 2 +- target/ppc/kvm.c | 6 +- target/ppc/translate_init.c | 2 + 37 files changed, 2533 insertions(+), 573 deletions(-) create mode 100644 hw/ppc/ppc440_pcix.c create mode 100644 hw/ppc/sam460ex.c create mode 100644 include/hw/intc/heathrow_pic.h create mode 100644 include/hw/misc/macio/macio.h create mode 100644 include/hw/ppc/openpic_kvm.h create mode 100644 pc-bios/canyonlands.dtb create mode 100644 pc-bios/canyonlands.dts create mode 100755 pc-bios/u-boot-sam460-20100605.bin create mode 160000 roms/u-boot-sam460ex
[Qemu-devel] [PULL 01/30] spapr: fix missing CPU core nodes in DT when running with TCG
From: Greg Kurz <[email protected]>
Commit 5d0fb1508e2d "spapr: consolidate the VCPU id numbering logic in a single place" introduced a helper to detect thread0 of a virtual core based on its VCPU id. This is used to create CPU core nodes in the DT, but it is broken in TCG.
$ qemu-system-ppc64 -nographic -accel tcg -machine dumpdtb=dtb.bin \
-smp cores=16,maxcpus=16,threads=1
$ dtc -f -O dts dtb.bin | grep POWER8
PowerPC,POWER8@0 {
PowerPC,POWER8@8 {instead of the expected 16 cores that we get with KVM:
$ dtc -f -O dts dtb.bin | grep POWER8
PowerPC,POWER8@0 {
PowerPC,POWER8@8 {
PowerPC,POWER8@10 {
PowerPC,POWER8@18 {
PowerPC,POWER8@20 {
PowerPC,POWER8@28 {
PowerPC,POWER8@30 {
PowerPC,POWER8@38 {
PowerPC,POWER8@40 {
PowerPC,POWER8@48 {
PowerPC,POWER8@50 {
PowerPC,POWER8@58 {
PowerPC,POWER8@60 {
PowerPC,POWER8@68 {
PowerPC,POWER8@70 {
PowerPC,POWER8@78 {This happens because spapr_get_vcpu_id() maps VCPU ids to cs->cpu_index in TCG mode. This confuses the code in spapr_is_thread0_in_vcore(), since it assumes thread0 VCPU ids to have a spapr->vsmt spacing.
spapr_get_vcpu_id(cpu) % spapr->vsmt == 0
Actually, there's no real reason to expose cs->cpu_index instead of the VCPU id, since we also generate it with TCG. Also we already set it explicitly in spapr_set_vcpu_id(), so there's no real reason either to call kvm_arch_vcpu_id() with KVM.
This patch unifies spapr_get_vcpu_id() to always return the computed VCPU id both in TCG and KVM. This is one step forward towards KVM<->TCG migration.
--- hw/ppc/spapr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
hw/ppc/spapr.c +1 -7
@@ -3810,13 +3810,7 @@ static void spapr_pic_print_info(InterruptStatsProvider *obj,int spapr_get_vcpu_id (PowerPCCPU *cpu) { -CPUState *cs =CPU (cpu); - -if (kvm_enabled ()) { -return kvm_arch_vcpu_id (cs); - }else { -return cs->cpu_index; - } +return cpu->vcpu_id; }void spapr_set_vcpu_id (PowerPCCPU *cpu,int cpu_index,Error **errp)
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 03/30] ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
This is the PCIX controller found in newer 440 core SoCs e.g. the AMMC 460EX. The device tree refers to this as plb-pcix compared to the plb-pci controller in older 440 SoCs.
[dwg: Remove hwaddr from trace-events, that doesn't work with some
trace backends]
--- hw/ppc/Makefile.objs | 2 +- hw/ppc/ppc440_pcix.c | 528 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/ppc/trace-events | 8 + 3 files changed, 537 insertions(+), 1 deletion(-) create mode 100644 hw/ppc/ppc440_pcix.c
hw/ppc/Makefile.objs +1 -1
@@ -13,7 +13,7 @@ endif obj-$(CONFIG_PSERIES) += spapr_rtas_ddw.o # PowerPC 4xx boards obj-y += ppc4xx_devs.o ppc405_uc.o -obj-$(CONFIG_PPC4XX) += ppc4xx_pci.o ppc405_boards.o ppc440_bamboo.o +obj-$(CONFIG_PPC4XX) += ppc4xx_pci.o ppc405_boards.o ppc440_bamboo.o ppc440_pcix.o # PReP obj-$(CONFIG_PREP) += prep.o obj-$(CONFIG_PREP) += prep_systemio.o
hw/ppc/ppc440_pcix.c new file +528 -0
528 lines not on this page · raw message
hw/ppc/trace-events +8 -0
@@ -99,3 +99,11 @@ mac99_uninorth_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"P # hw/ppc/ppc4xx_pci.c ppc4xx_pci_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d" ppc4xx_pci_set_irq(int irq_num) "PCI irq %d" + +# hw/ppc/ppc440_pcix.c +ppc440_pcix_map_irq(int32_t devfn, int irq_num, int slot) "devfn 0x%x irq %d -> %d" +ppc440_pcix_set_irq(int irq_num) "PCI irq %d" +ppc440_pcix_update_pim(int idx, uint64_t size, uint64_t la) "Added window %d of size=0x%" PRIx64 " to CPU=0x%" PRIx64 +ppc440_pcix_update_pom(int idx, uint32_t size, uint64_t la, uint64_t pcia) "Added window %d of size=0x%x from CPU=0x%" PRIx64 " to PCI=0x%" PRIx64 +ppc440_pcix_reg_read(uint64_t addr, uint32_t val) "addr 0x%" PRIx64 " = 0x%" PRIx32 +ppc440_pcix_reg_write(uint64_t addr, uint64_t val) "addr 0x%" PRIx64 " = 0x%" PRIx64
Signature · 1 line
2.14.3
Re: [Qemu-devel] [PULL 03/30] ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
Quoted 11 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is the PCIX controller found in newer 440 core SoCs e.g. the AMMC 460EX. The device tree refers to this as plb-pcix compared to the plb-pci controller in older 440 SoCs.
Signed-off-by BALATON Zoltan <[email protected]>[dwg: Remove hwaddr from trace-events, that doesn't work with some
trace backends]Signed-off-by David Gibson <[email protected]>
hw/ppc/ppc440_pcix.c line 261
Quoted 5 lines
hw/ppc/ppc440_pcix.c new file +5
-0+case PCIX0_PIM2SAL : + s->pim[2 ].sa &=0xffffffff00000000ULL ; + s->pim[2 ].sa = val; +ppc440_pcix_update_pim (s,2 ); +break ;
Coverity (CID1390577) points out that the "s->pim[2].sa = val;" overwrites the value set by the &= line, making it pointless. Should this be "|= val" like the other cases in this switch?
thanks
-- PMM
Re: [Qemu-devel] [PULL 03/30] ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
Quoted 18 lines · Peter Maydell
Quoted 11 lines · David Gibson
From: BALATON Zoltan <[email protected]>
This is the PCIX controller found in newer 440 core SoCs e.g. the AMMC 460EX. The device tree refers to this as plb-pcix compared to the plb-pci controller in older 440 SoCs.
Signed-off-by BALATON Zoltan <[email protected]>[dwg: Remove hwaddr from trace-events, that doesn't work with some
trace backends]Signed-off-by David Gibson <[email protected]>hw/ppc/ppc440_pcix.c line 261
Quoted 5 lines
hw/ppc/ppc440_pcix.c new file +5
-0+case PCIX0_PIM2SAL : + s->pim[2 ].sa &=0xffffffff00000000ULL ; + s->pim[2 ].sa = val; +ppc440_pcix_update_pim (s,2 ); +break ;
Quoted 3 lines
Coverity (CID1390577) points out that the "s->pim[2].sa = val;" overwrites the value set by the &= line, making it pointless. Should this be "|= val" like the other cases in this switch?
Yes this is a typo and I meant |= here like in other cases. I'll send a patch to correct this with the next batch of changes. Thanks for spotting it.
Regards,
BALATON Zoltan
[Qemu-devel] [PULL 02/30] ppc440_uc: Fix unintialized variable warning with older gcc
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
--- hw/ppc/ppc440_uc.c | 3 +++ 1 file changed, 3 insertions(+)
hw/ppc/ppc440_uc.c +3 -0
@@ -1050,6 +1050,9 @@ static void ppc460ex_pcie_realize(DeviceState *dev, Error **errp)case DCRN_PCIE1_BASE : id =1 ;break ; +default : +error_setg (errp,"invalid PCIe DCRN base" ); +return ; }snprintf (buf,sizeof (buf),"pcie%d-io" , id);memory_region_init (&s->iomem,OBJECT (s), buf,UINT64_MAX );
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 15/30] mac_oldworld: use object link to pass heathrow PIC object to macio
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
Also switch macio_oldworld_realize() over to use it rather than using the pic_mem memory region directly.
--- hw/misc/macio/macio.c | 14 ++++++++++---- hw/ppc/mac_oldworld.c | 8 +++++--- include/hw/misc/macio/macio.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-)
hw/misc/macio/macio.c +10 -4
@@ -31,6 +31,7 @@#include "hw/ppc/mac_dbdma.h" #include "hw/char/escc.h" #include "hw/misc/macio/macio.h" +#include "hw/intc/heathrow_pic.h" /* * The mac-io has two interfaces to the ESCC. One is called "escc-legacy",
@@ -167,10 +168,10 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp) sysbus_mmio_get_region(sysbus_dev, 0));pmac_format_nvram_partition (&os->nvram, os->nvram.size); -if (s->pic_mem) { -/* Heathrow PIC */ -memory_region_add_subregion (&s->bar,0x00000 , s->pic_mem); - } +/* Heathrow PIC */ + sysbus_dev =SYS_BUS_DEVICE (os->pic); +memory_region_add_subregion (&s->bar,0x0 , +sysbus_mmio_get_region (sysbus_dev,0 ));/* IDE buses */ for (i =0 ; i <ARRAY_SIZE (os->ide); i++) {
@@ -208,6 +209,11 @@ static void macio_oldworld_init(Object *obj)qdev_init_gpio_out (DEVICE (obj), os->irqs,ARRAY_SIZE (os->irqs)); +object_property_add_link (obj,"pic" ,TYPE_HEATHROW , + (Object **) &os->pic, + qdev_prop_allow_set_link_before_realize, +0 ,NULL ); +object_initialize (&os->nvram,sizeof (os->nvram),TYPE_MACIO_NVRAM ); dev =DEVICE (&os->nvram);qdev_prop_set_uint32 (dev,"size" ,0x2000 );
hw/ppc/mac_oldworld.c +5 -3
@@ -93,7 +93,7 @@ static void ppc_heathrow_init(MachineState *machine)uint32_t kernel_base, initrd_base, cmdline_base =0 ;int32_t kernel_size, initrd_size;PCIBus *pci_bus; -PCIDevice *macio; +OldWorldMacIOState *macio;MACIOIDEState *macio_ide;DeviceState *dev, *pic_dev;SysBusDevice *sbd;
@@ -271,7 +271,7 @@ static void ppc_heathrow_init(MachineState *machine)ide_drive_get (hd,ARRAY_SIZE (hd));/* MacIO */ - macio =pci_create (pci_bus,-1 ,TYPE_OLDWORLD_MACIO ); + macio =OLDWORLD_MACIO (pci_create (pci_bus,-1 ,TYPE_OLDWORLD_MACIO )); dev =DEVICE (macio);qdev_connect_gpio_out (dev,0 , pic[0x12 ]);/* CUDA */ qdev_connect_gpio_out (dev,1 , pic[0x10 ]);/* ESCC-B */
@@ -281,8 +281,10 @@ static void ppc_heathrow_init(MachineState *machine)qdev_connect_gpio_out (dev,5 , pic[0x0E ]);/* IDE-1 */ qdev_connect_gpio_out (dev,6 , pic[0x03 ]);/* IDE-1 DMA */ qdev_prop_set_uint64 (dev,"frequency" , tbfreq); +object_property_set_link (OBJECT (macio),OBJECT (pic_dev),"pic" , + &error_abort); sbd =SYS_BUS_DEVICE (pic_dev); -macio_init (macio,sysbus_mmio_get_region (sbd,0 )); +macio_init (PCI_DEVICE (macio),sysbus_mmio_get_region (sbd,0 )); macio_ide =MACIO_IDE (object_resolve_path_component (OBJECT (macio),"ide[0]" ));
include/hw/misc/macio/macio.h +2 -0
@@ -26,6 +26,7 @@#ifndef MACIO_H #define MACIO_H +#include "hw/intc/heathrow_pic.h" #include "hw/misc/macio/cuda.h" #include "hw/ppc/mac_dbdma.h"
@@ -54,6 +55,7 @@ typedef struct OldWorldMacIOState {MacIOState parent_obj;/*< public >*/ +HeathrowState *pic;qemu_irq irqs[7 ];MacIONVRAMState nvram;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 07/30] spapr: register dummy ICPs later
In reply to David GibsonFrom: Greg Kurz <[email protected]>
Some older machine types create more ICPs than needed. We hence need to register up to xics_max_server_number() dummy ICPs to accomodate the migration of these machine types.
Recent VSMT rework changed xics_max_server_number() to return
DIV_ROUND_UP(max_cpus * spapr->vsmt, smp_threads)
instead of
DIV_ROUND_UP(max_cpus * kvmppc_smt_threads(), smp_threads);
The change is okay but it requires spapr->vsmt to be set, which isn't the case with the current code. This causes the formula to return zero and we don't create dummy ICPs. This breaks migration of older guests as reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=1549087
The dummy ICP workaround doesn't really have a dependency on XICS itself. But it does depend on proper VCPU id numbering and it must be applied before creating vCPUs (ie, creating real ICPs). So this patch moves the workaround to spapr_init_cpus(), which already assumes VSMT to be set.
--- hw/ppc/spapr.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
hw/ppc/spapr.c +12 -12
@@ -183,7 +183,6 @@ static int xics_max_server_number(sPAPRMachineState *spapr)static void xics_system_init (MachineState *machine,int nr_irqs,Error **errp) {sPAPRMachineState *spapr =SPAPR_MACHINE (machine); -sPAPRMachineClass *smc =SPAPR_MACHINE_GET_CLASS (machine);if (kvm_enabled ()) { if (machine_kernel_irqchip_allowed(machine) &&
@@ -205,17 +204,6 @@ static void xics_system_init(MachineState *machine, int nr_irqs, Error **errp)return ; } } - -if (smc->pre_2_10_has_unused_icps) { -int i; - -for (i =0 ; i <xics_max_server_number (spapr); i++) { -/* Dummy entries get deregistered when real ICPState objects -* are registered during CPU core hotplug. -*/ -pre_2_10_vmstate_register_dummy_icp (i); - } - } } static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,
@@ -2236,6 +2224,7 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) {MachineState *machine =MACHINE (spapr);MachineClass *mc =MACHINE_GET_CLASS (machine); +sPAPRMachineClass *smc =SPAPR_MACHINE_GET_CLASS (machine);const char *type =spapr_get_cpu_core_type (machine->cpu_type);const CPUArchIdList *possible_cpus;int boot_cores_nr = smp_cpus / smp_threads;
@@ -2261,6 +2250,17 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) boot_cores_nr = possible_cpus->len; } +if (smc->pre_2_10_has_unused_icps) { +int i; + +for (i =0 ; i <xics_max_server_number (spapr); i++) { +/* Dummy entries get deregistered when real ICPState objects +* are registered during CPU core hotplug. +*/ +pre_2_10_vmstate_register_dummy_icp (i); + } + } +for (i =0 ; i < possible_cpus->len; i++) {int core_id = i * smp_threads;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 09/30] macio: embed DBDMA device directly within macio
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
The current recommendation is to embed subdevices directly within their container device, so do this for the DBDMA device.
--- hw/misc/macio/macio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
hw/misc/macio/macio.c +7 -6
@@ -42,7 +42,7 @@ typedef struct MacIOStateMemoryRegion bar;CUDAState cuda; -DBDMAState *dbdma; +DBDMAState dbdma;MemoryRegion *pic_mem;MemoryRegion *escc_mem;uint64_t frequency;
@@ -129,12 +129,12 @@ static void macio_common_realize(PCIDevice *d, Error **errp)SysBusDevice *sysbus_dev;Error *err =NULL ; -object_property_set_bool (OBJECT (s->dbdma), true,"realized" , &err); +object_property_set_bool (OBJECT (&s->dbdma), true,"realized" , &err);if (err) {error_propagate (errp, err);return ; } - sysbus_dev =SYS_BUS_DEVICE (s->dbdma); + sysbus_dev =SYS_BUS_DEVICE (&s->dbdma);memory_region_add_subregion (&s->bar,0x08000 ,sysbus_mmio_get_region (sysbus_dev,0 ));
@@ -161,7 +161,7 @@ static void macio_realize_ide(MacIOState *s, MACIOIDEState *ide,sysbus_connect_irq (sysbus_dev,0 , irq0);sysbus_connect_irq (sysbus_dev,1 , irq1);qdev_prop_set_uint32 (DEVICE (ide),"channel" , dmaid); -object_property_set_link (OBJECT (ide),OBJECT (s->dbdma),"dbdma" , errp); +object_property_set_link (OBJECT (ide),OBJECT (&s->dbdma),"dbdma" , errp);macio_ide_register_dma (ide);object_property_set_bool (OBJECT (ide), true,"realized" , errp);
@@ -344,8 +344,9 @@ static void macio_instance_init(Object *obj)qdev_set_parent_bus (DEVICE (&s->cuda),sysbus_get_default ());object_property_add_child (obj,"cuda" ,OBJECT (&s->cuda),NULL ); - s->dbdma =MAC_DBDMA (object_new (TYPE_MAC_DBDMA )); -object_property_add_child (obj,"dbdma" ,OBJECT (s->dbdma),NULL ); +object_initialize (&s->dbdma,sizeof (s->dbdma),TYPE_MAC_DBDMA ); +qdev_set_parent_bus (DEVICE (&s->dbdma),sysbus_get_default ()); +object_property_add_child (obj,"dbdma" ,OBJECT (&s->dbdma),NULL ); }static const VMStateDescription vmstate_macio_oldworld = {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 04/30] roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
--- .gitmodules | 3 +++ roms/Makefile | 7 +++++++ roms/u-boot-sam460ex | 1 + 3 files changed, 11 insertions(+) create mode 160000 roms/u-boot-sam460ex
.gitmodules +3 -0
@@ -43,3 +43,6 @@ [submodule "roms/seabios-hppa"] path = roms/seabios-hppa url = git://github.com/hdeller/seabios-hppa.git +[submodule "roms/u-boot-sam460ex"] + path = roms/u-boot-sam460ex + url = git://github.com/zbalaton/u-boot-sam460ex
roms/Makefile +7 -0
@@ -65,6 +65,7 @@ default: @echo " slof -- update slof.bin" @echo " skiboot -- update skiboot.lid" @echo " u-boot.e500 -- update u-boot.e500" + @echo " u-boot.sam460 -- update u-boot.sam460" bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
@@ -147,6 +148,11 @@ u-boot.e500: $(powerpc_cross_prefix)strip u-boot/build.e500/u-boot -o \ ../pc-bios/u-boot.e500 +u-boot.sam460: + $(MAKE) -C u-boot-sam460ex Sam460ex_config + $(MAKE) -C u-boot-sam460ex CROSS_COMPILE=$(powerpc_cross_prefix) + cp u-boot-sam460ex/u-boot.bin ../pc-bios/u-boot-sam460-20100605.bin + skiboot: $(MAKE) -C skiboot CROSS=$(powerpc64_cross_prefix) cp skiboot/skiboot.lid ../pc-bios/skiboot.lid
@@ -160,4 +166,5 @@ clean: $(MAKE) -C ipxe/src veryclean $(MAKE) -C SLOF clean rm -rf u-boot/build.e500 + $(MAKE) -C u-boot-sam460ex distclean $(MAKE) -C skiboot clean
roms/u-boot-sam460ex new file +1 -0
@@ -0,0 +1 @@ +Subproject commit 119aa277f74a4a2d3f7ab6c9471292308eba14e4
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 18/30] mac_newworld: use object link to pass OpenPIC object to macio
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
Also switch macio_newworld_realize() over to use it rather than using the pic_mem memory region directly.
Now that both Old World and New World macio devices no longer make use of the pic_mem memory region directly, we can remove it.
--- hw/misc/macio/macio.c | 14 +++++++++----- hw/ppc/mac_newworld.c | 20 +++++++++++--------- include/hw/misc/macio/macio.h | 4 +++- 3 files changed, 23 insertions(+), 15 deletions(-)
hw/misc/macio/macio.c +9 -5
@@ -279,10 +279,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)sysbus_connect_irq (sysbus_dev,0 , ns->irqs[cur_irq++]);sysbus_connect_irq (sysbus_dev,1 , ns->irqs[cur_irq++]); -if (s->pic_mem) { -/* OpenPIC */ -memory_region_add_subregion (&s->bar,0x40000 , s->pic_mem); - } +/* OpenPIC */ + sysbus_dev =SYS_BUS_DEVICE (ns->pic); +memory_region_add_subregion (&s->bar,0x40000 , +sysbus_mmio_get_region (sysbus_dev,0 ));/* IDE buses */ for (i =0 ; i <ARRAY_SIZE (ns->ide); i++) {
@@ -311,6 +311,11 @@ static void macio_newworld_init(Object *obj)qdev_init_gpio_out (DEVICE (obj), ns->irqs,ARRAY_SIZE (ns->irqs)); +object_property_add_link (obj,"pic" ,TYPE_OPENPIC , + (Object **) &ns->pic, + qdev_prop_allow_set_link_before_realize, +0 ,NULL ); +for (i =0 ; i <2 ; i++) {macio_init_ide (s, &ns->ide[i],sizeof (ns->ide[i]), i); }
@@ -441,7 +446,6 @@ void macio_init(PCIDevice *d, {MacIOState *macio_state =MACIO (d); - macio_state->pic_mem = pic_mem;/* Note: this code is strongly inspirated from the corresponding code in PearPC */ qdev_prop_set_uint64(DEVICE(&macio_state->cuda), "timebase-frequency",
hw/ppc/mac_newworld.c +11 -9
@@ -154,7 +154,7 @@ static void ppc_core99_init(MachineState *machine)hwaddr kernel_base, initrd_base, cmdline_base =0 ;long kernel_size, initrd_size;PCIBus *pci_bus; -PCIDevice *macio; +NewWorldMacIOState *macio;MACIOIDEState *macio_ide;BusState *adb_bus;MacIONVRAMState *nvr;
@@ -166,7 +166,7 @@ static void ppc_core99_init(MachineState *machine)void *fw_cfg;int machine_arch;SysBusDevice *s; -DeviceState *dev; +DeviceState *dev, *pic_dev;int *token =g_new (int,1 );hwaddr nvram_addr =0xFFF04000 ;uint64_t tbfreq;
@@ -333,10 +333,10 @@ static void ppc_core99_init(MachineState *machine) pic =g_new0 (qemu_irq,64 ); - dev =qdev_create (NULL ,TYPE_OPENPIC ); -qdev_prop_set_uint32 (dev,"model" ,OPENPIC_MODEL_KEYLARGO ); -qdev_init_nofail (dev); - s =SYS_BUS_DEVICE (dev); + pic_dev =qdev_create (NULL ,TYPE_OPENPIC ); +qdev_prop_set_uint32 (pic_dev,"model" ,OPENPIC_MODEL_KEYLARGO ); +qdev_init_nofail (pic_dev); + s =SYS_BUS_DEVICE (pic_dev); pic_mem = s->mmio[0 ].memory; k =0 ;for (i =0 ; i < smp_cpus; i++) {
@@ -346,7 +346,7 @@ static void ppc_core99_init(MachineState *machine) }for (i =0 ; i <64 ; i++) { - pic[i] =qdev_get_gpio_in (dev, i); + pic[i] =qdev_get_gpio_in (pic_dev, i); }if (PPC_INPUT (env) ==PPC_FLAGS_INPUT_970 ) {
@@ -369,7 +369,7 @@ static void ppc_core99_init(MachineState *machine) }/* MacIO */ - macio =pci_create (pci_bus,-1 ,TYPE_NEWWORLD_MACIO ); + macio =NEWWORLD_MACIO (pci_create (pci_bus,-1 ,TYPE_NEWWORLD_MACIO )); dev =DEVICE (macio);qdev_connect_gpio_out (dev,0 , pic[0x19 ]);/* CUDA */ qdev_connect_gpio_out (dev,1 , pic[0x24 ]);/* ESCC-B */
@@ -379,7 +379,9 @@ static void ppc_core99_init(MachineState *machine)qdev_connect_gpio_out (dev,5 , pic[0x0e ]);/* IDE */ qdev_connect_gpio_out (dev,6 , pic[0x03 ]);/* IDE DMA */ qdev_prop_set_uint64 (dev,"frequency" , tbfreq); -macio_init (macio, pic_mem); +object_property_set_link (OBJECT (macio),OBJECT (pic_dev),"pic" , + &error_abort); +macio_init (PCI_DEVICE (macio), pic_mem);/* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get (hd,ARRAY_SIZE (hd));
include/hw/misc/macio/macio.h +3 -1
@@ -29,6 +29,7 @@#include "hw/intc/heathrow_pic.h" #include "hw/misc/macio/cuda.h" #include "hw/ppc/mac_dbdma.h" +#include "hw/ppc/openpic.h" #define TYPE_MACIO "macio"#define MACIO (obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO)
@@ -42,7 +43,6 @@ typedef struct MacIOState {CUDAState cuda;DBDMAState dbdma;ESCCState escc; -MemoryRegion *pic_mem;uint64_t frequency; } MacIOState;
@@ -70,6 +70,8 @@ typedef struct NewWorldMacIOState {/*< private >*/ MacIOState parent_obj;/*< public >*/ + +OpenPICState *pic;qemu_irq irqs[7 ];MACIOIDEState ide[2 ]; } NewWorldMacIOState;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 08/30] spapr: harden code that depends on VSMT
In reply to David GibsonFrom: Greg Kurz <[email protected]>
VSMT must be set in order to compute VCPU ids. This means that the following functions must not be called before spapr_set_vsmt_mode() was called:
- spapr_vcpu_id()
- spapr_is_thread0_in_vcore()
- xics_max_server_number()
We had a recent regression where the latter would be called before VSMT was set, and broke migration of some old machine types. This patch adds assert() in the above functions to avoid problems in the future.
Also, since VSMT is really a CPU related thing, spapr_set_vsmt_mode() is now called from spapr_init_cpus(), just before the first VSMT user.
--- hw/ppc/spapr.c | 144 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 75 insertions(+), 69 deletions(-)
hw/ppc/spapr.c +75 -69
@@ -105,12 +105,14 @@*/ static int spapr_vcpu_id (sPAPRMachineState *spapr,int cpu_index) { +assert (spapr->vsmt);return (cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads; }static bool spapr_is_thread0_in_vcore (sPAPRMachineState *spapr,PowerPCCPU *cpu) { +assert (spapr->vsmt);return spapr_get_vcpu_id (cpu) % spapr->vsmt ==0 ; }
@@ -177,6 +179,7 @@ static void pre_2_10_vmstate_unregister_dummy_icp(int i)static int xics_max_server_number (sPAPRMachineState *spapr) { +assert (spapr->vsmt);return DIV_ROUND_UP (max_cpus * spapr->vsmt, smp_threads); }
@@ -2220,73 +2223,6 @@ static CPUArchId *spapr_find_cpu_slot(MachineState *ms, uint32_t id, int *idx)return &ms->possible_cpus->cpus[index]; } -static void spapr_init_cpus (sPAPRMachineState *spapr) -{ -MachineState *machine =MACHINE (spapr); -MachineClass *mc =MACHINE_GET_CLASS (machine); -sPAPRMachineClass *smc =SPAPR_MACHINE_GET_CLASS (machine); -const char *type =spapr_get_cpu_core_type (machine->cpu_type); -const CPUArchIdList *possible_cpus; -int boot_cores_nr = smp_cpus / smp_threads; -int i; - - possible_cpus = mc->possible_cpu_arch_ids (machine); -if (mc->has_hotpluggable_cpus) { -if (smp_cpus % smp_threads) { -error_report ("smp_cpus (%u) must be multiple of threads (%u)" , - smp_cpus, smp_threads); -exit (1 ); - } -if (max_cpus % smp_threads) { -error_report ("max_cpus (%u) must be multiple of threads (%u)" , - max_cpus, smp_threads); -exit (1 ); - } - }else { -if (max_cpus != smp_cpus) { -error_report ("This machine version does not support CPU hotplug" ); -exit (1 ); - } - boot_cores_nr = possible_cpus->len; - } - -if (smc->pre_2_10_has_unused_icps) { -int i; - -for (i =0 ; i <xics_max_server_number (spapr); i++) { -/* Dummy entries get deregistered when real ICPState objects -* are registered during CPU core hotplug. -*/ -pre_2_10_vmstate_register_dummy_icp (i); - } - } - -for (i =0 ; i < possible_cpus->len; i++) { -int core_id = i * smp_threads; - -if (mc->has_hotpluggable_cpus) { -spapr_dr_connector_new (OBJECT (spapr),TYPE_SPAPR_DRC_CPU , -spapr_vcpu_id (spapr, core_id)); - } - -if (i < boot_cores_nr) { -Object *core =object_new (type); -int nr_threads = smp_threads; - -/* Handle the partially filled core for older machine types */ -if ((i +1 ) * smp_threads >= smp_cpus) { - nr_threads = smp_cpus - i * smp_threads; - } - -object_property_set_int (core, nr_threads,"nr-threads" , - &error_fatal); -object_property_set_int (core, core_id,CPU_CORE_PROP_CORE_ID , - &error_fatal); -object_property_set_bool (core, true,"realized" , &error_fatal); - } - } -} -static void spapr_set_vsmt_mode (sPAPRMachineState *spapr,Error **errp) {Error *local_err =NULL ;
@@ -2359,6 +2295,78 @@ out:error_propagate (errp, local_err); } +static void spapr_init_cpus (sPAPRMachineState *spapr) +{ +MachineState *machine =MACHINE (spapr); +MachineClass *mc =MACHINE_GET_CLASS (machine); +sPAPRMachineClass *smc =SPAPR_MACHINE_GET_CLASS (machine); +const char *type =spapr_get_cpu_core_type (machine->cpu_type); +const CPUArchIdList *possible_cpus; +int boot_cores_nr = smp_cpus / smp_threads; +int i; + + possible_cpus = mc->possible_cpu_arch_ids (machine); +if (mc->has_hotpluggable_cpus) { +if (smp_cpus % smp_threads) { +error_report ("smp_cpus (%u) must be multiple of threads (%u)" , + smp_cpus, smp_threads); +exit (1 ); + } +if (max_cpus % smp_threads) { +error_report ("max_cpus (%u) must be multiple of threads (%u)" , + max_cpus, smp_threads); +exit (1 ); + } + }else { +if (max_cpus != smp_cpus) { +error_report ("This machine version does not support CPU hotplug" ); +exit (1 ); + } + boot_cores_nr = possible_cpus->len; + } + +/* VSMT must be set in order to be able to compute VCPU ids, ie to +* call xics_max_server_number() or spapr_vcpu_id(). +*/ +spapr_set_vsmt_mode (spapr, &error_fatal); + +if (smc->pre_2_10_has_unused_icps) { +int i; + +for (i =0 ; i <xics_max_server_number (spapr); i++) { +/* Dummy entries get deregistered when real ICPState objects +* are registered during CPU core hotplug. +*/ +pre_2_10_vmstate_register_dummy_icp (i); + } + } + +for (i =0 ; i < possible_cpus->len; i++) { +int core_id = i * smp_threads; + +if (mc->has_hotpluggable_cpus) { +spapr_dr_connector_new (OBJECT (spapr),TYPE_SPAPR_DRC_CPU , +spapr_vcpu_id (spapr, core_id)); + } + +if (i < boot_cores_nr) { +Object *core =object_new (type); +int nr_threads = smp_threads; + +/* Handle the partially filled core for older machine types */ +if ((i +1 ) * smp_threads >= smp_cpus) { + nr_threads = smp_cpus - i * smp_threads; + } + +object_property_set_int (core, nr_threads,"nr-threads" , + &error_fatal); +object_property_set_int (core, core_id,CPU_CORE_PROP_CORE_ID , + &error_fatal); +object_property_set_bool (core, true,"realized" , &error_fatal); + } + } +} +/* pSeries LPAR / sPAPR hardware init */ static void spapr_machine_init (MachineState *machine) {
@@ -2486,8 +2494,6 @@ static void spapr_machine_init(MachineState *machine) }/* init CPUs */ -spapr_set_vsmt_mode (spapr, &error_fatal); -spapr_init_cpus (spapr);if (kvm_enabled ()) {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 10/30] macio: move ESCC device within the macio device
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
Now that the ESCC device is instantiated directly via qdev, move it to within the macio device and wire up the IRQs and memory regions using the sysbus API.
This enables to remove the now-obsolete escc_mem parameter to the macio_init() function.
(Note this patch also contains small touch-ups to the formatting in macio_escc_legacy_setup() and ppc_heathrow_init() in order to keep checkpatch happy)
--- hw/misc/macio/macio.c | 60 ++++++++++++++++++++++++++++++++++++--------------- hw/ppc/mac.h | 3 +-- hw/ppc/mac_newworld.c | 37 ++++++++----------------------- hw/ppc/mac_oldworld.c | 38 +++++++++----------------------- 4 files changed, 63 insertions(+), 75 deletions(-)
hw/misc/macio/macio.c +43 -17
@@ -43,8 +43,8 @@ typedef struct MacIOStateMemoryRegion bar;CUDAState cuda;DBDMAState dbdma; +ESCCState escc;MemoryRegion *pic_mem; -MemoryRegion *escc_mem;uint64_t frequency; } MacIOState;
@@ -56,7 +56,7 @@ typedef struct OldWorldMacIOState {MacIOState parent_obj;/*< public >*/ -qemu_irq irqs[5 ]; +qemu_irq irqs[7 ];MacIONVRAMState nvram;MACIOIDEState ide[2 ];
@@ -69,7 +69,7 @@ typedef struct NewWorldMacIOState {/*< private >*/ MacIOState parent_obj;/*< public >*/ -qemu_irq irqs[5 ]; +qemu_irq irqs[7 ];MACIOIDEState ide[2 ]; } NewWorldMacIOState;
@@ -84,10 +84,12 @@ typedef struct NewWorldMacIOState {* * Reference: ftp://ftp.software.ibm.com/rs6000/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf */ -static void macio_escc_legacy_setup (MacIOState *macio_state) +static void macio_escc_legacy_setup (MacIOState *s) { +ESCCState *escc =ESCC (&s->escc); +SysBusDevice *sbd =SYS_BUS_DEVICE (escc);MemoryRegion *escc_legacy =g_new (MemoryRegion,1 ); -MemoryRegion *bar = &macio_state->bar; +MemoryRegion *bar = &s->bar;int i;static const int maps[] = {0x00 ,0x00 ,/* Command B */
@@ -102,25 +104,26 @@ static void macio_escc_legacy_setup(MacIOState *macio_state)0xb0 ,0xb0 ,/* Detect AB */ }; -memory_region_init (escc_legacy,OBJECT (macio_state),"escc-legacy" ,256 ); +memory_region_init (escc_legacy,OBJECT (s),"escc-legacy" ,256 );for (i =0 ; i <ARRAY_SIZE (maps); i +=2 ) {MemoryRegion *port =g_new (MemoryRegion,1 ); -memory_region_init_alias (port,OBJECT (macio_state),"escc-legacy-port" , - macio_state->escc_mem, maps[i+1 ],0x2 ); +memory_region_init_alias (port,OBJECT (s),"escc-legacy-port" , +sysbus_mmio_get_region (sbd,0 ), + maps[i +1 ],0x2 );memory_region_add_subregion (escc_legacy, maps[i], port); }memory_region_add_subregion (bar,0x12000 , escc_legacy); } -static void macio_bar_setup (MacIOState *macio_state) +static void macio_bar_setup (MacIOState *s) { -MemoryRegion *bar = &macio_state->bar; +ESCCState *escc =ESCC (&s->escc); +SysBusDevice *sbd =SYS_BUS_DEVICE (escc); +MemoryRegion *bar = &s->bar; -if (macio_state->escc_mem) { -memory_region_add_subregion (bar,0x13000 , macio_state->escc_mem); -macio_escc_legacy_setup (macio_state); - } +memory_region_add_subregion (bar,0x13000 ,sysbus_mmio_get_region (sbd,0 )); +macio_escc_legacy_setup (s); }static void macio_common_realize (PCIDevice *d,Error **errp)
@@ -147,6 +150,12 @@ static void macio_common_realize(PCIDevice *d, Error **errp)memory_region_add_subregion (&s->bar,0x16000 ,sysbus_mmio_get_region (sysbus_dev,0 )); +object_property_set_bool (OBJECT (&s->escc), true,"realized" , &err); +if (err) { +error_propagate (errp, err); +return ; + } +macio_bar_setup (s);pci_register_bar (d,0 ,PCI_BASE_ADDRESS_SPACE_MEMORY , &s->bar); }
@@ -185,6 +194,10 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp) sysbus_dev =SYS_BUS_DEVICE (&s->cuda);sysbus_connect_irq (sysbus_dev,0 , os->irqs[cur_irq++]); + sysbus_dev =SYS_BUS_DEVICE (&s->escc); +sysbus_connect_irq (sysbus_dev,0 , os->irqs[cur_irq++]); +sysbus_connect_irq (sysbus_dev,1 , os->irqs[cur_irq++]); +object_property_set_bool (OBJECT (&os->nvram), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -297,6 +310,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp) sysbus_dev =SYS_BUS_DEVICE (&s->cuda);sysbus_connect_irq (sysbus_dev,0 , ns->irqs[cur_irq++]); + sysbus_dev =SYS_BUS_DEVICE (&s->escc); +sysbus_connect_irq (sysbus_dev,0 , ns->irqs[cur_irq++]); +sysbus_connect_irq (sysbus_dev,1 , ns->irqs[cur_irq++]); +if (s->pic_mem) {/* OpenPIC */ memory_region_add_subregion (&s->bar,0x40000 , s->pic_mem);
@@ -347,6 +364,17 @@ static void macio_instance_init(Object *obj)object_initialize (&s->dbdma,sizeof (s->dbdma),TYPE_MAC_DBDMA );qdev_set_parent_bus (DEVICE (&s->dbdma),sysbus_get_default ());object_property_add_child (obj,"dbdma" ,OBJECT (&s->dbdma),NULL ); + +object_initialize (&s->escc,sizeof (s->escc),TYPE_ESCC ); +qdev_prop_set_uint32 (DEVICE (&s->escc),"disabled" ,0 ); +qdev_prop_set_uint32 (DEVICE (&s->escc),"frequency" ,ESCC_CLOCK ); +qdev_prop_set_uint32 (DEVICE (&s->escc),"it_shift" ,4 ); +qdev_prop_set_chr (DEVICE (&s->escc),"chrA" , serial_hds[0 ]); +qdev_prop_set_chr (DEVICE (&s->escc),"chrB" , serial_hds[1 ]); +qdev_prop_set_uint32 (DEVICE (&s->escc),"chnBtype" , escc_serial); +qdev_prop_set_uint32 (DEVICE (&s->escc),"chnAtype" , escc_serial); +qdev_set_parent_bus (DEVICE (&s->escc),sysbus_get_default ()); +object_property_add_child (obj,"escc" ,OBJECT (&s->escc),NULL ); }static const VMStateDescription vmstate_macio_oldworld = {
@@ -444,13 +472,11 @@ static void macio_register_types(void)type_init (macio_register_types) void macio_init(PCIDevice *d, -MemoryRegion *pic_mem, -MemoryRegion *escc_mem) +MemoryRegion *pic_mem) {MacIOState *macio_state =MACIO (d); macio_state->pic_mem = pic_mem; - macio_state->escc_mem = escc_mem;/* Note: this code is strongly inspirated from the corresponding code in PearPC */ qdev_prop_set_uint64(DEVICE(&macio_state->cuda), "timebase-frequency",
hw/ppc/mac.h +1 -2
@@ -76,8 +76,7 @@ void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);void macio_ide_register_dma (MACIOIDEState *ide);void macio_init (PCIDevice *dev, -MemoryRegion *pic_mem, -MemoryRegion *escc_mem); +MemoryRegion *pic_mem);/* Heathrow PIC */ qemu_irq *heathrow_pic_init(MemoryRegion **pmem,
hw/ppc/mac_newworld.c +9 -28
@@ -159,8 +159,7 @@ static void ppc_core99_init(MachineState *machine)MacIONVRAMState *nvr;int bios_size, ndrv_size;uint8_t *ndrv_file; -MemoryRegion *pic_mem, *escc_mem; -MemoryRegion *escc_bar =g_new (MemoryRegion,1 ); +MemoryRegion *pic_mem;int ppc_boot_device;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];void *fw_cfg;
@@ -368,36 +367,18 @@ static void ppc_core99_init(MachineState *machine) tbfreq =TBFREQ ; } -/* init basic PC hardware */ - - dev =qdev_create (NULL ,TYPE_ESCC ); -qdev_prop_set_uint32 (dev,"disabled" ,0 ); -qdev_prop_set_uint32 (dev,"frequency" ,ESCC_CLOCK ); -qdev_prop_set_uint32 (dev,"it_shift" ,4 ); -qdev_prop_set_chr (dev,"chrA" , serial_hds[0 ]); -qdev_prop_set_chr (dev,"chrB" , serial_hds[1 ]); -qdev_prop_set_uint32 (dev,"chnAtype" , escc_serial); -qdev_prop_set_uint32 (dev,"chnBtype" , escc_serial); -qdev_init_nofail (dev); - - s =SYS_BUS_DEVICE (dev); -sysbus_connect_irq (s,0 , pic[0x24 ]); -sysbus_connect_irq (s,1 , pic[0x25 ]); - - escc_mem = &ESCC (s)->mmio; - -memory_region_init_alias (escc_bar,NULL ,"escc-bar" , - escc_mem,0 ,memory_region_size (escc_mem)); - +/* MacIO */ macio =pci_create (pci_bus,-1 ,TYPE_NEWWORLD_MACIO ); dev =DEVICE (macio);qdev_connect_gpio_out (dev,0 , pic[0x19 ]);/* CUDA */ -qdev_connect_gpio_out (dev,1 , pic[0x0d ]);/* IDE */ -qdev_connect_gpio_out (dev,2 , pic[0x02 ]);/* IDE DMA */ -qdev_connect_gpio_out (dev,3 , pic[0x0e ]);/* IDE */ -qdev_connect_gpio_out (dev,4 , pic[0x03 ]);/* IDE DMA */ +qdev_connect_gpio_out (dev,1 , pic[0x24 ]);/* ESCC-B */ +qdev_connect_gpio_out (dev,2 , pic[0x25 ]);/* ESCC-A */ +qdev_connect_gpio_out (dev,3 , pic[0x0d ]);/* IDE */ +qdev_connect_gpio_out (dev,4 , pic[0x02 ]);/* IDE DMA */ +qdev_connect_gpio_out (dev,5 , pic[0x0e ]);/* IDE */ +qdev_connect_gpio_out (dev,6 , pic[0x03 ]);/* IDE DMA */ qdev_prop_set_uint64 (dev,"frequency" , tbfreq); -macio_init (macio, pic_mem, escc_bar); +macio_init (macio, pic_mem);/* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get (hd,ARRAY_SIZE (hd));
hw/ppc/mac_oldworld.c +10 -28
@@ -99,12 +99,10 @@ static void ppc_heathrow_init(MachineState *machine)int bios_size, ndrv_size;uint8_t *ndrv_file;MemoryRegion *pic_mem; -MemoryRegion *escc_mem, *escc_bar =g_new (MemoryRegion,1 );uint16_t ppc_boot_device;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];void *fw_cfg;uint64_t tbfreq; -SysBusDevice *s; linux_boot = (kernel_filename !=NULL );
@@ -265,40 +263,24 @@ static void ppc_heathrow_init(MachineState *machine) get_system_io());pci_vga_init (pci_bus); - dev =qdev_create (NULL ,TYPE_ESCC ); -qdev_prop_set_uint32 (dev,"disabled" ,0 ); -qdev_prop_set_uint32 (dev,"frequency" ,ESCC_CLOCK ); -qdev_prop_set_uint32 (dev,"it_shift" ,4 ); -qdev_prop_set_chr (dev,"chrA" , serial_hds[0 ]); -qdev_prop_set_chr (dev,"chrB" , serial_hds[1 ]); -qdev_prop_set_uint32 (dev,"chnBtype" , escc_serial); -qdev_prop_set_uint32 (dev,"chnAtype" , escc_serial); -qdev_init_nofail (dev); - - s =SYS_BUS_DEVICE (dev); -sysbus_connect_irq (s,0 , pic[0x10 ]); -sysbus_connect_irq (s,1 , pic[0x0f ]); - - escc_mem = &ESCC (s)->mmio; - -memory_region_init_alias (escc_bar,NULL ,"escc-bar" , - escc_mem,0 ,memory_region_size (escc_mem)); - -for (i =0 ; i < nb_nics; i++) +for (i =0 ; i < nb_nics; i++) {pci_nic_init_nofail (&nd_table[i], pci_bus,"ne2k_pci" ,NULL ); - + }ide_drive_get (hd,ARRAY_SIZE (hd)); +/* MacIO */ macio =pci_create (pci_bus,-1 ,TYPE_OLDWORLD_MACIO ); dev =DEVICE (macio);qdev_connect_gpio_out (dev,0 , pic[0x12 ]);/* CUDA */ -qdev_connect_gpio_out (dev,1 , pic[0x0D ]);/* IDE-0 */ -qdev_connect_gpio_out (dev,2 , pic[0x02 ]);/* IDE-0 DMA */ -qdev_connect_gpio_out (dev,3 , pic[0x0E ]);/* IDE-1 */ -qdev_connect_gpio_out (dev,4 , pic[0x03 ]);/* IDE-1 DMA */ +qdev_connect_gpio_out (dev,1 , pic[0x10 ]);/* ESCC-B */ +qdev_connect_gpio_out (dev,2 , pic[0x0F ]);/* ESCC-A */ +qdev_connect_gpio_out (dev,3 , pic[0x0D ]);/* IDE-0 */ +qdev_connect_gpio_out (dev,4 , pic[0x02 ]);/* IDE-0 DMA */ +qdev_connect_gpio_out (dev,5 , pic[0x0E ]);/* IDE-1 */ +qdev_connect_gpio_out (dev,6 , pic[0x03 ]);/* IDE-1 DMA */ qdev_prop_set_uint64 (dev,"frequency" , tbfreq); -macio_init (macio, pic_mem, escc_bar); +macio_init (macio, pic_mem); macio_ide =MACIO_IDE (object_resolve_path_component (OBJECT (macio),"ide[0]" ));
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 12/30] heathrow: convert to trace-events
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
--- hw/intc/heathrow_pic.c | 32 +++++++++++--------------------- hw/intc/trace-events | 5 +++++ 2 files changed, 16 insertions(+), 21 deletions(-)
hw/intc/heathrow_pic.c +11 -21
@@ -26,16 +26,7 @@#include "hw/hw.h" #include "hw/ppc/mac.h" #include "hw/intc/heathrow_pic.h" - -/* debug PIC */ -//#define DEBUG_PIC - -#ifdef DEBUG_PIC -#define PIC_DPRINTF (fmt, ...) \ - do { printf("PIC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define PIC_DPRINTF (fmt, ...) -#endif +#include "trace.h" static inline int heathrow_check_irq (HeathrowPICState *pic) {
@@ -61,7 +52,7 @@ static void heathrow_write(void *opaque, hwaddr addr,unsigned int n; n = ((addr &0xfff ) -0x10 ) >>4 ; -PIC_DPRINTF ("writel: " TARGET_FMT_plx" %u: %08x\n" , addr, n, value); +trace_heathrow_write (addr, n, value);if (n >=2 )return ; pic = &s->pics[n];
@@ -109,7 +100,7 @@ static uint64_t heathrow_read(void *opaque, hwaddr addr,break ; } } -PIC_DPRINTF ("readl: " TARGET_FMT_plx" %u: %08x\n" , addr, n, value); +trace_heathrow_read (addr, n, value);return value; }
@@ -124,24 +115,23 @@ static void heathrow_set_irq(void *opaque, int num, int level)HeathrowState *s = opaque;HeathrowPICState *pic;unsigned int irq_bit; +int last_level; -#if defined(DEBUG ) - { -static int last_level[64 ]; -if (last_level[num] != level) { -PIC_DPRINTF ("set_irq: num=0x%02x level=%d\n" , num, level); - last_level[num] = level; - } - } -#endif pic = &s->pics[1 - (num >>5 )]; irq_bit =1 << (num &0x1f ); + last_level = (pic->levels & irq_bit) ?1 :0 ; +if (level) { pic->events |= irq_bit & ~pic->level_triggered; pic->levels |= irq_bit; }else { pic->levels &= ~irq_bit; } + +if (last_level != level) { +trace_heathrow_set_irq (num, level); + } +heathrow_update_irq (s); }
hw/intc/trace-events +5 -0
@@ -186,3 +186,8 @@ nvic_complete_irq(int irq, bool secure) "NVIC complete IRQ %d (secure %d)" nvic_set_irq_level(int irq, int level) "NVIC external irq %d level set to %d" nvic_sysreg_read(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" + +# hw/intc/heathrow_pic.c +heathrow_write(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64 +heathrow_read(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" %u: 0x%"PRIx64 +heathrow_set_irq(int num, int level) "set_irq: num=0x%02x level=%d"
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 26/30] ppc/spapr-caps: Define the pseries-2.12-sxxm machine type
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
The sxxm (speculative execution exploit mitigation) machine type is a variant of the 2.12 machine type with workarounds for speculative execution vulnerabilities enabled by default.
--- hw/ppc/spapr.c | 17 +++++++++++++++++ hw/ppc/spapr_caps.c | 11 +++++++++++ 2 files changed, 28 insertions(+)
hw/ppc/spapr.c +17 -0
@@ -3983,6 +3983,23 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) DEFINE_SPAPR_MACHINE(2_12, "2.12", true); +static void spapr_machine_2_12_sxxm_instance_options (MachineState *machine) +{ +spapr_machine_2_12_instance_options (machine); +} + +static void spapr_machine_2_12_sxxm_class_options (MachineClass *mc) +{ +sPAPRMachineClass *smc =SPAPR_MACHINE_CLASS (mc); + +spapr_machine_2_12_class_options (mc); + smc->default_caps.caps[SPAPR_CAP_CFPC ] =SPAPR_CAP_WORKAROUND ; + smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_WORKAROUND ; + smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_FIXED_CCD ; +} + +DEFINE_SPAPR_MACHINE(2_12_sxxm, "2.12-sxxm", false); +/* * pseries-2.11 */
hw/ppc/spapr_caps.c +11 -0
@@ -335,15 +335,26 @@ static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, caps = smc->default_caps; +if (!ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_3_00 , +0 , spapr->max_compat_pvr)) { + caps.caps[SPAPR_CAP_CFPC ] =SPAPR_CAP_BROKEN ; + } +if (!ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_2_07 ,0 , spapr->max_compat_pvr)) { caps.caps[SPAPR_CAP_HTM ] =SPAPR_CAP_OFF ; } +if (!ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_2_06_PLUS , +0 , spapr->max_compat_pvr)) { + caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_BROKEN ; + } +if (!ppc_check_compat (cpu,CPU_POWERPC_LOGICAL_2_06 ,0 , spapr->max_compat_pvr)) { caps.caps[SPAPR_CAP_VSX ] =SPAPR_CAP_OFF ; caps.caps[SPAPR_CAP_DFP ] =SPAPR_CAP_OFF ; + caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_BROKEN ; }return caps;
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 16/30] openpic: move KVM-specific declarations into separate openpic_kvm.h file
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
This is needed before the next patch because the target-dependent kvm stub uses the existing kvm_openpic_connect_vcpu() declaration, making it impossible to move the device-specific declarations into the same file without breaking ppc-linux-user compilation.
--- hw/intc/openpic_kvm.c | 1 + hw/ppc/e500.c | 1 + include/hw/ppc/openpic.h | 3 --- include/hw/ppc/openpic_kvm.h | 7 +++++++ target/ppc/kvm-stub.c | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 include/hw/ppc/openpic_kvm.h
hw/intc/openpic_kvm.c +1 -0
@@ -30,6 +30,7 @@#include "exec/address-spaces.h" #include "hw/hw.h" #include "hw/ppc/openpic.h" +#include "hw/ppc/openpic_kvm.h" #include "hw/pci/msi.h" #include "hw/sysbus.h" #include "sysemu/kvm.h"
hw/ppc/e500.c +1 -0
@@ -29,6 +29,7 @@#include "kvm_ppc.h" #include "sysemu/device_tree.h" #include "hw/ppc/openpic.h" +#include "hw/ppc/openpic_kvm.h" #include "hw/ppc/ppc.h" #include "hw/loader.h" #include "elf.h"
include/hw/ppc/openpic.h +0 -3
@@ -28,7 +28,4 @@ enum {#define OPENPIC_MAX_IRQ (OPENPIC_MAX_SRC + OPENPIC_MAX_IPI + \ OPENPIC_MAX_TMR) -#define TYPE_KVM_OPENPIC "kvm-openpic" -int kvm_openpic_connect_vcpu (DeviceState *d,CPUState *cs); -#endif /* OPENPIC_H */
include/hw/ppc/openpic_kvm.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef OPENPIC_KVM_H +#define OPENPIC_KVM_H + +#define TYPE_KVM_OPENPIC "kvm-openpic" +int kvm_openpic_connect_vcpu (DeviceState *d,CPUState *cs); + +#endif /* OPENPIC_KVM_H */
target/ppc/kvm-stub.c +1 -1
@@ -12,7 +12,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "cpu.h" -#include "hw/ppc/openpic.h" +#include "hw/ppc/openpic_kvm.h" int kvm_openpic_connect_vcpu (DeviceState *d,CPUState *cs) {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 13/30] heathrow: change heathrow_pic_init() to return the heathrow device
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
This enables the device to be made available during the setup of the Old World machine. In order to pass back the previous set of IRQs we temporarily introduce a new pic_irqs parameter until it can be removed.
An additional benefit of this change is that it is also possible to remove the pic_mem pointer used for macio by accessing the memory region via sysbus.
--- hw/intc/heathrow_pic.c | 10 ++++++---- hw/ppc/mac.h | 4 ++-- hw/ppc/mac_oldworld.c | 9 +++++---- 3 files changed, 13 insertions(+), 10 deletions(-)
hw/intc/heathrow_pic.c +6 -4
@@ -170,13 +170,15 @@ static void heathrow_reset(DeviceState *d)static void heathrow_init (Object *obj) {HeathrowState *s =HEATHROW (obj); +SysBusDevice *sbd =SYS_BUS_DEVICE (obj);memory_region_init_io (&s->mem,OBJECT (s), &heathrow_ops, s,"heathrow-pic" ,0x1000 ); +sysbus_init_mmio (sbd, &s->mem); } -qemu_irq *heathrow_pic_init (MemoryRegion **pmem, -int nb_cpus,qemu_irq **irqs) +DeviceState *heathrow_pic_init (int nb_cpus,qemu_irq **irqs, +qemu_irq **pic_irqs) {DeviceState *d;HeathrowState *s;
@@ -188,9 +190,9 @@ qemu_irq *heathrow_pic_init(MemoryRegion **pmem,/* only 1 CPU */ s->irqs = irqs[0 ]; - *pmem = &s->mem; + *pic_irqs =qemu_allocate_irqs (heathrow_set_irq, s,HEATHROW_NUM_IRQS ); -return qemu_allocate_irqs (heathrow_set_irq, s,HEATHROW_NUM_IRQS ); +return d; }static void heathrow_class_init (ObjectClass *oc,void *data)
hw/ppc/mac.h +2 -2
@@ -79,8 +79,8 @@ void macio_init(PCIDevice *dev, MemoryRegion *pic_mem);/* Heathrow PIC */ -qemu_irq *heathrow_pic_init (MemoryRegion **pmem, -int nb_cpus,qemu_irq **irqs); +DeviceState *heathrow_pic_init (int nb_cpus,qemu_irq **irqs, +qemu_irq **pic_irqs);/* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
hw/ppc/mac_oldworld.c +5 -4
@@ -94,11 +94,11 @@ static void ppc_heathrow_init(MachineState *machine)PCIBus *pci_bus;PCIDevice *macio;MACIOIDEState *macio_ide; -DeviceState *dev; +DeviceState *dev, *pic_dev; +SysBusDevice *sbd;BusState *adb_bus;int bios_size, ndrv_size;uint8_t *ndrv_file; -MemoryRegion *pic_mem;uint16_t ppc_boot_device;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];void *fw_cfg;
@@ -257,7 +257,7 @@ static void ppc_heathrow_init(MachineState *machine)error_report ("Only 6xx bus is supported on heathrow machine" );exit (1 ); } - pic =heathrow_pic_init (&pic_mem,1 , heathrow_irqs); + pic_dev =heathrow_pic_init (1 , heathrow_irqs, &pic); pci_bus =pci_grackle_init (0xfec00000 , pic,get_system_memory (),get_system_io ());
@@ -280,7 +280,8 @@ static void ppc_heathrow_init(MachineState *machine)qdev_connect_gpio_out (dev,5 , pic[0x0E ]);/* IDE-1 */ qdev_connect_gpio_out (dev,6 , pic[0x03 ]);/* IDE-1 DMA */ qdev_prop_set_uint64 (dev,"frequency" , tbfreq); -macio_init (macio, pic_mem); + sbd =SYS_BUS_DEVICE (pic_dev); +macio_init (macio,sysbus_mmio_get_region (sbd,0 )); macio_ide =MACIO_IDE (object_resolve_path_component (OBJECT (macio),"ide[0]" ));
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 20/30] macio: remove macio_init() function
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
Move the remaining comment into macio.c for reference, then remove the macio_init() function and instantiate the macio devices for both Old World and New World machines via qdev_init_nofail() directly.
--- hw/misc/macio/macio.c | 11 +++-------- hw/ppc/mac_newworld.c | 4 +--- hw/ppc/mac_oldworld.c | 4 +--- 3 files changed, 5 insertions(+), 14 deletions(-)
hw/misc/macio/macio.c +3 -8
@@ -33,6 +33,9 @@#include "hw/misc/macio/macio.h" #include "hw/intc/heathrow_pic.h" +/* Note: this code is strongly inspirated from the corresponding code +* in PearPC */ +/* * The mac-io has two interfaces to the ESCC. One is called "escc-legacy", * while the other one is the normal, current ESCC interface.
@@ -442,11 +445,3 @@ static void macio_register_types(void) }type_init (macio_register_types) - -void macio_init(PCIDevice *d, -MemoryRegion *pic_mem) -{ -/* Note: this code is strongly inspirated from the corresponding code -in PearPC */ -qdev_init_nofail (DEVICE (d)); -}
hw/ppc/mac_newworld.c +1 -3
@@ -160,7 +160,6 @@ static void ppc_core99_init(MachineState *machine)MacIONVRAMState *nvr;int bios_size, ndrv_size;uint8_t *ndrv_file; -MemoryRegion *pic_mem;int ppc_boot_device;DriveInfo *hd[MAX_IDE_BUS *MAX_IDE_DEVS ];void *fw_cfg;
@@ -337,7 +336,6 @@ static void ppc_core99_init(MachineState *machine)qdev_prop_set_uint32 (pic_dev,"model" ,OPENPIC_MODEL_KEYLARGO );qdev_init_nofail (pic_dev); s =SYS_BUS_DEVICE (pic_dev); - pic_mem = s->mmio[0 ].memory; k =0 ;for (i =0 ; i < smp_cpus; i++) {for (j =0 ; j <OPENPIC_OUTPUT_NB ; j++) {
@@ -381,7 +379,7 @@ static void ppc_core99_init(MachineState *machine)qdev_prop_set_uint64 (dev,"frequency" , tbfreq);object_property_set_link (OBJECT (macio),OBJECT (pic_dev),"pic" , &error_abort); -macio_init (PCI_DEVICE (macio), pic_mem); +qdev_init_nofail (dev);/* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get (hd,ARRAY_SIZE (hd));
hw/ppc/mac_oldworld.c +1 -3
@@ -96,7 +96,6 @@ static void ppc_heathrow_init(MachineState *machine)OldWorldMacIOState *macio;MACIOIDEState *macio_ide;DeviceState *dev, *pic_dev; -SysBusDevice *sbd;BusState *adb_bus;int bios_size, ndrv_size;uint8_t *ndrv_file;
@@ -283,8 +282,7 @@ static void ppc_heathrow_init(MachineState *machine)qdev_prop_set_uint64 (dev,"frequency" , tbfreq);object_property_set_link (OBJECT (macio),OBJECT (pic_dev),"pic" , &error_abort); - sbd =SYS_BUS_DEVICE (pic_dev); -macio_init (PCI_DEVICE (macio),sysbus_mmio_get_region (sbd,0 )); +qdev_init_nofail (dev); macio_ide =MACIO_IDE (object_resolve_path_component (OBJECT (macio),"ide[0]" ));
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 19/30] macio: move setting of CUDA timebase frequency to macio_common_realize()
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
This removes the last of the functionality from macio_init() in preparation for its subsequent removal.
--- hw/misc/macio/macio.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/misc/macio/macio.c +2 -5
@@ -101,6 +101,8 @@ static void macio_common_realize(PCIDevice *d, Error **errp)memory_region_add_subregion (&s->bar,0x08000 ,sysbus_mmio_get_region (sysbus_dev,0 )); +qdev_prop_set_uint64 (DEVICE (&s->cuda),"timebase-frequency" , + s->frequency);object_property_set_bool (OBJECT (&s->cuda), true,"realized" , &err);if (err) {error_propagate (errp, err);
@@ -444,12 +446,7 @@ type_init(macio_register_types)void macio_init (PCIDevice *d,MemoryRegion *pic_mem) { -MacIOState *macio_state =MACIO (d); -/* Note: this code is strongly inspirated from the corresponding code in PearPC */ -qdev_prop_set_uint64 (DEVICE (&macio_state->cuda),"timebase-frequency" , - macio_state->frequency); -qdev_init_nofail (DEVICE (d)); }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 21/30] target/ppc: Check mask when setting cap_ppc_safe_indirect_branch
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
Check the character and character_mask field when setting cap_ppc_safe_indirect_branch based on the hypervisor response to KVM_PPC_GET_CPU_CHAR. Previously the mask field wasn't checked which was incorrect.
--- target/ppc/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/kvm.c +1 -1
@@ -2494,7 +2494,7 @@ static void kvmppc_get_cpu_characteristics(KVMState *s) cap_ppc_safe_bounds_check =1 ; }/* Parse and set cap_ppc_safe_indirect_branch */ -if (c.character &H_CPU_CHAR_BCCTRL_SERIALISED ) { +if (c.character & c.character_mask &H_CPU_CHAR_BCCTRL_SERIALISED ) { cap_ppc_safe_indirect_branch =2 ; } }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 24/30] ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
Convert cap-sbbc (speculation barrier bounds checking) to a custom spapr-cap type.
--- hw/ppc/spapr_caps.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
hw/ppc/spapr_caps.c +18 -5
@@ -271,14 +271,26 @@ static void cap_safe_cache_apply(sPAPRMachineState *spapr, uint8_t val, } } +sPAPRCapPossible cap_sbbc_possible = { + .num =3 , + .vals = {"broken" ,"workaround" ,"fixed" }, + .help ="broken - no protection, workaround - workaround available," +" fixed - fixed in hardware" , +}; +static void cap_safe_bounds_check_apply (sPAPRMachineState *spapr,uint8_t val,Error **errp) { +uint8_t kvm_val =kvmppc_get_cap_safe_bounds_check (); +if (tcg_enabled () && val) {/* TODO - for now only allow broken for TCG */ -error_setg (errp,"Requested safe bounds check capability level not supported by tcg, try a different value for cap-sbbc" ); - }else if (kvm_enabled () && (val >kvmppc_get_cap_safe_bounds_check ())) { -error_setg (errp,"Requested safe bounds check capability level not supported by kvm, try a different value for cap-sbbc" ); +error_setg (errp, +"Requested safe bounds check capability level not supported by tcg, try a different value for cap-sbbc" ); + }else if (kvm_enabled () && (val > kvm_val)) { +error_setg (errp, +"Requested safe bounds check capability level not supported by kvm, try cap-sbbc=%s" , + cap_sbbc_possible.vals[kvm_val]); } }
@@ -339,9 +351,10 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .name = "sbbc", .description = "Speculation Barrier Bounds Checking" VALUE_DESC_TRISTATE, .index = SPAPR_CAP_SBBC, - .get = spapr_cap_get_tristate, - .set = spapr_cap_set_tristate, + .get = spapr_cap_get_string, + .set = spapr_cap_set_string, .type = "string", + .possible = &cap_sbbc_possible, .apply = cap_safe_bounds_check_apply, }, [SPAPR_CAP_IBS] = {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 27/30] hw/ppc/spapr, e500: Use new property "stdout-path" for boot console
In reply to David GibsonFrom: Nikunj A Dadhania <[email protected]>
Linux kernel commit 2a9d832cc9aae21ea827520fef635b6c49a06c6d (of: Add bindings for chosen node, stdout-path) deprecated chosen property "linux,stdout-path" and "stdout".
Introduce the new property "stdout-path" and continue supporting the older property to remain compatible with existing/older firmware. This older property can be deprecated after 5 years.
--- hw/ppc/e500.c | 7 +++++++ hw/ppc/spapr.c | 7 +++++++ 2 files changed, 14 insertions(+)
hw/ppc/e500.c +7 -0
@@ -120,7 +120,14 @@ static void dt_serial_create(void *fdt, unsigned long long offset,qemu_fdt_setprop_string (fdt,"/aliases" , alias, ser);if (defcon) { +/* +* "linux,stdout-path" and "stdout" properties are deprecated by linux +* kernel. New platforms should only use the "stdout-path" property. Set +* the new property and continue using older property to remain +* compatible with the existing firmware. +*/ qemu_fdt_setprop_string (fdt,"/chosen" ,"linux,stdout-path" , ser); +qemu_fdt_setprop_string (fdt,"/chosen" ,"stdout-path" , ser); } }
hw/ppc/spapr.c +7 -0
@@ -1053,7 +1053,14 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt) }if (!spapr->has_graphics && stdout_path) { +/* +* "linux,stdout-path" and "stdout" properties are deprecated by linux +* kernel. New platforms should only use the "stdout-path" property. Set +* the new property and continue using older property to remain +* compatible with the existing firmware. +*/ _FDT (fdt_setprop_string (fdt, chosen,"linux,stdout-path" , stdout_path)); +_FDT (fdt_setprop_string (fdt, chosen,"stdout-path" , stdout_path)); }spapr_dt_ov5_platform_support (fdt, chosen);
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 30/30] PowerPC: Add TS bits into msr_mask
In reply to David GibsonFrom: Simon Guo <[email protected]>
During migration, after MSR bits is synced, cpu_post_load() will use msr_mask to determine which PPC MSR bits will be applied into the target side. Hardware Transaction Memory(HTM) has been supported since Power8, but TS0/TS1 bit was not in msr_mask yet. That will prevent target KVM from loading TM checkpointed values.
This patch adds TS bits into msr_mask for Power8, so that transactional application can be migrated across qemu.
--- target/ppc/translate_init.c | 2 ++ 1 file changed, 2 insertions(+)
target/ppc/translate_init.c +2 -0
@@ -8692,6 +8692,8 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data) (1ull <<MSR_DR ) | (1ull <<MSR_PMM ) | (1ull <<MSR_RI ) | + (1ull <<MSR_TS0 ) | + (1ull <<MSR_TS1 ) | (1ull <<MSR_LE ); pcc->mmu_model =POWERPC_MMU_2_07 ;#if defined(CONFIG_SOFTMMU )
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 11/30] heathrow: QOMify heathrow PIC
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
--- hw/intc/heathrow_pic.c | 126 +++++++++++++++++++++++------------------ include/hw/intc/heathrow_pic.h | 49 ++++++++++++++++ 2 files changed, 119 insertions(+), 56 deletions(-) create mode 100644 include/hw/intc/heathrow_pic.h
hw/intc/heathrow_pic.c +70 -56
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "hw/hw.h" #include "hw/ppc/mac.h" +#include "hw/intc/heathrow_pic.h" /* debug PIC */ //#define DEBUG_PIC
@@ -36,39 +37,27 @@#define PIC_DPRINTF (fmt, ...)#endif -typedef struct HeathrowPIC { -uint32_t events; -uint32_t mask; -uint32_t levels; -uint32_t level_triggered; -}HeathrowPIC ; - -typedef struct HeathrowPICS { -MemoryRegion mem; -HeathrowPIC pics[2 ]; -qemu_irq *irqs; -}HeathrowPICS ; - -static inline int check_irq (HeathrowPIC *pic) +static inline int heathrow_check_irq (HeathrowPICState *pic) {return (pic->events | (pic->levels & pic->level_triggered)) & pic->mask; }/* update the CPU irq state */ -static void heathrow_pic_update (HeathrowPICS *s) +static void heathrow_update_irq (HeathrowState *s) { -if (check_irq (&s->pics[0 ]) ||check_irq (&s->pics[1 ])) { +if (heathrow_check_irq (&s->pics[0 ]) || +heathrow_check_irq (&s->pics[1 ])) {qemu_irq_raise (s->irqs[0 ]); }else {qemu_irq_lower (s->irqs[0 ]); } } -static void pic_write (void *opaque,hwaddr addr, -uint64_t value,unsigned size) +static void heathrow_write (void *opaque,hwaddr addr, +uint64_t value,unsigned size) { -HeathrowPICS *s = opaque; -HeathrowPIC *pic; +HeathrowState *s = opaque; +HeathrowPICState *pic;unsigned int n; n = ((addr &0xfff ) -0x10 ) >>4 ;
@@ -79,24 +68,24 @@ static void pic_write(void *opaque, hwaddr addr,switch (addr &0xf ) {case 0x04 : pic->mask = value; -heathrow_pic_update (s); +heathrow_update_irq (s);break ;case 0x08 :/* do not reset level triggered IRQs */ value &= ~pic->level_triggered; pic->events &= ~value; -heathrow_pic_update (s); +heathrow_update_irq (s);break ;default :break ; } } -static uint64_t pic_read (void *opaque,hwaddr addr, -unsigned size) +static uint64_t heathrow_read (void *opaque,hwaddr addr, +unsigned size) { -HeathrowPICS *s = opaque; -HeathrowPIC *pic; +HeathrowState *s = opaque; +HeathrowPICState *pic;unsigned int n;uint32_t value;
@@ -124,16 +113,16 @@ static uint64_t pic_read(void *opaque, hwaddr addr,return value; } -static const MemoryRegionOps heathrow_pic_ops = { - .read = pic_read, - .write = pic_write, +static const MemoryRegionOps heathrow_ops = { + .read = heathrow_read, + .write = heathrow_write, .endianness =DEVICE_LITTLE_ENDIAN , }; -static void heathrow_pic_set_irq (void *opaque,int num,int level) +static void heathrow_set_irq (void *opaque,int num,int level) { -HeathrowPICS *s = opaque; -HeathrowPIC *pic; +HeathrowState *s = opaque; +HeathrowPICState *pic;unsigned int irq_bit;#if defined(DEBUG )
@@ -153,7 +142,7 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level) }else { pic->levels &= ~irq_bit; } -heathrow_pic_update (s); +heathrow_update_irq (s); }static const VMStateDescription vmstate_heathrow_pic_one = {
@@ -161,54 +150,79 @@ static const VMStateDescription vmstate_heathrow_pic_one = { .version_id = 0, .minimum_version_id = 0, .fields = (VMStateField []) { -VMSTATE_UINT32 (events, HeathrowPIC), -VMSTATE_UINT32 (mask, HeathrowPIC), -VMSTATE_UINT32 (levels, HeathrowPIC), -VMSTATE_UINT32 (level_triggered, HeathrowPIC), +VMSTATE_UINT32 (events, HeathrowPICState), +VMSTATE_UINT32 (mask, HeathrowPICState), +VMSTATE_UINT32 (levels, HeathrowPICState), +VMSTATE_UINT32 (level_triggered, HeathrowPICState),VMSTATE_END_OF_LIST () } }; -static const VMStateDescription vmstate_heathrow_pic = { +static const VMStateDescription vmstate_heathrow = { .name ="heathrow_pic" , .version_id =1 , .minimum_version_id =1 , .fields = (VMStateField []) { -VMSTATE_STRUCT_ARRAY (pics, HeathrowPICS,2 ,1 , - vmstate_heathrow_pic_one, HeathrowPIC), +VMSTATE_STRUCT_ARRAY (pics, HeathrowState,2 ,1 , + vmstate_heathrow_pic_one, HeathrowPICState),VMSTATE_END_OF_LIST () } }; -static void heathrow_pic_reset_one (HeathrowPIC *s) +static void heathrow_reset (DeviceState *d) { -memset (s,'\0' ,sizeof (HeathrowPIC)); +HeathrowState *s =HEATHROW (d); + + s->pics[0 ].level_triggered =0 ; + s->pics[1 ].level_triggered =0x1ff00000 ; } -static void heathrow_pic_reset (void *opaque) +static void heathrow_init (Object *obj) { -HeathrowPICS *s = opaque; - -heathrow_pic_reset_one (&s->pics[0 ]); -heathrow_pic_reset_one (&s->pics[1 ]); +HeathrowState *s =HEATHROW (obj); - s->pics[0 ].level_triggered =0 ; - s->pics[1 ].level_triggered =0x1ff00000 ; +memory_region_init_io (&s->mem,OBJECT (s), &heathrow_ops, s, +"heathrow-pic" ,0x1000 ); }qemu_irq *heathrow_pic_init (MemoryRegion **pmem,int nb_cpus,qemu_irq **irqs) { -HeathrowPICS *s; +DeviceState *d; +HeathrowState *s; - s =g_malloc0 (sizeof (HeathrowPICS)); + d =qdev_create (NULL ,TYPE_HEATHROW ); +qdev_init_nofail (d); + + s =HEATHROW (d);/* only 1 CPU */ s->irqs = irqs[0 ]; -memory_region_init_io (&s->mem,NULL , &heathrow_pic_ops, s, -"heathrow-pic" ,0x1000 ); + *pmem = &s->mem; -vmstate_register (NULL ,-1 , &vmstate_heathrow_pic, s); -qemu_register_reset (heathrow_pic_reset, s); -return qemu_allocate_irqs (heathrow_pic_set_irq, s,64 ); +return qemu_allocate_irqs (heathrow_set_irq, s,HEATHROW_NUM_IRQS ); +} + +static void heathrow_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); + + dc->reset = heathrow_reset; + dc->vmsd = &vmstate_heathrow; +set_bit (DEVICE_CATEGORY_MISC , dc->categories); } + +static const TypeInfo heathrow_type_info = { + .name =TYPE_HEATHROW , + .parent =TYPE_SYS_BUS_DEVICE , + .instance_size =sizeof (HeathrowState), + .instance_init = heathrow_init, + .class_init = heathrow_class_init, +}; + +static void heathrow_register_types (void ) +{ +type_register_static (&heathrow_type_info); +} + +type_init (heathrow_register_types)
include/hw/intc/heathrow_pic.h new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 14/30] macio: move macio related structures and defines into separate macio.h file
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
--- hw/misc/macio/macio.c | 43 +------------------------ hw/ppc/mac.h | 3 -- hw/ppc/mac_newworld.c | 1 + hw/ppc/mac_oldworld.c | 1 + include/hw/misc/macio/macio.h | 75 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 45 deletions(-) create mode 100644 include/hw/misc/macio/macio.h
hw/misc/macio/macio.c +1 -42
@@ -30,48 +30,7 @@#include "hw/pci/pci.h" #include "hw/ppc/mac_dbdma.h" #include "hw/char/escc.h" - -#define TYPE_MACIO "macio" -#define MACIO (obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO) - -typedef struct MacIOState -{ -/*< private >*/ -PCIDevice parent; -/*< public >*/ - -MemoryRegion bar; -CUDAState cuda; -DBDMAState dbdma; -ESCCState escc; -MemoryRegion *pic_mem; -uint64_t frequency; -}MacIOState ; - -#define OLDWORLD_MACIO (obj) \ - OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO) - -typedef struct OldWorldMacIOState { -/*< private >*/ -MacIOState parent_obj; -/*< public >*/ - -qemu_irq irqs[7 ]; - -MacIONVRAMState nvram; -MACIOIDEState ide[2 ]; -}OldWorldMacIOState ; - -#define NEWWORLD_MACIO (obj) \ - OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO) - -typedef struct NewWorldMacIOState { -/*< private >*/ -MacIOState parent_obj; -/*< public >*/ -qemu_irq irqs[7 ]; -MACIOIDEState ide[2 ]; -}NewWorldMacIOState ; +#include "hw/misc/macio/macio.h" /* * The mac-io has two interfaces to the ESCC. One is called "escc-legacy",
hw/ppc/mac.h +0 -3
@@ -47,9 +47,6 @@/* MacIO */ -#define TYPE_OLDWORLD_MACIO "macio-oldworld" -#define TYPE_NEWWORLD_MACIO "macio-newworld" -#define TYPE_MACIO_IDE "macio-ide"#define MACIO_IDE (obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE)
hw/ppc/mac_newworld.c +1 -0
@@ -60,6 +60,7 @@#include "hw/boards.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" +#include "hw/misc/macio/macio.h" #include "hw/ppc/openpic.h" #include "hw/ide.h" #include "hw/loader.h"
hw/ppc/mac_oldworld.c +1 -0
@@ -37,6 +37,7 @@#include "hw/boards.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" +#include "hw/misc/macio/macio.h" #include "hw/ide.h" #include "hw/loader.h" #include "elf.h"
include/hw/misc/macio/macio.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 22/30] ppc/spapr-caps: Add support for custom spapr_capabilities
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
There are currently 2 implemented types of spapr-caps, boolean and tristate. However there may be a need for caps which don't fit either of these options. Add a custom capability type for which a list of custom valid strings can be specified and implement the get/set functions for these. Also add a field for help text to describe the available options.
--- hw/ppc/spapr_caps.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+)
hw/ppc/spapr_caps.c +70 -0
@@ -32,6 +32,20 @@#include "hw/ppc/spapr.h" +typedef struct sPAPRCapPossible { +int num;/* size of vals array below */ +const char *help;/* help text for vals */ +/* +* Note: +* - because of the way compatibility is determined vals MUST be ordered +* such that later options are a superset of all preceding options. +* - the order of vals must be preserved, that is their index is important, +* however vals may be added to the end of the list so long as the above +* point is observed +*/ +const char *vals[]; +}sPAPRCapPossible ; + typedef struct sPAPRCapabilityInfo { const char *name; const char *description;
@@ -41,6 +55,8 @@ typedef struct sPAPRCapabilityInfo {ObjectPropertyAccessor *get;ObjectPropertyAccessor *set;const char *type; +/* Possible values if this is a custom string type */ +sPAPRCapPossible *possible;/* Make sure the virtual hardware can support this capability */ void (*apply)(sPAPRMachineState *spapr,uint8_t val,Error **errp); } sPAPRCapabilityInfo;
@@ -133,6 +149,60 @@ out:g_free (val); } +static void ATTRIBUTE_UNUSED spapr_cap_get_string(Object *obj, Visitor *v, +const char *name, +void *opaque,Error **errp) +{ +sPAPRCapabilityInfo *cap = opaque; +sPAPRMachineState *spapr =SPAPR_MACHINE (obj); +char *val =NULL ; +uint8_t value =spapr_get_cap (spapr, cap->index); + +if (value >= cap->possible->num) { +error_setg (errp,"Invalid value (%d) for cap-%s" , value, cap->name); +return ; + } + + val =g_strdup (cap->possible->vals[value]); + +visit_type_str (v, name, &val, errp); +g_free (val); +} + +static void ATTRIBUTE_UNUSED spapr_cap_set_string(Object *obj, Visitor *v, +const char *name, +void *opaque,Error **errp) +{ +sPAPRCapabilityInfo *cap = opaque; +sPAPRMachineState *spapr =SPAPR_MACHINE (obj); +Error *local_err =NULL ; +uint8_t i; +char *val; + +visit_type_str (v, name, &val, &local_err); +if (local_err) { +error_propagate (errp, local_err); +return ; + } + +if (!strcmp (val,"?" )) { +error_setg (errp,"%s" , cap->possible->help); + goto out; + } +for (i =0 ; i < cap->possible->num; i++) { +if (!strcasecmp (val, cap->possible->vals[i])) { + spapr->cmd_line_caps[cap->index] = true; + spapr->eff.caps[cap->index] = i; + goto out; + } + } + +error_setg (errp,"Invalid capability mode \"%s\" for cap-%s" , val, + cap->name); +out: +g_free (val); +} +static void cap_htm_apply (sPAPRMachineState *spapr,uint8_t val,Error **errp) {if (!val) {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 23/30] ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
Convert cap-cfpc (cache flush on privilege change) to a custom spapr-cap type.
--- hw/ppc/spapr_caps.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
hw/ppc/spapr_caps.c +22 -11
@@ -149,9 +149,8 @@ out:g_free (val); } -static void ATTRIBUTE_UNUSED spapr_cap_get_string(Object *obj, Visitor *v, -const char *name, -void *opaque,Error **errp) +static void spapr_cap_get_string (Object *obj,Visitor *v,const char *name, +void *opaque,Error **errp) {sPAPRCapabilityInfo *cap = opaque;sPAPRMachineState *spapr =SPAPR_MACHINE (obj);
@@ -169,9 +168,8 @@ static void ATTRIBUTE_UNUSED spapr_cap_get_string(Object *obj, Visitor *v,g_free (val); } -static void ATTRIBUTE_UNUSED spapr_cap_set_string(Object *obj, Visitor *v, -const char *name, -void *opaque,Error **errp) +static void spapr_cap_set_string (Object *obj,Visitor *v,const char *name, +void *opaque,Error **errp) {sPAPRCapabilityInfo *cap = opaque;sPAPRMachineState *spapr =SPAPR_MACHINE (obj);
@@ -250,14 +248,26 @@ static void cap_dfp_apply(sPAPRMachineState *spapr, uint8_t val, Error **errp) } } +sPAPRCapPossible cap_cfpc_possible = { + .num =3 , + .vals = {"broken" ,"workaround" ,"fixed" }, + .help ="broken - no protection, workaround - workaround available," +" fixed - fixed in hardware" , +}; +static void cap_safe_cache_apply (sPAPRMachineState *spapr,uint8_t val,Error **errp) { +uint8_t kvm_val =kvmppc_get_cap_safe_cache (); +if (tcg_enabled () && val) {/* TODO - for now only allow broken for TCG */ -error_setg (errp,"Requested safe cache capability level not supported by tcg, try a different value for cap-cfpc" ); - }else if (kvm_enabled () && (val >kvmppc_get_cap_safe_cache ())) { -error_setg (errp,"Requested safe cache capability level not supported by kvm, try a different value for cap-cfpc" ); +error_setg (errp, +"Requested safe cache capability level not supported by tcg, try a different value for cap-cfpc" ); + }else if (kvm_enabled () && (val > kvm_val)) { +error_setg (errp, +"Requested safe cache capability level not supported by kvm, try cap-cfpc=%s" , + cap_cfpc_possible.vals[kvm_val]); } }
@@ -319,9 +329,10 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .name = "cfpc", .description = "Cache Flush on Privilege Change" VALUE_DESC_TRISTATE, .index = SPAPR_CAP_CFPC, - .get = spapr_cap_get_tristate, - .set = spapr_cap_set_tristate, + .get = spapr_cap_get_string, + .set = spapr_cap_set_string, .type = "string", + .possible = &cap_cfpc_possible, .apply = cap_safe_cache_apply, }, [SPAPR_CAP_SBBC] = {
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 25/30] ppc/spapr-caps: Convert cap-ibs to custom spapr-cap
In reply to David GibsonFrom: Suraj Jitindar Singh <[email protected]>
Convert cap-ibs (indirect branch speculation) to a custom spapr-cap type.
All tristate caps have now been converted to custom spapr-caps, so remove the remaining support for them.
--- hw/ppc/spapr_caps.c | 90 ++++++++++++++------------------------------------ hw/ppc/spapr_hcall.c | 5 ++- include/hw/ppc/spapr.h | 5 ++- target/ppc/kvm.c | 6 ++-- 4 files changed, 36 insertions(+), 70 deletions(-)
hw/ppc/spapr_caps.c +24 -66
@@ -89,65 +89,6 @@ static void spapr_cap_set_bool(Object *obj, Visitor *v, const char *name, spapr->eff.caps[cap->index] = value ?SPAPR_CAP_ON :SPAPR_CAP_OFF ; } -static void spapr_cap_get_tristate (Object *obj,Visitor *v,const char *name, -void *opaque,Error **errp) -{ -sPAPRCapabilityInfo *cap = opaque; -sPAPRMachineState *spapr =SPAPR_MACHINE (obj); -char *val =NULL ; -uint8_t value =spapr_get_cap (spapr, cap->index); - -switch (value) { -case SPAPR_CAP_BROKEN : - val =g_strdup ("broken" ); -break ; -case SPAPR_CAP_WORKAROUND : - val =g_strdup ("workaround" ); -break ; -case SPAPR_CAP_FIXED : - val =g_strdup ("fixed" ); -break ; -default : -error_setg (errp,"Invalid value (%d) for cap-%s" , value, cap->name); -return ; - } - -visit_type_str (v, name, &val, errp); -g_free (val); -} - -static void spapr_cap_set_tristate (Object *obj,Visitor *v,const char *name, -void *opaque,Error **errp) -{ -sPAPRCapabilityInfo *cap = opaque; -sPAPRMachineState *spapr =SPAPR_MACHINE (obj); -char *val; -Error *local_err =NULL ; -uint8_t value; - -visit_type_str (v, name, &val, &local_err); -if (local_err) { -error_propagate (errp, local_err); -return ; - } - -if (!strcasecmp (val,"broken" )) { - value =SPAPR_CAP_BROKEN ; - }else if (!strcasecmp (val,"workaround" )) { - value =SPAPR_CAP_WORKAROUND ; - }else if (!strcasecmp (val,"fixed" )) { - value =SPAPR_CAP_FIXED ; - }else { -error_setg (errp,"Invalid capability mode \"%s\" for cap-%s" , val, - cap->name); - goto out; - } - - spapr->cmd_line_caps[cap->index] = true; - spapr->eff.caps[cap->index] = value; -out: -g_free (val); -}static void spapr_cap_get_string (Object *obj,Visitor *v,const char *name,void *opaque,Error **errp)
@@ -294,16 +235,31 @@ static void cap_safe_bounds_check_apply(sPAPRMachineState *spapr, uint8_t val, } } +sPAPRCapPossible cap_ibs_possible = { + .num =4 , +/* Note workaround only maintained for compatibility */ + .vals = {"broken" ,"workaround" ,"fixed-ibs" ,"fixed-ccd" }, + .help ="broken - no protection, fixed-ibs - indirect branch serialisation," +" fixed-ccd - cache count disabled" , +}; +static void cap_safe_indirect_branch_apply (sPAPRMachineState *spapr,uint8_t val,Error **errp) { +uint8_t kvm_val =kvmppc_get_cap_safe_indirect_branch (); +if (val ==SPAPR_CAP_WORKAROUND ) {/* Can only be Broken or Fixed */ -error_setg (errp,"Requested safe indirect branch capability level \"workaround\" not valid, try cap-ibs=fixed" ); +error_setg (errp, +"Requested safe indirect branch capability level \"workaround\" not valid, try cap-ibs=%s" , + cap_ibs_possible.vals[kvm_val]); }else if (tcg_enabled () && val) {/* TODO - for now only allow broken for TCG */ -error_setg (errp,"Requested safe indirect branch capability level not supported by tcg, try a different value for cap-ibs" ); - }else if (kvm_enabled () && (val >kvmppc_get_cap_safe_indirect_branch ())) { -error_setg (errp,"Requested safe indirect branch capability level not supported by kvm, try a different value for cap-ibs" ); +error_setg (errp, +"Requested safe indirect branch capability level not supported by tcg, try a different value for cap-ibs" ); + }else if (kvm_enabled () && val && (val != kvm_val)) { +error_setg (errp, +"Requested safe indirect branch capability level not supported by kvm, try cap-ibs=%s" , + cap_ibs_possible.vals[kvm_val]); } }
@@ -359,11 +315,13 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { }, [SPAPR_CAP_IBS ] = { .name ="ibs" , - .description ="Indirect Branch Serialisation (broken, fixed)" , + .description = +"Indirect Branch Speculation (broken, fixed-ibs, fixed-ccd)" , .index =SPAPR_CAP_IBS , - .get = spapr_cap_get_tristate, - .set = spapr_cap_set_tristate, + .get = spapr_cap_get_string, + .set = spapr_cap_set_string, .type ="string" , + .possible = &cap_ibs_possible, .apply = cap_safe_indirect_branch_apply, }, };
hw/ppc/spapr_hcall.c +4 -1
@@ -1705,7 +1705,10 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu, }switch (safe_indirect_branch) { -case SPAPR_CAP_FIXED : +case SPAPR_CAP_FIXED_CCD : + characteristics |=H_CPU_CHAR_CACHE_COUNT_DIS ; +break ; +case SPAPR_CAP_FIXED_IBS : characteristics |=H_CPU_CHAR_BCCTRL_SERIALISED ;break ;default :/* broken */
include/hw/ppc/spapr.h +4 -1
@@ -75,10 +75,12 @@ typedef enum {/* Bool Caps */ #define SPAPR_CAP_OFF 0x00#define SPAPR_CAP_ON 0x01 -/* Broken | Workaround | Fixed Caps */ +/* Custom Caps */ #define SPAPR_CAP_BROKEN 0x00#define SPAPR_CAP_WORKAROUND 0x01#define SPAPR_CAP_FIXED 0x02 +#define SPAPR_CAP_FIXED_IBS 0x02 +#define SPAPR_CAP_FIXED_CCD 0x03typedef struct sPAPRCapabilities sPAPRCapabilities ;struct sPAPRCapabilities {
@@ -313,6 +315,7 @@ struct sPAPRMachineState {#define H_CPU_CHAR_L1D_THREAD_PRIV PPC_BIT(4)#define H_CPU_CHAR_HON_BRANCH_HINTS PPC_BIT(5)#define H_CPU_CHAR_THR_RECONF_TRIG PPC_BIT(6) +#define H_CPU_CHAR_CACHE_COUNT_DIS PPC_BIT(7)#define H_CPU_BEHAV_FAVOUR_SECURITY PPC_BIT(0)#define H_CPU_BEHAV_L1D_FLUSH_PR PPC_BIT(1)#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR PPC_BIT(2)
target/ppc/kvm.c +4 -2
@@ -2494,8 +2494,10 @@ static void kvmppc_get_cpu_characteristics(KVMState *s) cap_ppc_safe_bounds_check =1 ; }/* Parse and set cap_ppc_safe_indirect_branch */ -if (c.character & c.character_mask &H_CPU_CHAR_BCCTRL_SERIALISED ) { - cap_ppc_safe_indirect_branch =2 ; +if (c.character & c.character_mask &H_CPU_CHAR_CACHE_COUNT_DIS ) { + cap_ppc_safe_indirect_branch =SPAPR_CAP_FIXED_CCD ; + }else if (c.character & c.character_mask &H_CPU_CHAR_BCCTRL_SERIALISED ) { + cap_ppc_safe_indirect_branch =SPAPR_CAP_FIXED_IBS ; } }
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 17/30] openpic: move OpenPIC state and related definitions to openpic.h
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
This is to faciliate access to OpenPICState when wiring up the PIC to the macio controller.
--- hw/intc/openpic.c | 157 ---------------------------------------------- include/hw/ppc/openpic.h | 159 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 158 insertions(+), 158 deletions(-)
hw/intc/openpic.c +0 -157
@@ -63,10 +63,6 @@ static int get_current_cpu(void); } \ }while (0 ) -#define MAX_CPU 32 -#define MAX_MSI 8 -#define VID 0x03/* MPIC version ID */ - /* OpenPIC capability flags */#define OPENPIC_FLAG_IDR_CRIT (1 << 0)#define OPENPIC_FLAG_ILR (2 << 0)
@@ -85,35 +81,6 @@ static int get_current_cpu(void);#define OPENPIC_CPU_REG_START 0x20000#define OPENPIC_CPU_REG_SIZE 0x100 + ((MAX_CPU - 1) * 0x1000) -/* Raven */ -#define RAVEN_MAX_CPU 2 -#define RAVEN_MAX_EXT 48 -#define RAVEN_MAX_IRQ 64 -#define RAVEN_MAX_TMR OPENPIC_MAX_TMR -#define RAVEN_MAX_IPI OPENPIC_MAX_IPI - -/* KeyLargo */ -#define KEYLARGO_MAX_CPU 4 -#define KEYLARGO_MAX_EXT 64 -#define KEYLARGO_MAX_IPI 4 -#define KEYLARGO_MAX_IRQ (64 + KEYLARGO_MAX_IPI) -#define KEYLARGO_MAX_TMR 0 -#define KEYLARGO_IPI_IRQ (KEYLARGO_MAX_EXT)/* First IPI IRQ */ -/* Timers don't exist but this makes the code happy... */ -#define KEYLARGO_TMR_IRQ (KEYLARGO_IPI_IRQ + KEYLARGO_MAX_IPI) - -/* Interrupt definitions */ -#define RAVEN_FE_IRQ (RAVEN_MAX_EXT)/* Internal functional IRQ */ -#define RAVEN_ERR_IRQ (RAVEN_MAX_EXT + 1)/* Error IRQ */ -#define RAVEN_TMR_IRQ (RAVEN_MAX_EXT + 2)/* First timer IRQ */ -#define RAVEN_IPI_IRQ (RAVEN_TMR_IRQ + RAVEN_MAX_TMR)/* First IPI IRQ */ -/* First doorbell IRQ */ -#define RAVEN_DBL_IRQ (RAVEN_IPI_IRQ + (RAVEN_MAX_CPU * RAVEN_MAX_IPI)) - -typedef struct FslMpicInfo { -int max_ext; -}FslMpicInfo ; -static FslMpicInfo fsl_mpic_20 = { .max_ext =12 , };
@@ -211,55 +178,6 @@ static void openpic_cpu_write_internal(void *opaque, hwaddr addr, uint32_t val, int idx);static void openpic_reset (DeviceState *d); -typedef enum IRQType { -IRQ_TYPE_NORMAL =0 , -IRQ_TYPE_FSLINT ,/* FSL internal interrupt -- level only */ -IRQ_TYPE_FSLSPECIAL ,/* FSL timer/IPI interrupt, edge, no polarity */ -}IRQType ; - -/* Round up to the nearest 64 IRQs so that the queue length -* won't change when moving between 32 and 64 bit hosts. -*/ -#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63) - -typedef struct IRQQueue { -unsigned long *queue; -int32_t queue_size;/* Only used for VMSTATE_BITMAP */ -int next; -int priority; -}IRQQueue ; - -typedef struct IRQSource { -uint32_t ivpr;/* IRQ vector/priority register */ -uint32_t idr;/* IRQ destination register */ -uint32_t destmask;/* bitmap of CPU destinations */ -int last_cpu; -int output;/* IRQ level, e.g. OPENPIC_OUTPUT_INT */ -int pending;/* TRUE if IRQ is pending */ -IRQType type; -bool level:1 ;/* level-triggered */ -bool nomask:1 ;/* critical interrupts ignore mask on some FSL MPICs */ -}IRQSource ; - -#define IVPR_MASK_SHIFT 31 -#define IVPR_MASK_MASK (1U << IVPR_MASK_SHIFT) -#define IVPR_ACTIVITY_SHIFT 30 -#define IVPR_ACTIVITY_MASK (1U << IVPR_ACTIVITY_SHIFT) -#define IVPR_MODE_SHIFT 29 -#define IVPR_MODE_MASK (1U << IVPR_MODE_SHIFT) -#define IVPR_POLARITY_SHIFT 23 -#define IVPR_POLARITY_MASK (1U << IVPR_POLARITY_SHIFT) -#define IVPR_SENSE_SHIFT 22 -#define IVPR_SENSE_MASK (1U << IVPR_SENSE_SHIFT) - -#define IVPR_PRIORITY_MASK (0xFU << 16) -#define IVPR_PRIORITY (_ivprr_) ((int)(((_ivprr_) & IVPR_PRIORITY_MASK) >> 16)) -#define IVPR_VECTOR (opp, _ivprr_) ((_ivprr_) & (opp)->vector_mask) - -/* IDR[EP/CI] are only for FSL MPIC prior to v4.0 */ -#define IDR_EP 0x80000000/* external pin */ -#define IDR_CI 0x40000000/* critical interrupt */ -/* Convert between openpic clock ticks and nanosecs. In the hardware the clock frequency is driven by board inputs to the PIC which the PIC would then divide by 4 or 8. For now hard code to 25MZ.
@@ -275,81 +193,6 @@ static inline uint64_t ticks_to_ns(uint64_t ticks)return ticks *OPENPIC_TIMER_NS_PER_TICK ; } -typedef struct OpenPICTimer { -uint32_t tccr;/* Global timer current count register */ -uint32_t tbcr;/* Global timer base count register */ -int n_IRQ; -bool qemu_timer_active;/* Is the qemu_timer is running? */ -struct QEMUTimer *qemu_timer; -struct OpenPICState *opp;/* Device timer is part of. */ -/* The QEMU_CLOCK_VIRTUAL time (in ns) corresponding to the last -current_count written or read, only defined if qemu_timer_active. */ -uint64_t origin_time; -}OpenPICTimer ; - -typedef struct OpenPICMSI { -uint32_t msir;/* Shared Message Signaled Interrupt Register */ -}OpenPICMSI ; - -typedef struct IRQDest { -int32_t ctpr;/* CPU current task priority */ -IRQQueue raised; -IRQQueue servicing; -qemu_irq *irqs; - -/* Count of IRQ sources asserting on non-INT outputs */ -uint32_t outputs_active[OPENPIC_OUTPUT_NB ]; -}IRQDest ; - -#define OPENPIC (obj) OBJECT_CHECK(OpenPICState, (obj), TYPE_OPENPIC) - -typedef struct OpenPICState { -/*< private >*/ -SysBusDevice parent_obj; -/*< public >*/ - -MemoryRegion mem; - -/* Behavior control */ -FslMpicInfo *fsl; -uint32_t model; -uint32_t flags; -uint32_t nb_irqs; -uint32_t vid; -uint32_t vir;/* Vendor identification register */ -uint32_t vector_mask; -uint32_t tfrr_reset; -uint32_t ivpr_reset; -uint32_t idr_reset; -uint32_t brr1; -uint32_t mpic_mode_mask; - -/* Sub-regions */ -MemoryRegion sub_io_mem[6 ]; - -/* Global registers */ -uint32_t frr;/* Feature reporting register */ -uint32_t gcr;/* Global configuration register */ -uint32_t pir;/* Processor initialization register */ -uint32_t spve;/* Spurious vector register */ -uint32_t tfrr;/* Timer frequency reporting register */ -/* Source registers */ -IRQSource src[OPENPIC_MAX_IRQ ]; -/* Local registers per output pin */ -IRQDest dst[MAX_CPU ]; -uint32_t nb_cpus; -/* Timer registers */ -OpenPICTimer timers[OPENPIC_MAX_TMR ]; -uint32_t max_tmr; - -/* Shared MSI registers */ -OpenPICMSI msi[MAX_MSI ]; -uint32_t max_irq; -uint32_t irq_ipi0; -uint32_t irq_tim0; -uint32_t irq_msi; -}OpenPICState ; -static inline void IRQ_setbit (IRQQueue *q,int n_IRQ) {set_bit (n_IRQ, q->queue);
include/hw/ppc/openpic.h +158 -1
172 lines not on this page · raw message
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 29/30] adb: add trace-events for monitoring keyboard/mouse during bus enumeration
In reply to David GibsonFrom: Mark Cave-Ayland <[email protected]>
This is useful to help diagnose problems related to address clashes during MacOS 9 boot.
--- hw/input/adb-kbd.c | 4 ++++ hw/input/adb-mouse.c | 5 +++++ hw/input/trace-events | 5 +++++ 3 files changed, 14 insertions(+)
hw/input/adb-kbd.c +4 -0
@@ -258,6 +258,7 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,case ADB_CMD_CHANGE_ID_AND_ACT :case ADB_CMD_CHANGE_ID_AND_ENABLE : d->devaddr = buf[1 ] &0xf ; +trace_adb_kbd_request_change_addr (d->devaddr);break ;default : d->devaddr = buf[1 ] &0xf ;
@@ -269,6 +270,9 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,if (buf[2 ] ==1 || buf[2 ] ==2 || buf[2 ] ==3 ) { d->handler = buf[2 ]; } + +trace_adb_kbd_request_change_addr_and_handler (d->devaddr, + d->handler);break ; } }
hw/input/adb-mouse.c +5 -0
@@ -118,6 +118,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf, s->dx =0 ; s->dy =0 ; s->dz =0 ; +trace_adb_mouse_flush ();return 0 ; }
@@ -138,6 +139,7 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,case ADB_CMD_CHANGE_ID_AND_ACT :case ADB_CMD_CHANGE_ID_AND_ENABLE : d->devaddr = buf[1 ] &0xf ; +trace_adb_mouse_request_change_addr (d->devaddr);break ;default : d->devaddr = buf[1 ] &0xf ;
@@ -155,6 +157,9 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *obuf,if (buf[2 ] ==1 || buf[2 ] ==2 ) { d->handler = buf[2 ]; } + +trace_adb_mouse_request_change_addr_and_handler (d->devaddr, + d->handler);break ; } }
hw/input/trace-events +5 -0
@@ -4,10 +4,15 @@ adb_kbd_no_key(void) "Ignoring NO_KEY" adb_kbd_writereg(int reg, uint8_t val) "reg %d val 0x%2.2x" adb_kbd_readreg(int reg, uint8_t val0, uint8_t val1) "reg %d obuf[0] 0x%2.2x obuf[1] 0x%2.2x" +adb_kbd_request_change_addr(int devaddr) "change addr to 0x%x" +adb_kbd_request_change_addr_and_handler(int devaddr, int handler) "change addr and handler to 0x%x, 0x%x" # hw/input/adb-mouse.c +adb_mouse_flush(void) "flush" adb_mouse_writereg(int reg, uint8_t val) "reg %d val 0x%2.2x" adb_mouse_readreg(int reg, uint8_t val0, uint8_t val1) "reg %d obuf[0] 0x%2.2x obuf[1] 0x%2.2x" +adb_mouse_request_change_addr(int devaddr) "change addr to 0x%x" +adb_mouse_request_change_addr_and_handler(int devaddr, int handler) "change addr and handler to 0x%x, 0x%x" # hw/input/ps2.c ps2_put_keycode(void *opaque, int keycode) "%p keycode 0x%02x"
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 28/30] PPC: e500: Fix duplicate kernel load and device tree overlap
In reply to David GibsonFrom: David Engraf <[email protected]>
This patch fixes an incorrect behavior when the -kernel argument has been specified without -bios. In this case the kernel was loaded twice. At address 32M as a raw image and afterwards by load_elf/load_uimage at the corresponding load address. In this case the region for the device tree and the raw kernel image may overlap.
The patch fixes the behavior by loading the kernel image once with load_elf/load_uimage and skips loading the raw image.
When here do not use bios_name/size for the kernel and use a more generic name called payload_name/size.
New in v3: dtb must be stored between kernel and initrd because Linux can
handle the dtb only within the first 64MB. Add a comment to clarify the behavior.
--- hw/ppc/e500.c | 116 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 46 deletions(-)
hw/ppc/e500.c +70 -46
@@ -792,8 +792,10 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)int initrd_size =0 ;hwaddr cur_base =0 ;char *filename; +const char *payload_name; +bool kernel_as_payload;hwaddr bios_entry =0 ; -target_long bios_size; +target_long payload_size;struct boot_info *boot_info;int dt_size;int i;
@@ -921,11 +923,6 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)/* Register spinning region */ sysbus_create_simple ("e500-spin" , params->spin_base,NULL ); -if (cur_base < (32 *1024 *1024 )) { -/* u-boot occupies memory up to 32MB, so load blobs above */ - cur_base = (32 *1024 *1024 ); - } -if (params->has_mpc8xxx_gpio) {qemu_irq poweroff_irq;
@@ -960,8 +957,61 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) sysbus_mmio_get_region(s, 0)); } -/* Load kernel. */ -if (machine->kernel_filename) { +/* +* Smart firmware defaults ahead! +* +* We follow the following table to select which payload we execute. +* +* -kernel | -bios | payload +* ---------+-------+--------- +* N | Y | u-boot +* N | N | u-boot +* Y | Y | u-boot +* Y | N | kernel +* +* This ensures backwards compatibility with how we used to expose +* -kernel to users but allows them to run through u-boot as well. +*/ + kernel_as_payload = false; +if (bios_name ==NULL ) { +if (machine->kernel_filename) { + payload_name = machine->kernel_filename; + kernel_as_payload = true; + }else { + payload_name ="u-boot.e500" ; + } + }else { + payload_name = bios_name; + } + + filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , payload_name); + + payload_size =load_elf (filename,NULL ,NULL , &bios_entry, &loadaddr,NULL , +1 ,PPC_ELF_MACHINE ,0 ,0 ); +if (payload_size <0 ) { +/* +* Hrm. No ELF image? Try a uImage, maybe someone is giving us an +* ePAPR compliant kernel +*/ + payload_size =load_uimage (filename, &bios_entry, &loadaddr,NULL , +NULL ,NULL ); +if (payload_size <0 ) { +error_report ("qemu: could not load firmware '%s'" , filename); +exit (1 ); + } + } + +g_free (filename); + +if (kernel_as_payload) { + kernel_base = loadaddr; + kernel_size = payload_size; + } + + cur_base = loadaddr + payload_size; + +/* Load bare kernel only if no bios/u-boot has been provided */ +if (machine->kernel_filename && !kernel_as_payload) { kernel_base = cur_base; kernel_size = load_image_targphys(machine->kernel_filename, cur_base,
@@ -975,6 +1025,11 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) cur_base += kernel_size; } +if (cur_base < (32 *1024 *1024 )) { +/* u-boot occupies memory up to 32MB, so load blobs above */ + cur_base = (32 *1024 *1024 ); + } +/* Load initrd. */ if (machine->initrd_filename) { initrd_base = (cur_base +INITRD_LOAD_PAD ) & ~INITRD_PAD_MASK ;
@@ -991,47 +1046,16 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) }/* -* Smart firmware defaults ahead! -* -* We follow the following table to select which payload we execute. -* -* -kernel | -bios | payload -* ---------+-------+--------- -* N | Y | u-boot -* N | N | u-boot -* Y | Y | u-boot -* Y | N | kernel -* -* This ensures backwards compatibility with how we used to expose -* -kernel to users but allows them to run through u-boot as well. +* Reserve space for dtb behind the kernel image because Linux has a bug +* where it can only handle the dtb if it's within the first 64MB of where +* <kernel> starts. dtb cannot not reach initrd_base because INITRD_LOAD_PAD +* ensures enough space between kernel and initrd. */ -if (bios_name ==NULL ) { -if (machine->kernel_filename) { - bios_name = machine->kernel_filename; - }else { - bios_name ="u-boot.e500" ; - } - } - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); - - bios_size =load_elf (filename,NULL ,NULL , &bios_entry, &loadaddr,NULL , -1 ,PPC_ELF_MACHINE ,0 ,0 ); -if (bios_size <0 ) { -/* -* Hrm. No ELF image? Try a uImage, maybe someone is giving us an -* ePAPR compliant kernel -*/ - kernel_size =load_uimage (filename, &bios_entry, &loadaddr,NULL , -NULL ,NULL ); -if (kernel_size <0 ) { -error_report ("could not load firmware '%s'" , filename); + dt_base = (loadaddr + payload_size +DTC_LOAD_PAD ) & ~DTC_PAD_MASK ; +if (dt_base +DTB_MAX_SIZE > ram_size) { +error_report ("qemu: not enough memory for device tree" );exit (1 ); - } } -g_free (filename); - -/* Reserve space for dtb */ - dt_base = (loadaddr + bios_size +DTC_LOAD_PAD ) & ~DTC_PAD_MASK ; dt_size = ppce500_prep_device_tree(machine, params, dt_base, initrd_base, initrd_size,
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 06/30] ppc: Add aCube Sam460ex board
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
Add emulation of aCube Sam460ex board based on AMCC 460EX embedded SoC. This is not a complete implementation yet with a lot of components still missing but enough for the U-Boot firmware to start and to boot a Linux kernel or AROS.
--- Makefile | 2 +- default-configs/ppc-softmmu.mak | 2 + default-configs/ppcemb-softmmu.mak | 1 + hw/ppc/Makefile.objs | 3 +- hw/ppc/sam460ex.c | 603 +++++++++++++++++++++++++++++++++++++ pc-bios/canyonlands.dtb | Bin 0 -> 9779 bytes pc-bios/canyonlands.dts | 566 ++++++++++++++++++++++++++++++++++ 7 files changed, 1175 insertions(+), 2 deletions(-) create mode 100644 hw/ppc/sam460ex.c create mode 100644 pc-bios/canyonlands.dtb create mode 100644 pc-bios/canyonlands.dts
Makefile +1 -1
@@ -779,7 +779,7 @@ efi-e1000.rom efi-eepro100.rom efi-ne2k_pci.rom \ efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \ efi-e1000e.rom efi-vmxnet3.rom \ qemu-icon.bmp qemu_logo_no_text.svg \ -bamboo.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ +bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \ s390-ccw.img s390-netboot.img \ spapr-rtas.bin slof.bin skiboot.lid \
default-configs/ppc-softmmu.mak +2 -0
@@ -21,6 +21,8 @@ CONFIG_E500=y CONFIG_OPENPIC_KVM=$(call land,$(CONFIG_E500),$(CONFIG_KVM)) CONFIG_PLATFORM_BUS=y CONFIG_ETSEC=y +# For Sam460ex +CONFIG_USB_EHCI_SYSBUS=y CONFIG_SM501=y CONFIG_IDE_SII3112=y CONFIG_I2C=y
default-configs/ppcemb-softmmu.mak +1 -0
@@ -15,6 +15,7 @@ CONFIG_PTIMER=y CONFIG_I8259=y CONFIG_XILINX=y CONFIG_XILINX_ETHLITE=y +CONFIG_USB_EHCI_SYSBUS=y CONFIG_SM501=y CONFIG_IDE_SII3112=y CONFIG_I2C=y
hw/ppc/Makefile.objs +2 -1
@@ -13,7 +13,8 @@ endif obj-$(CONFIG_PSERIES) += spapr_rtas_ddw.o # PowerPC 4xx boards obj-y += ppc4xx_devs.o ppc405_uc.o -obj-$(CONFIG_PPC4XX) += ppc4xx_pci.o ppc405_boards.o ppc440_bamboo.o ppc440_pcix.o +obj-$(CONFIG_PPC4XX) += ppc4xx_pci.o ppc405_boards.o +obj-$(CONFIG_PPC4XX) += ppc440_bamboo.o ppc440_pcix.o ppc440_uc.o sam460ex.o # PReP obj-$(CONFIG_PREP) += prep.o obj-$(CONFIG_PREP) += prep_systemio.o
hw/ppc/sam460ex.c new file +603 -0
603 lines not on this page · raw message
pc-bios/canyonlands.dtb new file binary +0 -0
pc-bios/canyonlands.dts new file +566 -0
566 lines not on this page · raw message
Signature · 1 line
2.14.3
[Qemu-devel] [PULL 05/30] pc-bios: Added u-boot-sam460 firmware binary
In reply to David GibsonFrom: BALATON Zoltan <[email protected]>
--- Makefile | 2 +- pc-bios/u-boot-sam460-20100605.bin | Bin 0 -> 524288 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100755 pc-bios/u-boot-sam460-20100605.bin
Makefile +1 -1
@@ -784,7 +784,7 @@ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin \ s390-ccw.img s390-netboot.img \ spapr-rtas.bin slof.bin skiboot.lid \ palcode-clipper \ -u-boot.e500 \ +u-boot.e500 u-boot-sam460-20100605.bin \ qemu_vga.ndrv \ hppa-firmware.img else
pc-bios/u-boot-sam460-20100605.bin new file binary +0 -0
Signature · 1 line
2.14.3
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/30] ppc-for-2.12 queue 20180306
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'710332af72 PowerPC: Add TS bits into msr_mask1d843d531b adb: add trace-events for monitoring keyboard/mouse during bus enumeration e0dcafa414 PPC: e500: Fix duplicate kernel load and device tree overlap ca32627c89 hw/ppc/spapr, e500: Use new property "stdout-path" for boot console 7ec999efd1 ppc/spapr-caps: Define the pseries-2.12-sxxm machine type c5c9d5e6b5 ppc/spapr-caps: Convert cap-ibs to custom spapr-cap d1f8d2a7ec ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap dee8ac698b ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap be78220976 ppc/spapr-caps: Add support for custom spapr_capabilities 41fe6c3234 target/ppc: Check mask when setting cap_ppc_safe_indirect_branch 925dc8c8ab macio: remove macio_init() function0cdc7ef4d3 macio: move setting of CUDA timebase frequency to macio_common_realize() 333e2d72ae mac_newworld: use object link to pass OpenPIC object to macio 6352921fc0 openpic: move OpenPIC state and related definitions to openpic.h f6528ecaad openpic: move KVM-specific declarations into separate openpic_kvm.h file ff45ce713e mac_oldworld: use object link to pass heathrow PIC object to macio 7a6c79ea44 macio: move macio related structures and defines into separate macio.h file 314c9858ad heathrow: change heathrow_pic_init() to return the heathrow device f5b91571dc heathrow: convert to trace-events3045694ed1 heathrow: QOMify heathrow PICad17492d9b macio: move ESCC device within the macio device777c94a3ee macio: embed DBDMA device directly within macio2ea90e405c spapr: harden code that depends on VSMT00226ad7c9 spapr: register dummy ICPs later7ed96e066b ppc: Add aCube Sam460ex board9abb284ab2 pc-bios: Added u-boot-sam460 firmware binarye4cb279fb1 roms: Added git submodule for u-boot-sam460 (firmware for sam460ex) a2279cf053 ppc440: Add emulation of plb-pcix controller found in some 440 SoCs 3e9afde83e ppc440_uc: Fix unintialized variable warning with older gcc 8e4c18ae65 spapr: fix missing CPU core nodes in DT when running with TCG
=== OUTPUT BEGIN ===
Checking PATCH 1/30: spapr: fix missing CPU core nodes in DT when running with TCG... Checking PATCH 2/30: ppc440_uc: Fix unintialized variable warning with older gcc... Checking PATCH 3/30: ppc440: Add emulation of plb-pcix controller found in some 440 SoCs... Checking PATCH 4/30: roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)... Checking PATCH 5/30: pc-bios: Added u-boot-sam460 firmware binary...
Checking PATCH 6/30: ppc: Add aCube Sam460ex board...
Checking PATCH 7/30: spapr: register dummy ICPs later...
Checking PATCH 8/30: spapr: harden code that depends on VSMT...
Checking PATCH 9/30: macio: embed DBDMA device directly within macio...
Checking PATCH 10/30: macio: move ESCC device within the macio device...
Checking PATCH 11/30: heathrow: QOMify heathrow PIC...
Checking PATCH 12/30: heathrow: convert to trace-events...
Checking PATCH 13/30: heathrow: change heathrow_pic_init() to return the heathrow device... Checking PATCH 14/30: macio: move macio related structures and defines into separate macio.h file... Checking PATCH 15/30: mac_oldworld: use object link to pass heathrow PIC object to macio... Checking PATCH 16/30: openpic: move KVM-specific declarations into separate openpic_kvm.h file... Checking PATCH 17/30: openpic: move OpenPIC state and related definitions to openpic.h...
ERROR: "foo * bar" should be "foo *bar"
#250: FILE: include/hw/ppc/openpic.h:57:
+#define RAVEN_DBL_IRQ (RAVEN_IPI_IRQ + (RAVEN_MAX_CPU * RAVEN_MAX_IPI))
total: 1 errors, 0 warnings, 353 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 18/30: mac_newworld: use object link to pass OpenPIC object to macio... Checking PATCH 19/30: macio: move setting of CUDA timebase frequency to macio_common_realize()... Checking PATCH 20/30: macio: remove macio_init() function...
Checking PATCH 21/30: target/ppc: Check mask when setting cap_ppc_safe_indirect_branch... Checking PATCH 22/30: ppc/spapr-caps: Add support for custom spapr_capabilities... Checking PATCH 23/30: ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap... Checking PATCH 24/30: ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap... Checking PATCH 25/30: ppc/spapr-caps: Convert cap-ibs to custom spapr-cap... Checking PATCH 26/30: ppc/spapr-caps: Define the pseries-2.12-sxxm machine type... Checking PATCH 27/30: hw/ppc/spapr, e500: Use new property "stdout-path" for boot console... Checking PATCH 28/30: PPC: e500: Fix duplicate kernel load and device tree overlap... Checking PATCH 29/30: adb: add trace-events for monitoring keyboard/mouse during bus enumeration... Checking PATCH 30/30: PowerPC: Add TS bits into msr_mask...
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 91 lines · On Mon, Mar 05, 2018 at 08:30:40PM -0800, [email protected] wrote:
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL 00/30] ppc-for-2.12 queue 20180306=== TEST SCRIPT BEGIN ===
#!/bin/bashBASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogramcommits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..." if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then failed=1 echo fi n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===Updating
3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'710332af72PowerPC: Add TS bits intomsr_mask1d843d531badb: add trace-events for monitoring keyboard/mouse during bus enumeratione0dcafa414PPC: e500: Fix duplicate kernel load and device tree overlapca32627c89hw/ppc/spapr, e500: Use new property "stdout-path" for boot console7ec999efd1ppc/spapr-caps: Define the pseries-2.12-sxxm machine typec5c9d5e6b5ppc/spapr-caps: Convert cap-ibs to custom spapr-capd1f8d2a7ecppc/spapr-caps: Convert cap-sbbc to custom spapr-capdee8ac698bppc/spapr-caps: Convert cap-cfpc to custom spapr-capbe78220976ppc/spapr-caps: Add support for customspapr_capabilities41fe6c3234target/ppc: Check mask when settingcap_ppc_safe_indirect_branch925dc8c8abmacio: removemacio_init()function0cdc7ef4d3macio: move setting of CUDA timebase frequency tomacio_common_realize()333e2d72aemac_newworld: use object link to pass OpenPIC object to macio6352921fc0openpic: move OpenPIC state and related definitions toopenpic.hf6528ecaadopenpic: move KVM-specific declarations into separateopenpic_kvm.hfileff45ce713emac_oldworld: use object link to pass heathrow PIC object to macio7a6c79ea44macio: move macio related structures and defines into separatemacio.hfile314c9858adheathrow: changeheathrow_pic_init()to return the heathrow devicef5b91571dcheathrow: convert to trace-events3045694ed1heathrow: QOMify heathrow PICad17492d9bmacio: move ESCC device within the macio device777c94a3eemacio: embed DBDMA device directly within macio2ea90e405cspapr: harden code that depends on VSMT00226ad7c9spapr: register dummy ICPs later7ed96e066bppc: Add aCube Sam460ex board9abb284ab2pc-bios: Added u-boot-sam460 firmware binarye4cb279fb1roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)a2279cf053ppc440: Add emulation of plb-pcix controller found in some 440 SoCs3e9afde83eppc440_uc: Fix unintialized variable warning with older gcc8e4c18ae65spapr: fix missing CPU core nodes in DT when running with TCG=== OUTPUT BEGIN ===
Checking PATCH 1/30: spapr: fix missing CPU core nodes in DT when running with TCG... Checking PATCH 2/30:ppc440_uc: Fix unintialized variable warning with older gcc... Checking PATCH 3/30: ppc440: Add emulation of plb-pcix controller found in some 440 SoCs... Checking PATCH 4/30: roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)... Checking PATCH 5/30: pc-bios: Added u-boot-sam460 firmware binary...
Checking PATCH 6/30: ppc: Add aCube Sam460ex board...
Checking PATCH 7/30: spapr: register dummy ICPs later...
Checking PATCH 8/30: spapr: harden code that depends on VSMT...
Checking PATCH 9/30: macio: embed DBDMA device directly within macio...
Checking PATCH 10/30: macio: move ESCC device within the macio device...
Checking PATCH 11/30: heathrow: QOMify heathrow PIC...
Checking PATCH 12/30: heathrow: convert to trace-events...
Checking PATCH 13/30: heathrow: changeheathrow_pic_init()to return the heathrow device... Checking PATCH 14/30: macio: move macio related structures and defines into separatemacio.hfile... Checking PATCH 15/30:mac_oldworld: use object link to pass heathrow PIC object to macio... Checking PATCH 16/30: openpic: move KVM-specific declarations into separateopenpic_kvm.hfile... Checking PATCH 17/30: openpic: move OpenPIC state and related definitions toopenpic.h...
ERROR: "foo * bar" should be "foo *bar"
#250: FILE:include/hw/ppc/openpic.h:57:
+#defineRAVEN_DBL_IRQ(RAVEN_IPI_IRQ+ (RAVEN_MAX_CPU*RAVEN_MAX_IPI))
Quoted 1 line
total: 1 errors, 0 warnings, 353 lines checked
This is a false positive. For some reason it's misidentifying a multiply as a dereference.
Quoted 26 lines
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in
MAINTAINERS.Checking PATCH 18/30:
mac_newworld: use object link to pass OpenPIC object to macio... Checking PATCH 19/30: macio: move setting of CUDA timebase frequency tomacio_common_realize()... Checking PATCH 20/30: macio: removemacio_init()function...
Checking PATCH 21/30: target/ppc: Check mask when settingcap_ppc_safe_indirect_branch... Checking PATCH 22/30: ppc/spapr-caps: Add support for customspapr_capabilities... Checking PATCH 23/30: ppc/spapr-caps: Convert cap-cfpc to custom spapr-cap... Checking PATCH 24/30: ppc/spapr-caps: Convert cap-sbbc to custom spapr-cap... Checking PATCH 25/30: ppc/spapr-caps: Convert cap-ibs to custom spapr-cap... Checking PATCH 26/30: ppc/spapr-caps: Define the pseries-2.12-sxxm machine type... Checking PATCH 27/30: hw/ppc/spapr, e500: Use new property "stdout-path" for boot console... Checking PATCH 28/30: PPC: e500: Fix duplicate kernel load and device tree overlap... Checking PATCH 29/30: adb: add trace-events for monitoring keyboard/mouse during bus enumeration... Checking PATCH 30/30: PowerPC: Add TS bits intomsr_mask...
=== OUTPUT END ===Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Peter Maydell
AppliedQuoted 19 lines · David Gibson
The following changes since commit
f2bb2d14c2958f3f5aef456bd2cdb1ff99f4a562:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-05 16:41:20 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.12-20180306for you to fetch changes up to
21b786f607b11d888f90bbb8c3414500515d11e7:PowerPC: Add TS bits into
msr_mask(2018-03-06 13:16:29 +1100)----------------------------------------------------------------
ppc patch queue 2018-03-06This pull request supersedes ppc-for-2.12-20180302 which had compile problems with some gcc versions. It also contains a few additional patches.
Quoted 12 lines
Highlights are:
* New Sam460ex machine type
* Yet more fixes related to vcpu id allocation for spapr
* Numerous macio cleanupsr
* Some enhancements to the Spectre/Meltdown fixes for pseries, allowing use of a better mitigation for indirect branch based exploits
* New pseries machine types with Spectre/Meltdown mitigations enabled (stop gap until libvirt and management understands the machine options)
* A handful of other fixes
Applied, thanks.
-- PMM
Quoted 47 lines · David Gibson
The following changes since commit
f2bb2d14c2958f3f5aef456bd2cdb1ff99f4a562:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-05 16:41:20 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.12-20180306for you to fetch changes up to
21b786f607b11d888f90bbb8c3414500515d11e7:PowerPC: Add TS bits into
msr_mask(2018-03-06 13:16:29 +1100)----------------------------------------------------------------
ppc patch queue 2018-03-06This pull request supersedes ppc-for-2.12-20180302 which had compile problems with some gcc versions. It also contains a few additional patches.
Highlights are:
* New Sam460ex machine type
* Yet more fixes related to vcpu id allocation for spapr
* Numerous macio cleanupsr
* Some enhancements to the Spectre/Meltdown fixes for pseries, allowing use of a better mitigation for indirect branch based exploits
* New pseries machine types with Spectre/Meltdown mitigations enabled (stop gap until libvirt and management understands the machine options)
* A handful of other fixes----------------------------------------------------------------
BALATON Zoltan (5):
ppc440_uc: Fix unintialized variable warning with older gcc
ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)
pc-bios: Added u-boot-sam460 firmware binary
ppc: Add aCube Sam460ex boardDavid Engraf (1):
PPC: e500: Fix duplicate kernel load and device tree overlapGreg Kurz (3):
spapr: fix missing CPU core nodes in DT when running with TCG
spapr: register dummy ICPs later
spapr: harden code that depends on VSMT
Quoted 14 lines
Mark Cave-Ayland (13):
macio: embed DBDMA device directly within macio
macio: move ESCC device within the macio device
heathrow: QOMify heathrow PIC
heathrow: convert to trace-events
heathrow: changeheathrow_pic_init()to return the heathrow device
macio: move macio related structures and defines into separatemacio.hfile
mac_oldworld: use object link to pass heathrow PIC object to macio
openpic: move KVM-specific declarations into separateopenpic_kvm.hfile
openpic: move OpenPIC state and related definitions toopenpic.h
mac_newworld: use object link to pass OpenPIC object to macio
macio: move setting of CUDA timebase frequency tomacio_common_realize()
macio: removemacio_init()function
adb: add trace-events for monitoring keyboard/mouse during bus enumeration
Something in the recent commits introduced a new way to cause unexpected aborts of QEMU:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add macio-newworld Unexpected error in qemu_chr_fe_init() at /home/thuth/devel/qemu/chardev/char-fe.c:222: Device 'serial0' is in use Aborted (core dumped)
Of course it does not make sense to add a macio-newworld device on the pseries machine, but QEMU should not abort in this case - it should just print an error message and continue afterwards. Any ideas how to fix this?
Thomas
Quoted 11 lines · Thomas Huth
Something in the recent commits introduced a new way to cause unexpected aborts of QEMU:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add macio-newworld Unexpected error in qemu_chr_fe_init() at /home/thuth/devel/qemu/chardev/char-fe.c:222: Device 'serial0' is in use Aborted (core dumped)
Quoted 3 lines
Of course it does not make sense to add a macio-newworld device on the pseries machine, but QEMU should not abort in this case - it should just print an error message and continue afterwards. Any ideas how to fix this?
So the backtrace from git master looks like this:
Thread 1 "qemu-system-ppc" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fffdbd6e3fa in __GI_abort () at abort.c:89
#2 0x0000555555de6d86 in error_handle_fatal (errp=0x555556bdfb90 <error_abort>, err=0x555556ef5a00) at util/error.c:38
#3 0x0000555555de6eb6 in error_setv (errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", err_class=ERROR_CLASS_GENERIC_ERROR,
fmt=0x555556031b50 "Device '%s' is in use", ap=0x7fffffffd010,
suffix=0x0) at util/error.c:71
#4 0x0000555555de7097 in error_setg_internal (errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init",
fmt=0x555556031b50 "Device '%s' is in use") at util/error.c:95
#5 0x0000555555d673fc in qemu_chr_fe_init (b=0x555557aef590, s=0x555556de2290, errp=0x555556bdfb90 <error_abort>) at chardev/char-fe.c:222
#6 0x0000555555af5467 in set_chr (obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", opaque=0x555556658410 <escc_properties+432>, errp=0x555556bdfb90 <error_abort>) at hw/core/qdev-properties-system.c:216 #7 0x0000555555cb326a in object_property_set (obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) at qom/object.c:1109
#8 0x0000555555cb6232 in object_property_set_qobject (obj=0x555557aeef80, value=0x555557960bf0, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) at qom/qom-qobject.c:27
#9 0x0000555555cb32af in object_property_set_str (obj=0x555557aeef80, value=0x555556de23c0 "serial0", name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) at qom/object.c:1117
#10 0x0000555555af5d94 in qdev_prop_set_chr (dev=0x555557aeef80, name=0x555555f65fc5 "chrA", value=0x555556de2290) at hw/core/qdev-properties-system.c:427 #11 0x0000555555b350a8 in macio_instance_init (obj=0x555557aec3c0) at hw/misc/macio/macio.c:347
It seems that the error is being raised when setting the property rather than during realize so I'm not sure what I can do to handle this. Any thoughts?
ATB,
Mark.
Quoted 72 lines · Mark Cave-Ayland
Quoted 11 lines · Thomas Huth
Something in the recent commits introduced a new way to cause unexpected aborts of QEMU:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add macio-newworld Unexpected error in qemu_chr_fe_init() at /home/thuth/devel/qemu/chardev/char-fe.c:222: Device 'serial0' is in use Aborted (core dumped)Quoted 4 lines
Of course it does not make sense to add a macio-newworld device on the pseries machine, but QEMU should not abort in this case - it should just print an error message and continue afterwards. Any ideas how to fix this?
So the backtrace from git master looks like this:
Thread 1 "qemu-system-ppc" received signal SIGABRT, Aborted.
__GI_raise(sig=sig@entry=6) at../sysdeps/unix/sysv/linux/raise.c:5151
../sysdeps/unix/sysv/linux/raise.c: No such file or directory.(gdb) bt
#0
__GI_raise(sig=sig@entry=6) at../sysdeps/unix/sysv/linux/raise.c:51#1
0x00007fffdbd6e3fain__GI_abort() at abort.c:89#2
0x0000555555de6d86inerror_handle_fatal(errp=0x555556bdfb90 <error_abort>, err=0x555556ef5a00) atutil/error.c:38#3
0x0000555555de6eb6inerror_setv(errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", err_class=ERROR_CLASS_GENERIC_ERROR, fmt=0x555556031b50 "Device '%s' is in use", ap=0x7fffffffd010, suffix=0x0) atutil/error.c:71#4
0x0000555555de7097inerror_setg_internal(errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", fmt=0x555556031b50 "Device '%s' is in use") atutil/error.c:95#5
0x0000555555d673fcinqemu_chr_fe_init(b=0x555557aef590, s=0x555556de2290, errp=0x555556bdfb90 <error_abort>) atchardev/char-fe.c:222
#60x0000555555af5467inset_chr(obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", opaque=0x555556658410 <escc_properties+432>, errp=0x555556bdfb90 <error_abort>) athw/core/qdev-properties-system.c:216#70x0000555555cb326ainobject_property_set(obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/object.c:1109
#80x0000555555cb6232inobject_property_set_qobject(obj=0x555557aeef80, value=0x555557960bf0, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/qom-qobject.c:27
#90x0000555555cb32afinobject_property_set_str(obj=0x555557aeef80, value=0x555556de23c0 "serial0", name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/object.c:1117
#100x0000555555af5d94inqdev_prop_set_chr(dev=0x555557aeef80, name=0x555555f65fc5 "chrA", value=0x555556de2290) athw/core/qdev-properties-system.c:427
#110x0000555555b350a8inmacio_instance_init(obj=0x555557aec3c0) athw/misc/macio/macio.c:347
Quoted 3 lines
It seems that the error is being raised when setting the property rather than during realize so I'm not sure what I can do to handle this. Any thoughts?
Does the device need to be hot-pluggable or even user_creatable at all? It seems like it is also using serial_hds[] directly, so that is a good indication that it is *not* user creatable. So maybe the easiest fix is to simply set
dc->user_creatable = false;
in macio_class_init() ?
Thomas
Quoted 73 lines · On Tue, 6 Mar 2018 18:47:47 +0100 Thomas Huth <[email protected]> wrote:
Quoted 72 lines · Mark Cave-Ayland
Quoted 11 lines · Thomas Huth
Something in the recent commits introduced a new way to cause unexpected aborts of QEMU:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add macio-newworld Unexpected error in qemu_chr_fe_init() at /home/thuth/devel/qemu/chardev/char-fe.c:222: Device 'serial0' is in use Aborted (core dumped)Quoted 4 lines
Of course it does not make sense to add a macio-newworld device on the pseries machine, but QEMU should not abort in this case - it should just print an error message and continue afterwards. Any ideas how to fix this?
So the backtrace from git master looks like this:
Thread 1 "qemu-system-ppc" received signal SIGABRT, Aborted.
__GI_raise(sig=sig@entry=6) at../sysdeps/unix/sysv/linux/raise.c:5151
../sysdeps/unix/sysv/linux/raise.c: No such file or directory.(gdb) bt
#0
__GI_raise(sig=sig@entry=6) at../sysdeps/unix/sysv/linux/raise.c:51#1
0x00007fffdbd6e3fain__GI_abort() at abort.c:89#2
0x0000555555de6d86inerror_handle_fatal(errp=0x555556bdfb90 <error_abort>, err=0x555556ef5a00) atutil/error.c:38#3
0x0000555555de6eb6inerror_setv(errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", err_class=ERROR_CLASS_GENERIC_ERROR, fmt=0x555556031b50 "Device '%s' is in use", ap=0x7fffffffd010, suffix=0x0) atutil/error.c:71#4
0x0000555555de7097inerror_setg_internal(errp=0x555556bdfb90 <error_abort>, src=0x555556031ad0 "chardev/char-fe.c", line=222, func=0x555556031c50 <__func__.18713> "qemu_chr_fe_init", fmt=0x555556031b50 "Device '%s' is in use") atutil/error.c:95#5
0x0000555555d673fcinqemu_chr_fe_init(b=0x555557aef590, s=0x555556de2290, errp=0x555556bdfb90 <error_abort>) atchardev/char-fe.c:222
#60x0000555555af5467inset_chr(obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", opaque=0x555556658410 <escc_properties+432>, errp=0x555556bdfb90 <error_abort>) athw/core/qdev-properties-system.c:216#70x0000555555cb326ainobject_property_set(obj=0x555557aeef80, v=0x555557960c20, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/object.c:1109
#80x0000555555cb6232inobject_property_set_qobject(obj=0x555557aeef80, value=0x555557960bf0, name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/qom-qobject.c:27
#90x0000555555cb32afinobject_property_set_str(obj=0x555557aeef80, value=0x555556de23c0 "serial0", name=0x555555f65fc5 "chrA", errp=0x555556bdfb90 <error_abort>) atqom/object.c:1117
#100x0000555555af5d94inqdev_prop_set_chr(dev=0x555557aeef80, name=0x555555f65fc5 "chrA", value=0x555556de2290) athw/core/qdev-properties-system.c:427
#110x0000555555b350a8inmacio_instance_init(obj=0x555557aec3c0) athw/misc/macio/macio.c:347
Quoted 5 lines
Quoted 3 lines
It seems that the error is being raised when setting the property rather than during realize so I'm not sure what I can do to handle this. Any thoughts?
Does the device need to be hot-pluggable or even
user_creatableat all?
FWIW, the crash also happens when the device is passed on the command line:
$ ppc64-softmmu/qemu-system-ppc64 -device macio-newworld Unexpected error in qemu_chr_fe_init() at /home/greg/Work/qemu/qemu-spapr/chardev/char-fe.c:222: qemu-system-ppc64: -device macio-newworld: Device 'serial0' is in use Aborted (core dumped)
Quoted 11 lines
It seems like it is also using serial_hds[] directly, so that is a good indication that it is *not* user creatable. So maybe the easiest fix is to simply set
dc->user_creatable = false;in
macio_class_init()?Thomas
Quoted 4 lines · Thomas Huth
Quoted 3 lines
It seems that the error is being raised when setting the property rather than during realize so I'm not sure what I can do to handle this. Any thoughts?
Quoted 8 lines
Does the device need to be hot-pluggable or even
user_creatableat all? It seems like it is also using serial_hds[] directly, so that is a good indication that it is *not* user creatable. So maybe the easiest fix is to simply setdc->user_creatable = false;in
macio_class_init()?
(Added Daniel to CC)
I believe it should fail anyhow during realize because both macio devices (newworld and oldworld) requires an object link to the PIC which won't be set when using device_add via the monitor as in your example.
But it still doesn't quite feel right that just setting a property value should abort() immediately. Daniel, any thoughts?
ATB,
Mark.
Quoted 15 lines · Mark Cave-Ayland
Quoted 4 lines · Thomas Huth
Quoted 3 lines
It seems that the error is being raised when setting the property rather than during realize so I'm not sure what I can do to handle this. Any thoughts?
Quoted 8 lines
Does the device need to be hot-pluggable or even
user_creatableat all? It seems like it is also using serial_hds[] directly, so that is a good indication that it is *not* user creatable. So maybe the easiest fix is to simply setdc->user_creatable = false;in
macio_class_init()?
Quoted 8 lines
(Added Daniel to CC)
I believe it should fail anyhow during realize because both macio devices (newworld and oldworld) requires an object link to the PIC which won't be set when using
device_addvia the monitor as in your example.But it still doesn't quite feel right that just setting a property value should
abort()immediately. Daniel, any thoughts?
Setting user_creatable = false is important, as that flag is used to filter the list of permitted devices when doing monitor readline completion for 'device_add' and when printing available devices with '-device ?'
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 8 lines · Thomas Huth
Does the device need to be hot-pluggable or even
user_creatableat all? It seems like it is also using serial_hds[] directly, so that is a good indication that it is *not* user creatable. So maybe the easiest fix is to simply setdc->user_creatable = false;in
macio_class_init()?
Yes. As Thomas says, if your device is using serial_hds[] directly it is not user creatable.
The ideal design here is that the device does not touch serial_hds[] at all, but instead has qdev properties for char devices, which the board model code wires up based on serial_hds[]. (In this case you could make them just be alias properties into the escc object that the macio device creates.)
Either way I don't think there's any reason for the device to be user-creatable.
thanks
-- PMM
HI,
i had test last git with Zoltan sam emultation but at start i recive this
./qemu-system-ppc -M sam460ex
qemu-system-ppc: /home/gigi/src/tags/ppc-for-2.12-20180306/include/qemu/rcu.h:89: rcu_read_unlock: asserzione "p_rcu_reader->depth != 0" non riuscita. Annullato (core dump creato)
My machie is a Threadripper 1950x the distro is Ubuntu mate 17.10
Thanks
Luigi
________________________________
Da: Qemu-ppc <[email protected]> per conto di Thomas Huth <[email protected]>
Inviato: martedì 6 marzo 2018 17:48
A: David Gibson; Mark Cave-Ayland
Cc: [email protected]; [email protected]
Oggetto: Re: [Qemu-ppc] [Qemu-devel] [PULL 00/30] ppc-for-2.12 queue 20180306
Quoted 47 lines · David Gibson
The following changes since commit
f2bb2d14c2958f3f5aef456bd2cdb1ff99f4a562:Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2018-03-05 16:41:20 +0000)
are available in the Git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.12-20180306for you to fetch changes up to
21b786f607b11d888f90bbb8c3414500515d11e7:PowerPC: Add TS bits into
msr_mask(2018-03-06 13:16:29 +1100)----------------------------------------------------------------
ppc patch queue 2018-03-06This pull request supersedes ppc-for-2.12-20180302 which had compile problems with some gcc versions. It also contains a few additional patches.
Highlights are:
* New Sam460ex machine type
* Yet more fixes related to vcpu id allocation for spapr
* Numerous macio cleanupsr
* Some enhancements to the Spectre/Meltdown fixes for pseries, allowing use of a better mitigation for indirect branch based exploits
* New pseries machine types with Spectre/Meltdown mitigations enabled (stop gap until libvirt and management understands the machine options)
* A handful of other fixes----------------------------------------------------------------
BALATON Zoltan (5):
ppc440_uc: Fix unintialized variable warning with older gcc
ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
roms: Added git submodule for u-boot-sam460 (firmware for sam460ex)
pc-bios: Added u-boot-sam460 firmware binary
ppc: Add aCube Sam460ex boardDavid Engraf (1):
PPC: e500: Fix duplicate kernel load and device tree overlapGreg Kurz (3):
spapr: fix missing CPU core nodes in DT when running with TCG
spapr: register dummy ICPs later
spapr: harden code that depends on VSMT
Quoted 14 lines
Mark Cave-Ayland (13):
macio: embed DBDMA device directly within macio
macio: move ESCC device within the macio device
heathrow: QOMify heathrow PIC
heathrow: convert to trace-events
heathrow: changeheathrow_pic_init()to return the heathrow device
macio: move macio related structures and defines into separatemacio.hfile
mac_oldworld: use object link to pass heathrow PIC object to macio
openpic: move KVM-specific declarations into separateopenpic_kvm.hfile
openpic: move OpenPIC state and related definitions toopenpic.h
mac_newworld: use object link to pass OpenPIC object to macio
macio: move setting of CUDA timebase frequency tomacio_common_realize()
macio: removemacio_init()function
adb: add trace-events for monitoring keyboard/mouse during bus enumeration
Something in the recent commits introduced a new way to cause unexpected aborts of QEMU:
$ ppc64-softmmu/qemu-system-ppc64 -monitor stdio QEMU 2.11.50 monitor - type 'help' for more information (qemu) device_add macio-newworld Unexpected error in qemu_chr_fe_init() at /home/thuth/devel/qemu/chardev/char-fe.c:222: Device 'serial0' is in use Aborted (core dumped)
Of course it does not make sense to add a macio-newworld device on the pseries machine, but QEMU should not abort in this case - it should just print an error message and continue afterwards. Any ideas how to fix this?
Thomas
Quoted 9 lines · luigi burdo
HI,
i had test last git with Zoltan sam emultation but at start i recive this
./qemu-system-ppc -M sam460ex
qemu-system-ppc:/home/gigi/src/tags/ppc-for-2.12-20180306/include/qemu/rcu.h:89:rcu_read_unlock: asserzione "p_rcu_reader->depth!= 0" non riuscita. Annullato (core dump creato)
I think that's a regression introduced with one of the latest commits. Could you please try whether "git checkout 58e2e17dba49b43f4ac9de19468" works better for you?
Thomas
Quoted 11 lines · On Wed, 7 Mar 2018 13:21:18 +0100 Thomas Huth <[email protected]> wrote:
Quoted 9 lines · luigi burdo
HI,
i had test last git with Zoltan sam emultation but at start i recive this
./qemu-system-ppc -M sam460ex
qemu-system-ppc:/home/gigi/src/tags/ppc-for-2.12-20180306/include/qemu/rcu.h:89:rcu_read_unlock: asserzione "p_rcu_reader->depth!= 0" non riuscita. Annullato (core dump creato)
Quoted 3 lines
I think that's a regression introduced with one of the latest commits. Could you please try whether "git checkout
58e2e17dba49b43f4ac9de19468" works better for you?
Yep, it's a regession; I hit this with s390x/tcg as well (bisected to commit 11e732a5ed46903f997985bed4c3767ca28a7eb6 in my case).