ppc fixes for 7.0
The following changes since commit 1416688c53be6535be755b44c15fb2eb9defd20f:
Merge remote-tracking branch 'remotes/mcayland/tags/q800-updates-for-7.0-20220309' into staging (2022-03-10 13:16:37 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-ppc-20220314
for you to fetch changes up to 9c10d86fee11d96274ea6f7cda12d2471abe3c47:
ppc/pnv: Remove user-created PHB{3,4,5} devices (2022-03-14 15:57:17 +0100)
----------------------------------------------------------------
ppc-7.0 queue :
* Removal of user-created PHB devices
* Avocado fixes for --disable-tcg
* Instruction and Radix MMU fixes
----------------------------------------------------------------
Cédric Le Goater (2):
ppc/xive2: Make type Xive2EndSource not user creatable ppc/pnv: Remove user-created PHB{3,4,5} devices
Daniel Henrique Barboza (14):
qtest/meson.build: check CONFIG_TCG for prom-env-test in qtests_ppc qtest/meson.build: check CONFIG_TCG for boot-serial-test in qtests_ppc avocado/boot_linux_console.py: check for tcg in test_ppc_powernv8/9 avocado/boot_linux_console.py: check tcg accel in test_ppc64_e500 avocado/replay_kernel.py: make tcg-icount check in run_vm() avocado/boot_linux_console.py: check TCG accel in test_ppc_g3beige() avocado/boot_linux_console.py: check TCG accel in test_ppc_mac99() avocado/ppc_405.py: remove test_ppc_taihu() avocado/ppc_405.py: check TCG accel in test_ppc_ref405ep() avocado/ppc_74xx.py: check TCG accel for all tests avocado/ppc_bamboo.py: check TCG accel in test_ppc_bamboo() avocado/ppc_mpc8544ds.py: check TCG accel in test_ppc_mpc8544ds() avocado/ppc_prep_40p.py: check TCG accel in all tests avocado/ppc_virtex_ml507.py: check TCG accel in test_ppc_virtex_ml507()
Frederic Barrat (2):
ppc/pnv: Introduce a pnv-phb5 device to match root port ppc/pnv: Always create the PHB5 PEC devices
Leandro Lupori (1):
target/ppc: fix ISI fault cause for Radix MMU
Matheus Ferst (1):
target/ppc: fix xxspltw for big endian hosts
include/hw/pci-host/pnv_phb4.h | 5 +++ include/hw/ppc/pnv.h | 1 - hw/intc/xive2.c | 1 + hw/pci-host/pnv_phb3.c | 33 ++---------------- hw/pci-host/pnv_phb4.c | 69 ++++++------------------------------- hw/pci-host/pnv_phb4_pec.c | 16 ++++----- hw/ppc/pnv.c | 29 ++-------------- target/ppc/mmu-radix64.c | 3 +- tests/tcg/ppc64le/xxspltw.c | 46 +++++++++++++++++++++++++ target/ppc/translate/vsx-impl.c.inc | 2 +- tests/avocado/boot_linux_console.py | 17 +++++++++ tests/avocado/ppc_405.py | 10 ++---- tests/avocado/ppc_74xx.py | 13 +++++++ tests/avocado/ppc_bamboo.py | 2 ++ tests/avocado/ppc_mpc8544ds.py | 2 ++ tests/avocado/ppc_prep_40p.py | 6 ++++ tests/avocado/ppc_virtex_ml507.py | 2 ++ tests/avocado/replay_kernel.py | 4 +++ tests/qtest/meson.build | 4 ++- tests/tcg/ppc64/Makefile.target | 1 + tests/tcg/ppc64le/Makefile.target | 1 + 21 files changed, 131 insertions(+), 136 deletions(-) create mode 100644 tests/tcg/ppc64le/xxspltw.c
[PULL 01/20] qtest/meson.build: check CONFIG_TCG for prom-env-test in qtests_ppc
From: Daniel Henrique Barboza <[email protected]>
'prom-env-test' is a TCG test that will fail if QEMU is compiled with --disable-tcg:
$ QTEST_QEMU_BINARY=./qemu-system-ppc64 ./tests/qtest/prom-env-test /ppc64/prom-env/mac99: qemu-system-ppc64: -accel tcg: invalid accelerator tcg (... hangs indefinitely ...)
Fix it by checking CONFIG_TCG before compiling prom-env-test.
Message-Id: <[email protected]>
--- tests/qtest/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qtest/meson.build +2 -1
@@ -160,7 +160,8 @@ qtests_ppc = \ (slirp.found() ? ['test-netfilter'] : []) + \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ - ['boot-order-test', 'prom-env-test', 'boot-serial-test'] \ + (config_all_devices.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) + \ + ['boot-order-test', 'boot-serial-test'] qtests_ppc64 = \ qtests_ppc + \
Signature · 1 line
2.34.1
[PULL 02/20] qtest/meson.build: check CONFIG_TCG for boot-serial-test in qtests_ppc
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
'boot-serial-test' does not work with a QEMU built with --disable-tcg in a IBM POWER9 host. The reason is that without TCG QEMU will default to KVM acceleration, but then the KVM module in IBM POWER hosts aren't able to handle other CPUs.
The result is that the test will break with a KVM error when trying to ruin the ppce500 test:
$ QTEST_QEMU_BINARY=./qemu-system-ppc64 ./tests/qtest/boot-serial-test /ppc64/boot-serial/ppce500: qemu-system-ppc64: -accel tcg: invalid accelerator tcg error: kvm run failed Invalid argument NIP 0000000000f00000 LR 0000000000000000 CTR 0000000000000000 XER 0000000000000000 CPU#0 MSR 0000000000000000 HID0 0000000000000000 HF 24020002 iidx 1 didx 1 TB 00000000 00000000 DECR 0 (...) ** (./tests/qtest/boot-serial-test:1935760): ERROR **: 07:44:03.010: Failed to find expected string. Please check '/tmp/qtest-boot-serial-sJ78sqg'
Fix it by checking CONFIG_TCG before compiling boot-serial-test.
Message-Id: <[email protected]>
--- tests/qtest/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qtest/meson.build +2 -1
@@ -161,7 +161,8 @@ qtests_ppc = \ (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) + \ (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) + \ (config_all_devices.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) + \ - ['boot-order-test', 'boot-serial-test'] + (config_all_devices.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) + \ + ['boot-order-test'] qtests_ppc64 = \ qtests_ppc + \
Signature · 1 line
2.34.1
[PULL 14/20] avocado/ppc_virtex_ml507.py: check TCG accel in test_ppc_virtex_ml507()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
This test times out when running in an IBM POWER host and --disable-tcg.
Message-Id: <[email protected]>
--- tests/avocado/ppc_virtex_ml507.py | 2 ++ 1 file changed, 2 insertions(+)
tests/avocado/ppc_virtex_ml507.py +2 -0
@@ -19,7 +19,9 @@ def test_ppc_virtex_ml507(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:virtex-ml507 + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") tar_url = ('https://www.qemu-advent-calendar.org' '/2020/download/hippo.tar.gz') tar_hash = '306b95bfe7d147f125aa176a877e266db8ef914a'
Signature · 1 line
2.34.1
[PULL 20/20] ppc/pnv: Remove user-created PHB{3,4,5} devices
In reply to Cédric Le GoaterOn a real system with POWER{8,9,10} processors, PHBs are sub-units of the processor, they can be deactivated by firmware but not plugged in or out like a PCI adapter on a slot. Nevertheless, having user-created PHBs in QEMU seemed to be a good idea for testing purposes :
1. having a limited set of PHBs speedups boot time.
2. it is useful to be able to mimic a partially broken topology you some time have to deal with during bring-up.
PowerNV is also used for distro install tests and having libvirt support eases these tasks. libvirt prefers to run the machine with -nodefaults to be sure not to drag unexpected devices which would need to be defined in the domain file without being specified on the QEMU command line. For this reason :
3. -nodefaults should not include default PHBs
User-created PHB{3,4,5} devices satisfied all these needs but reality proves to be a bit more complex, internally when modeling such devices, and externally when dealing with the user interface.
Req 1. and 2. can be simply addressed differently with a machine option:
"phb-mask=<uint>", which QEMU would use to enable/disable PHB device nodes when creating the device tree.
For Req 3., we need to make sure we are taking the right approach. It seems that we should expose a new type of user-created PHB device, a generic virtualized one, that libvirt would use and not one depending on the processor revision. This needs more thinking.
For now, remove user-created PHB{3,4,5} devices. All the cleanups we did are not lost and they will be useful for the next steps.
Message-Id: <[email protected]>
--- include/hw/ppc/pnv.h | 1 - hw/pci-host/pnv_phb3.c | 33 ++------------------ hw/pci-host/pnv_phb4.c | 62 ++------------------------------------ hw/pci-host/pnv_phb4_pec.c | 7 ++--- hw/ppc/pnv.c | 25 +-------------- 5 files changed, 10 insertions(+), 118 deletions(-)
include/hw/ppc/pnv.h +0 -1
@@ -190,7 +190,6 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10,PowerPCCPU *pnv_chip_find_cpu (PnvChip *chip,uint32_t pir);void pnv_phb_attach_root_port (PCIHostState *pci,const char *name); -void pnv_chip_parent_fixup (PnvChip *chip,Object *obj,int index);#define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv")typedef struct PnvMachineClass PnvMachineClass ;
hw/pci-host/pnv_phb3.c +3 -30
@@ -994,30 +994,6 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)PnvMachineState *pnv =PNV_MACHINE (qdev_get_machine ());int i; -/* User created devices */ -if (!phb->chip) { -Error *local_err =NULL ; -BusState *s; - - phb->chip =pnv_get_chip (pnv, phb->chip_id); -if (!phb->chip) { -error_setg (errp,"invalid chip id: %d" , phb->chip_id); -return ; - } - -/* -* Reparent user created devices to the chip to build -* correctly the device tree. -*/ -pnv_chip_parent_fixup (phb->chip,OBJECT (phb), phb->phb_id); - - s =qdev_get_parent_bus (DEVICE (phb->chip)); -if (!qdev_set_parent_bus (DEVICE (phb), s, &local_err)) { -error_propagate (errp, local_err); -return ; - } - } -if (phb->phb_id >=PNV_CHIP_GET_CLASS (phb->chip)->num_phbs) {error_setg (errp,"invalid PHB index: %d" , phb->phb_id);return ;
@@ -1077,10 +1053,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)pci_setup_iommu (pci->bus, pnv_phb3_dma_iommu, phb); -if (defaults_enabled ()) { -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), -TYPE_PNV_PHB3_ROOT_PORT ); - } +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb),TYPE_PNV_PHB3_ROOT_PORT ); }void pnv_phb3_update_regions (PnvPHB3 *phb)
@@ -1131,7 +1104,7 @@ static void pnv_phb3_class_init(ObjectClass *klass, void *data) dc->realize = pnv_phb3_realize;device_class_set_props (dc, pnv_phb3_properties);set_bit (DEVICE_CATEGORY_BRIDGE , dc->categories); - dc->user_creatable = true; + dc->user_creatable = false; }static const TypeInfo pnv_phb3_type_info = {
@@ -1201,7 +1174,7 @@ static void pnv_phb3_root_port_class_init(ObjectClass *klass, void *data)device_class_set_parent_realize (dc, pnv_phb3_root_port_realize, &rpc->parent_realize); - dc->user_creatable = true; + dc->user_creatable = false; k->vendor_id =PCI_VENDOR_ID_IBM ; k->device_id =0x03dc ;
hw/pci-host/pnv_phb4.c +3 -59
94 lines not on this page · raw message
hw/pci-host/pnv_phb4_pec.c +3 -4
@@ -120,6 +120,7 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,PnvPHB4 *phb =PNV_PHB4 (qdev_new (pecc->phb_type));int phb_id =pnv_phb4_pec_get_phb_id (pec, stack_no); +object_property_add_child (OBJECT (pec),"phb[*]" ,OBJECT (phb));object_property_set_link (OBJECT (phb),"pec" ,OBJECT (pec), &error_abort); object_property_set_int(OBJECT(phb), "chip-id", pec->chip_id,
@@ -150,10 +151,8 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp) pec->num_phbs = pecc->num_phbs[pec->index];/* Create PHBs if running with defaults */ -if (defaults_enabled ()) { -for (i =0 ; i < pec->num_phbs; i++) { -pnv_pec_default_phb_realize (pec, i, errp); - } +for (i =0 ; i < pec->num_phbs; i++) { +pnv_pec_default_phb_realize (pec, i, errp); }/* Initialize the XSCOM regions for the PEC registers */
hw/ppc/pnv.c +1 -24
@@ -1141,9 +1141,7 @@ static void pnv_chip_power8_instance_init(Object *obj)object_initialize_child (obj,"homer" , &chip8->homer,TYPE_PNV8_HOMER ); -if (defaults_enabled ()) { - chip8->num_phbs = pcc->num_phbs; - } + chip8->num_phbs = pcc->num_phbs;for (i =0 ; i < chip8->num_phbs; i++) {object_initialize_child (obj,"phb[*]" , &chip8->phbs[i],TYPE_PNV_PHB3 );
@@ -1974,23 +1972,6 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq)return NULL ; } -void pnv_chip_parent_fixup (PnvChip *chip,Object *obj,int index) -{ -Object *parent =OBJECT (chip); - g_autofree char *default_id = -g_strdup_printf ("%s[%d]" ,object_get_typename (obj), index); - -if (obj->parent == parent) { -return ; - } - -object_ref (obj); -object_unparent (obj); -object_property_add_child ( - parent,DEVICE (obj)->id ?DEVICE (obj)->id : default_id, obj); -object_unref (obj); -} -PnvChip *pnv_get_chip (PnvMachineState *pnv,uint32_t chip_id) {int i;
@@ -2130,8 +2111,6 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size =sizeof (compat); - -machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB3 ); }static void pnv_machine_power9_class_init (ObjectClass *oc,void *data)
@@ -2150,8 +2129,6 @@ static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) pmc->compat = compat; pmc->compat_size =sizeof (compat); pmc->dt_power_mgt = pnv_dt_power_mgt; - -machine_class_allow_dynamic_sysbus_dev (mc,TYPE_PNV_PHB4 ); }static void pnv_machine_power10_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.34.1
[PULL 03/20] avocado/boot_linux_console.py: check for tcg in test_ppc_powernv8/9
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
The PowerNV8/9 machines does not work with KVM acceleration, meaning that boot_linux_console.py:BootLinuxConsole.test_ppc_powernv8/9 tests will always fail when QEMU is compiled with --disable-tcg:
ERROR 1-tests/avocado/boot_linux_console.py:BootLinuxConsole.test_ppc_powernv8
-> VMLaunchFailure: ConnectError: Failed to establish session:
[Errno 104] Connection reset by peer
Exit code: 1
Command: ./qemu-system-ppc64 -display none -vga none -chardev socket,id=mon,path=/var/tmp/avo_qemu_sock_no19zg0m/qemu-1936936-7fffa77cff98-monitor.sock -mon chardev=mon,mode=control -machine powernv8 -chardev socket,id=console,path=/var/tmp/avo_qemu_sock_no19zg0m/qemu-1936936-7fffa77cff98-console.sock,server=on,wait=off -serial chardev:console -kernel /home/danielhb/avocado/data/cache/by_location/4514304e2c4ee84c5f0b5c8bacedda783891df68/zImage.epapr -append console=tty0 console=hvc0 -device pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0 -device nvme,bus=pcie.2,addr=0x0,serial=1234 -device e1000e,bus=bridge1,addr=0x3 -device nec-usb-xhci,bus=bridge1,addr=0x2
Output: qemu-system-ppc64: The powernv machine does not work with KVM acceleration
Let's add the TCG accel requirement in both tests to skip them if we don't have TCG support available.
Message-Id: <[email protected]>
--- tests/avocado/boot_linux_console.py | 3 +++ 1 file changed, 3 insertions(+)
tests/avocado/boot_linux_console.py +3 -0
@@ -1170,6 +1170,7 @@ def test_ppc64_e500(self): self.do_test_advcal_2018('19', tar_hash, 'uImage') def do_test_ppc64_powernv(self, proc): + self.require_accelerator("tcg") images_url = ('https://github.com/open-power/op-build/releases/download/v2.7/') kernel_url = images_url + 'zImage.epapr'
@@ -1194,6 +1195,7 @@ def test_ppc_powernv8(self): """ :avocado: tags=arch:ppc64 :avocado: tags=machine:powernv8 + :avocado: tags=accel:tcg """ self.do_test_ppc64_powernv('P8')
@@ -1201,6 +1203,7 @@ def test_ppc_powernv9(self): """ :avocado: tags=arch:ppc64 :avocado: tags=machine:powernv9 + :avocado: tags=accel:tcg """ self.do_test_ppc64_powernv('P9')
Signature · 1 line
2.34.1
[PULL 19/20] ppc/pnv: Always create the PHB5 PEC devices
In reply to Cédric Le GoaterFrom: Frederic Barrat <[email protected]>
Always create the PECs (PCI Express Controller) for the system. The PECs host the PHBs and we try to find the matching PEC when creating a PHB, so it must exist. It also matches what we do on POWER9
[ clg: - Rewored commit log
- Removed dynamic PHB5 ]
Message-Id: <[email protected]>
--- hw/ppc/pnv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/ppc/pnv.c +1 -3
@@ -1600,9 +1600,7 @@ static void pnv_chip_power10_instance_init(Object *obj)object_initialize_child (obj,"occ" , &chip10->occ,TYPE_PNV10_OCC );object_initialize_child (obj,"homer" , &chip10->homer,TYPE_PNV10_HOMER ); -if (defaults_enabled ()) { - chip->num_pecs = pcc->num_pecs; - } + chip->num_pecs = pcc->num_pecs;for (i =0 ; i < chip->num_pecs; i++) { object_initialize_child(obj, "pec[*]", &chip10->pecs[i],
Signature · 1 line
2.34.1
[PULL 11/20] avocado/ppc_bamboo.py: check TCG accel in test_ppc_bamboo()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
This tests times out in an IBM POWER host when compiled with --disable-tcg.
Message-Id: <[email protected]>
--- tests/avocado/ppc_bamboo.py | 2 ++ 1 file changed, 2 insertions(+)
tests/avocado/ppc_bamboo.py +2 -0
@@ -20,7 +20,9 @@ def test_ppc_bamboo(self): :avocado: tags=machine:bamboo :avocado: tags=cpu:440epb :avocado: tags=device:rtl8139 + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") tar_url = ('http://landley.net/aboriginal/downloads/binaries/' 'system-image-powerpc-440fp.tar.gz') tar_hash = '53e5f16414b195b82d2c70272f81c2eedb39bad9'
Signature · 1 line
2.34.1
[PULL 15/20] target/ppc: fix ISI fault cause for Radix MMU
In reply to Cédric Le GoaterFrom: Leandro Lupori <[email protected]>
Fix Instruction Storage Interrupt (ISI) fault cause for Radix MMU, when caused by missing PAGE_EXEC permission, to be SRR1_NOEXEC_GUARD instead of DSISR_PROTFAULT.
This matches POWER9 hardware behavior.
Message-Id: <[email protected]>
--- target/ppc/mmu-radix64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/ppc/mmu-radix64.c +2 -1
@@ -204,7 +204,8 @@ static bool ppc_radix64_check_prot(PowerPCCPU *cpu, MMUAccessType access_type,/* Check if requested access type is allowed */ need_prot =prot_for_access_type (access_type);if (need_prot & ~*prot) {/* Page Protected for that Access */ - *fault_cause |=DSISR_PROTFAULT ; + *fault_cause |= access_type ==MMU_INST_FETCH ?SRR1_NOEXEC_GUARD : +DSISR_PROTFAULT ;return true; }
Signature · 1 line
2.34.1
[PULL 07/20] avocado/boot_linux_console.py: check TCG accel in test_ppc_mac99()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
This test breaks when run in an IBM POWER host with a QEMU compiled with --disable-tcg and the ppc-softmmu target in a similar manner as test_ppc_g3beige did.
There's also an observation made about kvm_pr in the error message:
Command: ./qemu-system-ppc -display none -vga none (...) -machine mac99 (...)
Output: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument
PPC KVM module is not loaded. Try modprobe kvm_pr.
qemu-system-ppc: failed to initialize kvm: Invalid argument
This means that, when/if we're able to detect kvm_pr support in these avocado tests, we can revisit this test to not rely solely on TCG availability.
Message-Id: <[email protected]>
--- tests/avocado/boot_linux_console.py | 6 ++++++ 1 file changed, 6 insertions(+)
tests/avocado/boot_linux_console.py +6 -0
@@ -1228,7 +1228,13 @@ def test_ppc_mac99(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:mac99 + :avocado: tags=accel:tcg """ + # TODO: mac99 works with kvm_pr but we don't have a + # reliable way ATM (e.g. looking at /proc/modules) to detect + # whether we're running kvm_hv or kvm_pr. For now let's + # disable this test if we don't have TCG support. + self.require_accelerator("tcg") tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' self.vm.add_args('-M', 'graphics=off') self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
Signature · 1 line
2.34.1
[PULL 09/20] avocado/ppc_405.py: check TCG accel in test_ppc_ref405ep()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
Running this test without TCG support in an IBM POWER server results in the following error:
Command: ./qemu-system-ppc -display none -vga none (...)
-machine ref405ep (...)
Output: qemu-system-ppc: Register sync failed... If you're using
kvm-hv.ko, only "-cpu host" is possible
qemu-system-ppc: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
Although the host is running kvm_hv we don't have a way of differentiate between kvm_hv and kvm_pr, meaning that this test would've failed in the same way if kvm_pr was the KVM module loaded in the host.
Since we don't have a way of checking which KVM module is being loaded when using avocado, make a TCG accel check in test_ppc_ref405ep().
Message-Id: <[email protected]>
--- tests/avocado/ppc_405.py | 2 ++ 1 file changed, 2 insertions(+)
tests/avocado/ppc_405.py +2 -0
@@ -30,5 +30,7 @@ def test_ppc_ref405ep(self): :avocado: tags=arch:ppc :avocado: tags=machine:ref405ep :avocado: tags=cpu:405ep + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") self.do_test_ppc405()
Signature · 1 line
2.34.1
[PULL 06/20] avocado/boot_linux_console.py: check TCG accel in test_ppc_g3beige()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
This test breaks when run in an IBM POWER host with a QEMU compiled with --disable-tcg and the ppc-softmmu target.
One thing to note is that the error message explictly mentions kvm_pr support:
Command: ./qemu-system-ppc -display none -vga none (...) -machine g3beige (...)
Output: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument
PPC KVM module is not loaded. Try modprobe kvm_pr.
qemu-system-ppc: failed to initialize kvm: Invalid argument
The host was running kvm_hv, not kvm_pr, and the machine failed to load.
Unfortunately we don't have a way to detect whether the KVM module loaded is kvm_hv or kvm_pr - we do a check for /dev/kvm to detect KVM support but both modules create this file so that's not helpful.
Let's skip this test for now until we have a way of detecting kvm_pr support in the host.
Message-Id: <[email protected]>
--- tests/avocado/boot_linux_console.py | 6 ++++++ 1 file changed, 6 insertions(+)
tests/avocado/boot_linux_console.py +6 -0
@@ -1213,7 +1213,13 @@ def test_ppc_g3beige(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:g3beige + :avocado: tags=accel:tcg """ + # TODO: g3beige works with kvm_pr but we don't have a + # reliable way ATM (e.g. looking at /proc/modules) to detect + # whether we're running kvm_hv or kvm_pr. For now let's + # disable this test if we don't have TCG support. + self.require_accelerator("tcg") tar_hash = 'e0b872a5eb8fdc5bed19bd43ffe863900ebcedfc' self.vm.add_args('-M', 'graphics=off') self.do_test_advcal_2018('15', tar_hash, 'invaders.elf')
Signature · 1 line
2.34.1
[PULL 05/20] avocado/replay_kernel.py: make tcg-icount check in run_vm()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
The icount framework relies on TCG availability. If QEMU is built with --disable-tcg we won't have icount either, and then this test will fail with the following message in an IBM POWER9 host:
tests/avocado/replay_kernel.py:ReplayKernelNormal.test_ppc64_pseries:
ERROR: ConnectError: Failed to establish session:
(...) /11-tests_avocado_replay_kernel.py_ReplayKernelNormal.test_ppc64_pseries/replay.bin:
cannot configure icount, TCG support not available
Although this was revealed in a specific ppc64 scenario, the TCG check is being done in the common code inside run_vm() because all archs need TCG to have access to icount.
Message-Id: <[email protected]>
--- tests/avocado/replay_kernel.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/avocado/replay_kernel.py +4 -0
@@ -36,6 +36,9 @@ class ReplayKernelBase(LinuxKernelTest): def run_vm(self, kernel_path, kernel_command_line, console_pattern, record, shift, args, replay_path): + # icount requires TCG to be available + self.require_accelerator('tcg') + logger = logging.getLogger('replay') start_time = time.time() vm = self.get_vm()
@@ -243,6 +246,7 @@ def test_ppc64_pseries(self): """ :avocado: tags=arch:ppc64 :avocado: tags=machine:pseries + :avocado: tags=accel:tcg """ kernel_url = ('https://archives.fedoraproject.org/pub/archive' '/fedora-secondary/releases/29/Everything/ppc64le/os'
Signature · 1 line
2.34.1
[PULL 04/20] avocado/boot_linux_console.py: check tcg accel in test_ppc64_e500
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
Some ppc64 hosts (e.g. IBM POWER hosts) aren't able to run the e500 machine using KVM accel. Skip this test if TCG accel isn't available.
Message-Id: <[email protected]>
--- tests/avocado/boot_linux_console.py | 2 ++ 1 file changed, 2 insertions(+)
tests/avocado/boot_linux_console.py +2 -0
@@ -1165,7 +1165,9 @@ def test_ppc64_e500(self): :avocado: tags=arch:ppc64 :avocado: tags=machine:ppce500 :avocado: tags=cpu:e5500 + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") tar_hash = '6951d86d644b302898da2fd701739c9406527fe1' self.do_test_advcal_2018('19', tar_hash, 'uImage')
Signature · 1 line
2.34.1
[PULL 08/20] avocado/ppc_405.py: remove test_ppc_taihu()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
Running this test gives us a deprecation warning telling that this machine type is no longer supported:
Output: qemu-system-ppc: Machine type 'taihu' is deprecated:
incomplete, use 'ref405ep' instead
Moreover, this test fails to pass running in an IBM POWER host when building QEMU with --disable-tcg.
Since the machine type is already being considered deprecated let's not bother fixing the test with --disable-tcg. Remove test_ppc_taihu().
Message-Id: <[email protected]>
--- tests/avocado/ppc_405.py | 8 -------- 1 file changed, 8 deletions(-)
tests/avocado/ppc_405.py +0 -8
@@ -25,14 +25,6 @@ def do_test_ppc405(self): wait_for_console_pattern(self, 'AMCC PPC405EP Evaluation Board') exec_command_and_wait_for_pattern(self, 'reset', 'AMCC PowerPC 405EP') - def test_ppc_taihu(self): - """ - :avocado: tags=arch:ppc - :avocado: tags=machine:taihu - :avocado: tags=cpu:405ep - """ - self.do_test_ppc405() - def test_ppc_ref405ep(self): """ :avocado: tags=arch:ppc
Signature · 1 line
2.34.1
[PULL 12/20] avocado/ppc_mpc8544ds.py: check TCG accel in test_ppc_mpc8544ds()
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
This tests times out in an IBM POWER host when compiled with --disable-tcg.
Message-Id: <[email protected]>
--- tests/avocado/ppc_mpc8544ds.py | 2 ++ 1 file changed, 2 insertions(+)
tests/avocado/ppc_mpc8544ds.py +2 -0
@@ -19,7 +19,9 @@ def test_ppc_mpc8544ds(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:mpc8544ds + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") tar_url = ('https://www.qemu-advent-calendar.org' '/2020/download/day17.tar.gz') tar_hash = '7a5239542a7c4257aa4d3b7f6ddf08fb6775c494'
Signature · 1 line
2.34.1
[PULL 18/20] ppc/pnv: Introduce a pnv-phb5 device to match root port
In reply to Cédric Le GoaterFrom: Frederic Barrat <[email protected]>
We already have the pnv-phb3 and pnv-phb4 devices for POWER8 and POWER9 respectively. POWER10 uses version 5 of the PHB. It is very close to the PHB4 from POWER9, at least in our model and we could almost keep using the PHB4 model. However the matching root port pnv-phb5-root-port is specific to POWER10 so to avoid confusion as well as making it easy to introduce differences later, we create a pnv-phb5 class, which is mostly an alias for pnv-phb4 for now.
With this patch, the command line for a user-created PHB on powernv10 becomes:
-machine powernv10 -nodefaults -device pnv-phb5 -device pnv-phb5-root-port
Message-Id: <[email protected]>
--- include/hw/pci-host/pnv_phb4.h | 5 +++++ hw/pci-host/pnv_phb4.c | 7 +++++++ hw/pci-host/pnv_phb4_pec.c | 9 +++++---- 3 files changed, 17 insertions(+), 4 deletions(-)
include/hw/pci-host/pnv_phb4.h +5 -0
@@ -203,6 +203,7 @@ struct PnvPhb4PecClass {const char *stk_compat;int stk_compat_size;uint64_t version; +const char *phb_type;const uint32_t *num_phbs;const char *rp_model; };
@@ -211,6 +212,10 @@ struct PnvPhb4PecClass {* POWER10 definitions */ +#define TYPE_PNV_PHB5 "pnv-phb5" +#define PNV_PHB5 (obj) \ + OBJECT_CHECK(PnvPhb4, (obj), TYPE_PNV_PHB5) +#define PNV_PHB5_VERSION 0x000000a500000001ull#define PNV_PHB5_DEVICE_ID 0x0652
hw/pci-host/pnv_phb4.c +7 -0
@@ -1783,6 +1783,12 @@ static const TypeInfo pnv_phb4_type_info = { } }; +static const TypeInfo pnv_phb5_type_info = { + .name =TYPE_PNV_PHB5 , + .parent =TYPE_PNV_PHB4 , + .instance_size =sizeof (PnvPHB4), +}; +static void pnv_phb4_root_bus_class_init (ObjectClass *klass,void *data) {BusClass *k =BUS_CLASS (klass);
@@ -1907,6 +1913,7 @@ static void pnv_phb4_register_types(void)type_register_static (&pnv_phb5_root_port_info);type_register_static (&pnv_phb4_root_port_info);type_register_static (&pnv_phb4_type_info); +type_register_static (&pnv_phb5_type_info);type_register_static (&pnv_phb4_iommu_memory_region_info); }
hw/pci-host/pnv_phb4_pec.c +5 -4
@@ -116,7 +116,8 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec,int stack_no, Error **errp) { - PnvPHB4 *phb = PNV_PHB4(qdev_new(TYPE_PNV_PHB4)); + PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec); +PnvPHB4 *phb =PNV_PHB4 (qdev_new (pecc->phb_type));int phb_id =pnv_phb4_pec_get_phb_id (pec, stack_no); object_property_set_link(OBJECT(phb), "pec", OBJECT(pec),
@@ -131,9 +132,7 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, }/* Add a single Root port if running with defaults */ -pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), -PNV_PHB4_PEC_GET_CLASS (pec)->rp_model); - +pnv_phb_attach_root_port (PCI_HOST_BRIDGE (phb), pecc->rp_model); }static void pnv_pec_realize (DeviceState *dev,Error **errp)
@@ -265,6 +264,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data) pecc->stk_compat = stk_compat; pecc->stk_compat_size =sizeof (stk_compat); pecc->version =PNV_PHB4_VERSION ; + pecc->phb_type =TYPE_PNV_PHB4 ; pecc->num_phbs = pnv_pec_num_phbs; pecc->rp_model =TYPE_PNV_PHB4_ROOT_PORT ; }
@@ -317,6 +317,7 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass, void *data) pecc->stk_compat = stk_compat; pecc->stk_compat_size =sizeof (stk_compat); pecc->version =PNV_PHB5_VERSION ; + pecc->phb_type =TYPE_PNV_PHB5 ; pecc->num_phbs = pnv_phb5_pec_num_stacks; pecc->rp_model =TYPE_PNV_PHB5_ROOT_PORT ; }
Signature · 1 line
2.34.1
[PULL 13/20] avocado/ppc_prep_40p.py: check TCG accel in all tests
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
All tests in the file times out when running in an IBM POWER host and --disable-tcg with an error like the following:
Command: ./qemu-system-ppc -display none -vga none (...)
-machine 40p (...)
Output: qemu-system-ppc: Register sync failed... If you're using
kvm-hv.ko, only "-cpu host" is possible
qemu-system-ppc: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
Since we don't have a way to detect whether the host is running kvm_hv or kvm_pr, skip all tests if TCG is not available.
Message-Id: <[email protected]>
--- tests/avocado/ppc_prep_40p.py | 6 ++++++ 1 file changed, 6 insertions(+)
tests/avocado/ppc_prep_40p.py +6 -0
@@ -28,7 +28,9 @@ def test_factory_firmware_and_netbsd(self): :avocado: tags=machine:40p :avocado: tags=os:netbsd :avocado: tags=slowness:high + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") bios_url = ('http://ftpmirror.your.org/pub/misc/' 'ftp.software.ibm.com/rs6000/firmware/' '7020-40p/P12H0456.IMG')
@@ -51,7 +53,9 @@ def test_openbios_192m(self): """ :avocado: tags=arch:ppc :avocado: tags=machine:40p + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.add_args('-m', '192') # test fw_cfg
@@ -65,7 +69,9 @@ def test_openbios_and_netbsd(self): :avocado: tags=arch:ppc :avocado: tags=machine:40p :avocado: tags=os:netbsd + :avocado: tags=accel:tcg """ + self.require_accelerator("tcg") drive_url = ('https://archive.netbsd.org/pub/NetBSD-archive/' 'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso') drive_hash = 'ac6fa2707d888b36d6fa64de6e7fe48e'
Signature · 1 line
2.34.1
[PULL 17/20] ppc/xive2: Make type Xive2EndSource not user creatable
In reply to Cédric Le GoaterXive2EndSource objects can only be instantiated through a Xive2Router (PnvXive2).
--- hw/intc/xive2.c | 1 + 1 file changed, 1 insertion(+)
hw/intc/xive2.c +1 -0
@@ -1000,6 +1000,7 @@ static void xive2_end_source_class_init(ObjectClass *klass, void *data) dc->desc ="XIVE END Source" ;device_class_set_props (dc, xive2_end_source_properties); dc->realize = xive2_end_source_realize; + dc->user_creatable = false; }static const TypeInfo xive2_end_source_info = {
Signature · 1 line
2.34.1
[PULL 10/20] avocado/ppc_74xx.py: check TCG accel for all tests
In reply to Cédric Le GoaterFrom: Daniel Henrique Barboza <[email protected]>
All tests of this file, when running in an IBM POWER host and with --disable-tcg, fail in a similar manner:
Command: ./qemu-system-ppc -display none -vga none (...)
-cpu 7400 (...)
Output: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument
PPC KVM module is not loaded. Try modprobe kvm_pr.
qemu-system-ppc: failed to initialize kvm: Invalid argument
We don't have a way of telling which KVM module is loaded in a Power host (kvm_hv or kvm_pr). For now let's make all the tests of this file depend on TCG support.
Message-Id: <[email protected]>
--- tests/avocado/ppc_74xx.py | 13 +++++++++++++ 1 file changed, 13 insertions(+)
tests/avocado/ppc_74xx.py +13 -0
@@ -11,6 +11,7 @@ class ppc74xxCpu(QemuSystemTest): """ :avocado: tags=arch:ppc + :avocado: tags=accel:tcg """ timeout = 5
@@ -18,6 +19,7 @@ def test_ppc_7400(self): """ :avocado: tags=cpu:7400 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -27,6 +29,7 @@ def test_ppc_7410(self): """ :avocado: tags=cpu:7410 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -36,6 +39,7 @@ def test_ppc_7441(self): """ :avocado: tags=cpu:7441 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -45,6 +49,7 @@ def test_ppc_7445(self): """ :avocado: tags=cpu:7445 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -54,6 +59,7 @@ def test_ppc_7447(self): """ :avocado: tags=cpu:7447 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -63,6 +69,7 @@ def test_ppc_7447a(self): """ :avocado: tags=cpu:7447a """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -72,6 +79,7 @@ def test_ppc_7448(self): """ :avocado: tags=cpu:7448 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -81,6 +89,7 @@ def test_ppc_7450(self): """ :avocado: tags=cpu:7450 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -90,6 +99,7 @@ def test_ppc_7451(self): """ :avocado: tags=cpu:7451 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -99,6 +109,7 @@ def test_ppc_7455(self): """ :avocado: tags=cpu:7455 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -108,6 +119,7 @@ def test_ppc_7457(self): """ :avocado: tags=cpu:7457 """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
@@ -117,6 +129,7 @@ def test_ppc_7457a(self): """ :avocado: tags=cpu:7457a """ + self.require_accelerator("tcg") self.vm.set_console() self.vm.launch() wait_for_console_pattern(self, '>> OpenBIOS')
Signature · 1 line
2.34.1
[PULL 16/20] target/ppc: fix xxspltw for big endian hosts
In reply to Cédric Le GoaterFrom: Matheus Ferst <[email protected]>
Fix a typo in the host endianness macro and add a simple test to detect regressions.
Message-Id: <[email protected]>
--- tests/tcg/ppc64le/xxspltw.c | 46 +++++++++++++++++++++++++++++ target/ppc/translate/vsx-impl.c.inc | 2 +- tests/tcg/ppc64/Makefile.target | 1 + tests/tcg/ppc64le/Makefile.target | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/ppc64le/xxspltw.c
tests/tcg/ppc64le/xxspltw.c new file +46 -0
@@ -0,0 +1,46 @@ +#include <stdio.h> +#include <stdint.h> +#include <inttypes.h> +#include <assert.h> + +#define WORD_A 0xAAAAAAAAUL +#define WORD_B 0xBBBBBBBBUL +#define WORD_C 0xCCCCCCCCUL +#define WORD_D 0xDDDDDDDDUL + +#define DWORD_HI (WORD_A << 32 | WORD_B) +#define DWORD_LO (WORD_C << 32 | WORD_D) + +#define TEST (HI ,LO ,UIM ,RES ) \ + do { \ + union { \ + uint64_t u; \ + double f; \ + } h = { .u = HI }, l = { .u = LO }; \ +/* \ +* Use a pair of FPRs to load the VSR avoiding insns \ +* newer than xxswapd. \ +*/ \ + asm("xxmrghd 32, %0, %1\n\t" \ +"xxspltw 32, 32, %2\n\t" \ +"xxmrghd %0, 32, %0\n\t" \ +"xxswapd 32, 32\n\t" \ +"xxmrghd %1, 32, %1\n\t" \ + :"+f" (h.f),"+f" (l.f) \ + :"i" (UIM ) \ + :"v0" ); \ +printf ("xxspltw(0x%016" PRIx64"%016" PRIx64", %d) =" \ +" %016" PRIx64"%016" PRIx64"\n" ,HI ,LO ,UIM , \ + h.u, l.u); \ +assert (h.u == (RES )); \ +assert (l.u == (RES )); \ + }while (0 ) + +int main(void) +{ +TEST (DWORD_HI ,DWORD_LO ,0 ,WORD_A <<32 |WORD_A ); +TEST (DWORD_HI ,DWORD_LO ,1 ,WORD_B <<32 |WORD_B ); +TEST (DWORD_HI ,DWORD_LO ,2 ,WORD_C <<32 |WORD_C ); +TEST (DWORD_HI ,DWORD_LO ,3 ,WORD_D <<32 |WORD_D ); +return 0 ; +}
target/ppc/translate/vsx-impl.c.inc +1 -1
@@ -1552,7 +1552,7 @@ static bool trans_XXSPLTW(DisasContext *ctx, arg_XX2_uim2 *a) tofs = vsr_full_offset(a->xt); bofs = vsr_full_offset(a->xb); bofs += a->uim << MO_32; -#ifndef HOST_WORDS_BIG_ENDIAN +#ifndef HOST_WORDS_BIGENDIAN bofs ^= 8 | 4; #endif
tests/tcg/ppc64/Makefile.target +1 -0
@@ -27,5 +27,6 @@ run-sha512-vector: QEMU_OPTS+=-cpu POWER10 run-plugin-sha512-vector-with-%: QEMU_OPTS+=-cpu POWER10 PPC64_TESTS += signal_save_restore_xer +PPC64_TESTS += xxspltw TESTS += $(PPC64_TESTS)
tests/tcg/ppc64le/Makefile.target +1 -0
@@ -25,5 +25,6 @@ run-plugin-sha512-vector-with-%: QEMU_OPTS+=-cpu POWER10 PPC64LE_TESTS += mtfsf PPC64LE_TESTS += signal_save_restore_xer +PPC64LE_TESTS += xxspltw TESTS += $(PPC64LE_TESTS)
Signature · 1 line
2.34.1
Peter Maydell
AppliedQuoted 11 lines · Cédric Le Goater
The following changes since commit
1416688c53be6535be755b44c15fb2eb9defd20f:Merge remote-tracking branch 'remotes/mcayland/tags/q800-updates-for-7.0-20220309' into staging (2022-03-10 13:16:37 +0000)
are available in the Git repository at:
https://github.com/legoater/qemu/ tags/pull-ppc-20220314
for you to fetch changes up to
9c10d86fee11d96274ea6f7cda12d2471abe3c47:
Quoted 9 lines
ppc/pnv: Remove user-created PHB{3,4,5} devices (2022-03-14 15:57:17 +0100)
----------------------------------------------------------------
ppc-7.0 queue :* Removal of user-created PHB devices
* Avocado fixes for --disable-tcg
* Instruction and Radix MMU fixes
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.
-- PMM