qtest: enable several tests for ppc64
v2 cover qtest: enable several tests for ppc64
This series enables some tests existing for i386 and which can also work on ppc64.
VGA tests and netfilter tests are trivial, but ivshmem test needs to enable the SPAPR PCI framework. We also fix a bug in qpci_map() for SPAPR, where the PCI base is not correctly set in the CPU address space.
v2:
- extract ivshmem conversion to libqos and
update log message
Laurent Vivier (5):
qtest: add netfilter tests for ppc64
qtest: add display-vga-test to ppc64
libqos: fix spapr qpci_map()
qtest: convert ivshmem-test to use libqos
qtest: add ivshmem-test for ppc64
tests/Makefile.include | 7 ++++++- tests/display-vga-test.c | 7 ++++++- tests/ivshmem-test.c | 46 +++++++++++++++++++++++++++++----------------- tests/libqos/pci-spapr.c | 4 ++-- 4 files changed, 43 insertions(+), 21 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/5 qtest: add netfilter tests for ppc64
--- tests/Makefile.include | 3 +++ 1 file changed, 3 insertions(+)
tests/Makefile.include +3 -0
@@ -284,6 +284,9 @@ gcov-files-ppc64-y += hw/usb/hcd-uhci.c check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-xhci.c check-qtest-ppc64-y += $(check-qtest-virtio-y) +check-qtest-ppc64-y += tests/test-netfilter$(EXESUF) +check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF) +check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF) check-qtest-sh4-y = tests/endianness-test$(EXESUF)
Signature · 1 line
2.7.4
PATCH v2 2/5 qtest: add display-vga-test to ppc64
In reply to Laurent VivierOnly enable for ppc64 in the Makefile, but added code in the file to check cirrus card only on architectures supporting it (alpha, mips, i386, x86_64).
--- tests/Makefile.include | 1 + tests/display-vga-test.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
tests/Makefile.include +1 -0
@@ -287,6 +287,7 @@ check-qtest-ppc64-y += $(check-qtest-virtio-y) check-qtest-ppc64-y += tests/test-netfilter$(EXESUF) check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF) check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF) +check-qtest-ppc64-y += tests/display-vga-test$(EXESUF) check-qtest-sh4-y = tests/endianness-test$(EXESUF)
tests/display-vga-test.c +6 -1
@@ -50,9 +50,14 @@ static void pci_virtio_vga(void)int main (int argc,char **argv) { +const char *arch =qtest_get_arch (); +g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/display/pci/cirrus" , pci_cirrus); +if (strcmp (arch,"alpha" ) ==0 ||strcmp (arch,"i386" ) ==0 || +strcmp (arch,"mips" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { +qtest_add_func ("/display/pci/cirrus" , pci_cirrus); + }qtest_add_func ("/display/pci/stdvga" , pci_stdvga);qtest_add_func ("/display/pci/secondary" , pci_secondary);qtest_add_func ("/display/pci/multihead" , pci_multihead);
Signature · 1 line
2.7.4
PATCH v2 3/5 libqos: fix spapr qpci_map()
In reply to Laurent Vivier--- tests/libqos/pci-spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/libqos/pci-spapr.c +2 -2
@@ -193,8 +193,8 @@ QPCIBus *qpci_init_spapr(QGuestAllocator *alloc) ret->pio.size =SPAPR_PCI_IO_WIN_SIZE ;/* 32-bit portion of the MMIO window is at PCI address 2..4 GiB */ - ret->mmio32_cpu_base =SPAPR_PCI_BASE +SPAPR_PCI_MMIO32_WIN_SIZE ; - ret->mmio32.pci_base =0x80000000 ;/* 2 GiB */ + ret->mmio32_cpu_base =SPAPR_PCI_BASE ; + ret->mmio32.pci_base =SPAPR_PCI_MMIO32_WIN_SIZE ; ret->mmio32.size =SPAPR_PCI_MMIO32_WIN_SIZE ; ret->bus.pio_alloc_ptr =0xc000 ;
Signature · 1 line
2.7.4
PATCH v2 4/5 qtest: convert ivshmem-test to use libqos
In reply to Laurent VivierThis will allow to use it with ppc64.
--- tests/ivshmem-test.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
tests/ivshmem-test.c +17 -14
@@ -11,7 +11,7 @@#include "qemu/osdep.h" #include <glib/gstdio.h> #include "contrib/ivshmem-server/ivshmem-server.h" -#include "libqos/pci-pc.h" +#include "libqos/libqos-pc.h" #include "libqtest.h" #include "qemu-common.h"
@@ -40,9 +40,8 @@ static QPCIDevice *get_device(QPCIBus *pcibus) }typedef struct _IVState { -QTestState *qtest; +QOSState *qs;QPCIBar reg_bar, mem_bar; -QPCIBus *pcibus;QPCIDevice *dev; }IVState ;
@@ -74,7 +73,7 @@ static inline unsigned in_reg(IVState *s, enum Reg reg)QTestState *qtest = global_qtest;unsigned res; - global_qtest = s->qtest; + global_qtest = s->qs->qts; res =qpci_io_readl (s->dev, s->reg_bar, reg);g_test_message ("*%s -> %x\n" , name, res); global_qtest = qtest;
@@ -87,7 +86,7 @@ static inline void out_reg(IVState *s, enum Reg reg, unsigned v)const char *name =reg2str (reg);QTestState *qtest = global_qtest; - global_qtest = s->qtest; + global_qtest = s->qs->qts;g_test_message ("%x -> *%s\n" , v, name);qpci_io_writel (s->dev, s->reg_bar, reg, v); global_qtest = qtest;
@@ -97,7 +96,7 @@ static inline void read_mem(IVState *s, uint64_t off, void *buf, size_t len) {QTestState *qtest = global_qtest; - global_qtest = s->qtest; + global_qtest = s->qs->qts;qpci_memread (s->dev, s->mem_bar, off, buf, len); global_qtest = qtest; }
@@ -107,7 +106,7 @@ static inline void write_mem(IVState *s, uint64_t off, {QTestState *qtest = global_qtest; - global_qtest = s->qtest; + global_qtest = s->qs->qts;qpci_memwrite (s->dev, s->mem_bar, off, buf, len); global_qtest = qtest; }
@@ -115,17 +114,21 @@ static inline void write_mem(IVState *s, uint64_t off,static void cleanup_vm (IVState *s) {g_free (s->dev); -qpci_free_pc (s->pcibus); -qtest_quit (s->qtest); +qtest_shutdown (s->qs); }static void setup_vm_cmd (IVState *s,const char *cmd,bool msix) {uint64_t barsize; +const char *arch =qtest_get_arch (); - s->qtest =qtest_start (cmd); - s->pcibus =qpci_init_pc (NULL ); - s->dev =get_device (s->pcibus); +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { + s->qs =qtest_pc_boot (cmd); + }else { +g_printerr ("ivshmem-test tests are only available on x86\n" ); +exit (EXIT_FAILURE ); + } + s->dev =get_device (s->qs->pcibus); s->reg_bar =qpci_iomap (s->dev,0 , &barsize); g_assert_cmpuint(barsize, ==, 256);
@@ -347,7 +350,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpint(vm1, !=, vm2);/* check number of MSI-X vectors */ - global_qtest = s1->qtest; + global_qtest = s1->qs->qts;if (msi) { ret =qpci_msix_table_size (s1->dev); g_assert_cmpuint(ret, ==, nvectors);
@@ -370,7 +373,7 @@ static void test_ivshmem_server(bool msi) g_assert_cmpuint(ret, !=, 0);/* ping vm1 -> vm2 on vector 1 */ - global_qtest = s2->qtest; + global_qtest = s2->qs->qts;if (msi) { ret =qpci_msix_pending (s2->dev,1 ); g_assert_cmpuint(ret, ==, 0);
Signature · 1 line
2.7.4
PATCH v2 5/5 qtest: add ivshmem-test for ppc64
In reply to Laurent VivierThe test has been converted to use libqos, we can now use it on ppc64. We also make the test fail on all other architectures.
As libqos on ppc64 is not able to manage hotplug and IRQ/MSI, we disable this part in the test on ppc64.
--- tests/Makefile.include | 3 ++- tests/ivshmem-test.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-)
tests/Makefile.include +2 -1
@@ -288,6 +288,7 @@ check-qtest-ppc64-y += tests/test-netfilter$(EXESUF) check-qtest-ppc64-y += tests/test-filter-mirror$(EXESUF) check-qtest-ppc64-y += tests/test-filter-redirector$(EXESUF) check-qtest-ppc64-y += tests/display-vga-test$(EXESUF) +check-qtest-ppc64-y += tests/ivshmem-test$(EXESUF) check-qtest-sh4-y = tests/endianness-test$(EXESUF)
@@ -692,7 +693,7 @@ tests/test-netfilter$(EXESUF): tests/test-netfilter.o $(qtest-obj-y) tests/test-filter-mirror$(EXESUF): tests/test-filter-mirror.o $(qtest-obj-y) tests/test-filter-redirector$(EXESUF): tests/test-filter-redirector.o $(qtest-obj-y) tests/test-x86-cpuid-compat$(EXESUF): tests/test-x86-cpuid-compat.o $(qtest-obj-y) -tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/ivshmem-server.o $(libqos-pc-obj-y) +tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/ivshmem-server.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y) tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y) tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
tests/ivshmem-test.c +13 -4
@@ -12,6 +12,7 @@#include <glib/gstdio.h> #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/libqos-pc.h" +#include "libqos/libqos-spapr.h" #include "libqtest.h" #include "qemu-common.h"
@@ -124,8 +125,10 @@ static void setup_vm_cmd(IVState *s, const char *cmd, bool msix)if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { s->qs =qtest_pc_boot (cmd); + }else if (strcmp (arch,"ppc64" ) ==0 ) { + s->qs =qtest_spapr_boot (cmd); }else { -g_printerr ("ivshmem-test tests are only available on x86\n" ); +g_printerr ("ivshmem-test tests are only available on x86 or ppc64\n" );exit (EXIT_FAILURE ); } s->dev =get_device (s->qs->pcibus);
@@ -415,6 +418,7 @@ static void test_ivshmem_server_irq(void)static void test_ivshmem_hotplug (void ) { +const char *arch =qtest_get_arch ();gchar *opts;qtest_start ("" );
@@ -422,7 +426,9 @@ static void test_ivshmem_hotplug(void) opts =g_strdup_printf ("'shm': '%s', 'size': '1M'" , tmpshm);qpci_plug_device_test ("ivshmem" ,"iv1" ,PCI_SLOT_HP , opts); -qpci_unplug_acpi_device_test ("iv1" ,PCI_SLOT_HP ); +if (strcmp (arch,"ppc64" ) !=0 ) { +qpci_unplug_acpi_device_test ("iv1" ,PCI_SLOT_HP ); + }qtest_end ();g_free (opts);
@@ -494,6 +500,7 @@ static gchar *mktempshm(int size, int *fd)int main (int argc,char **argv) {int ret, fd; +const char *arch =qtest_get_arch ();gchar dir[] ="/tmp/ivshmem-test.XXXXXX" ;#if !GLIB_CHECK_VERSION (2 ,31 ,0 )
@@ -524,8 +531,10 @@ int main(int argc, char **argv)qtest_add_func ("/ivshmem/memdev" , test_ivshmem_memdev);if (g_test_slow ()) {qtest_add_func ("/ivshmem/pair" , test_ivshmem_pair); -qtest_add_func ("/ivshmem/server-msi" , test_ivshmem_server_msi); -qtest_add_func ("/ivshmem/server-irq" , test_ivshmem_server_irq); +if (strcmp (arch,"ppc64" ) !=0 ) { +qtest_add_func ("/ivshmem/server-msi" , test_ivshmem_server_msi); +qtest_add_func ("/ivshmem/server-irq" , test_ivshmem_server_irq); + } } ret =g_test_run ();
Signature · 1 line
2.7.4
David Gibson
AppliedQuoted 7 lines · Laurent Vivier
This series enables some tests existing for i386 and which can also work on ppc64.
VGA tests and netfilter tests are trivial, but ivshmem test needs to enable the SPAPR PCI framework. We also fix a bug in
qpci_map()for SPAPR, where the PCI base is not correctly set in the CPU address space.
Applied to ppc-for-2.9 (replacing the earlier version that was in there).
Quoted 18 lines
v2:
- extract ivshmem conversion to libqos and
update log messageLaurent Vivier (5):
qtest: add netfilter tests for ppc64
qtest: add display-vga-test to ppc64
libqos: fix spaprqpci_map()
qtest: convert ivshmem-test to use libqos
qtest: add ivshmem-test for ppc64tests/Makefile.include | 7 ++++++- tests/display-vga-test.c | 7 ++++++- tests/ivshmem-test.c | 46 +++++++++++++++++++++++++++++----------------- tests/libqos/pci-spapr.c | 4 ++-- 4 files changed, 43 insertions(+), 21 deletions(-)
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