qtest: converted sdhci-test and most nop test to qgraph framework
cover qtest: converted sdhci-test and most nop test to qgraph framework
This series continues the QEMU tests conversion using the qgraph framework started in the previous series.
Add the missing machines required to complete the sdhci-test started previously, and convert most of the nop tests.
Based-on: [email protected]
Emanuele Giuseppe Esposito (16):
test/qgraph: arm/smdkc210 machine node
test/qgraph: arm/sabrelite machine node
test/qgraph: arm/xlinx-zynq-a9 machine node
test/qgraph: aarch64/xlnx-zcu102 machine node
test/qgraph: ac97 test node
test/qgraph: tpci200 test node
test/qgraph: ipoctal232 test node
test/qgraph: ne2k_pci test node
test/qgraph: nvme test node
test/qgraph: pcnet test node
test/qgraph: spapr-phb test node
test/qgraph: usb-hcd-ohci test node
test/qgraph: vmxnet3 test node
test/qgraph: es1370 test node
test/qgraph: eepro100 test node
test/qgraph: e1000 test node
tests/Makefile.include | 48 +++++++-------- tests/ac97-test.c | 39 ++++++++++--- tests/e1000-test.c | 60 ++++++++++++------- tests/eepro100-test.c | 61 ++++++++++++------- tests/es1370-test.c | 39 ++++++++++--- tests/ipoctal232-test.c | 42 +++++++++++--- tests/libqos/sabrelite-machine.c | 82 ++++++++++++++++++++++++++ tests/libqos/smdkc210-machine.c | 82 ++++++++++++++++++++++++++ tests/libqos/xilinx-zynq-a9-machine.c | 84 +++++++++++++++++++++++++++ tests/libqos/xlnx-zcu102-machine.c | 83 ++++++++++++++++++++++++++ tests/ne2000-test.c | 39 ++++++++++--- tests/nvme-test.c | 43 ++++++++++---- tests/pcnet-test.c | 39 ++++++++++--- tests/sdhci-test.c | 49 ---------------- tests/spapr-phb-test.c | 28 ++++----- tests/tpci200-test.c | 60 ++++++++++++++++--- tests/usb-hcd-ohci-test.c | 46 +++++++++++---- tests/vmxnet3-test.c | 39 ++++++++++--- 18 files changed, 744 insertions(+), 219 deletions(-) create mode 100644 tests/libqos/sabrelite-machine.c create mode 100644 tests/libqos/smdkc210-machine.c create mode 100644 tests/libqos/xilinx-zynq-a9-machine.c create mode 100644 tests/libqos/xlnx-zcu102-machine.c
Signature · 1 line
2.17.1
PATCH 1/16 test/qgraph: arm/smdkc210 machine node
Add arm/smdkc210 machine machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
--- tests/Makefile.include | 9 ++-- tests/libqos/smdkc210-machine.c | 82 +++++++++++++++++++++++++++++++++ tests/sdhci-test.c | 7 +-- 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 tests/libqos/smdkc210-machine.c
tests/Makefile.include +6 -3
@@ -756,10 +756,13 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o -libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o -libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o +libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o + +libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) +libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o -libqgraph-machines-obj-y += tests/libqos/virt-machine.o libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
tests/libqos/smdkc210-machine.c new file +82 -0
82 lines not on this page · raw message
tests/sdhci-test.c +4 -3
@@ -51,12 +51,13 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ BCM2835 { "arm", "raspi2", {0x3f300000, 3, 52, {0, 0x052134b4} } }, - * - * FIXME: the following drivers are missing: - * + Exynos4210 { "arm", "smdkc210", {0x12510000, 2, 0, {1, 0x5e80080} } }, + * + * FIXME: the following drivers are missing: + * i.MX 6 { "arm", "sabrelite",
Signature · 1 line
2.17.1
PATCH 2/16 test/qgraph: arm/sabrelite machine node
In reply to Emanuele Giuseppe EspositoAdd arm/sabrelite machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
--- tests/Makefile.include | 1 + tests/libqos/sabrelite-machine.c | 82 ++++++++++++++++++++++++++++++++ tests/sdhci-test.c | 7 +-- 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 tests/libqos/sabrelite-machine.c
tests/Makefile.include +1 -0
@@ -759,6 +759,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/sabrelite-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o
tests/libqos/sabrelite-machine.c new file +82 -0
82 lines not on this page · raw message
tests/sdhci-test.c +4 -3
@@ -55,14 +55,15 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ Exynos4210 { "arm", "smdkc210", {0x12510000, 2, 0, {1, 0x5e80080} } }, - * - * FIXME: the following drivers are missing: - * i.MX 6 { "arm", "sabrelite", {0x02190000, 3, 0, {1, 0x057834b4} } }, + * + * FIXME: the following drivers are missing: + * + Zynq-7000 { "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1) {0xe0100000, 2, 0, {1, 0x69ec0080} } },
Signature · 1 line
2.17.1
PATCH 3/16 test/qgraph: arm/xlinx-zynq-a9 machine node
In reply to Emanuele Giuseppe EspositoAdd xlinx-zynq-a9 machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
--- tests/Makefile.include | 1 + tests/libqos/xilinx-zynq-a9-machine.c | 84 +++++++++++++++++++++++++++ tests/sdhci-test.c | 8 +-- 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/libqos/xilinx-zynq-a9-machine.c
tests/Makefile.include +1 -0
@@ -760,6 +760,7 @@ libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o libqgraph-arm-machines-obj-y += tests/libqos/sabrelite-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o
tests/libqos/xilinx-zynq-a9-machine.c new file +84 -0
84 lines not on this page · raw message
tests/sdhci-test.c +4 -4
@@ -60,14 +60,14 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ {"arm" ,"sabrelite" , {0x02190000, 3, 0, {1, 0x057834b4} } }, - * - * FIXME: the following drivers are missing: - * - Zynq-7000 { "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1) {0xe0100000, 2, 0, {1, 0x69ec0080} } }, + * + * FIXME: the following drivers are missing: + * + ZynqMP { "aarch64", "xlnx-zcu102", Datasheet: UG1085 (v1.7) {0xff160000, 3, 0, {1, 0x280737ec6481} } },
Signature · 1 line
2.17.1
PATCH 4/16 test/qgraph: aarch64/xlnx-zcu102 machine node
In reply to Emanuele Giuseppe EspositoAdd xlnx-zcu102 machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
--- tests/Makefile.include | 1 + tests/libqos/xlnx-zcu102-machine.c | 83 ++++++++++++++++++++++++++++++ tests/sdhci-test.c | 51 ------------------ 3 files changed, 84 insertions(+), 51 deletions(-) create mode 100644 tests/libqos/xlnx-zcu102-machine.c
tests/Makefile.include +1 -0
@@ -765,6 +765,7 @@ libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o +libqgraph-machines-obj-y += tests/libqos/xlnx-zcu102-machine.o libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
tests/libqos/xlnx-zcu102-machine.c new file +83 -0
83 lines not on this page · raw message
tests/sdhci-test.c +0 -51
57 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 6/16 test/qgraph: tpci200 test node
In reply to Emanuele Giuseppe EspositoConvert tests/tpci200-test in qgraph test node, tpci200-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 2 +- tests/tpci200-test.c | 60 +++++++++++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 10 deletions(-)
tests/Makefile.include +1 -1
@@ -792,6 +792,7 @@ libqgraph-tests-obj-y += tests/virtio-blk-test.o libqgraph-tests-obj-y += tests/virtio-net-test.o libqgraph-tests-obj-y += tests/virtio-scsi-test.o libqgraph-tests-obj-y += tests/ac97-test.o +libqgraph-tests-obj-y += tests/tpci200-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -835,7 +836,6 @@ tests/ne2000-test$(EXESUF): tests/ne2000-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o -tests/tpci200-test$(EXESUF): tests/tpci200-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o tests/qom-test$(EXESUF): tests/qom-test.o
tests/tpci200-test.c +51 -9
74 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 5/16 test/qgraph: ac97 test node
In reply to Emanuele Giuseppe EspositoConvert tests/ac97-test in qgraph test node, ac97-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 3 +-- tests/ac97-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -217,7 +217,6 @@ check-qtest-pci-y += tests/ne2000-test$(EXESUF) gcov-files-pci-y += hw/net/ne2000.c check-qtest-pci-y += tests/nvme-test$(EXESUF) gcov-files-pci-y += hw/block/nvme.c -check-qtest-pci-y += tests/ac97-test$(EXESUF) gcov-files-pci-y += hw/audio/ac97.c check-qtest-pci-y += tests/es1370-test$(EXESUF) gcov-files-pci-y += hw/audio/es1370.c
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/virtio-rng-test.o libqgraph-tests-obj-y += tests/virtio-blk-test.o libqgraph-tests-obj-y += tests/virtio-net-test.o libqgraph-tests-obj-y += tests/virtio-scsi-test.o +libqgraph-tests-obj-y += tests/ac97-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -846,7 +846,6 @@ tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y) tests/nvme-test$(EXESUF): tests/nvme-test.o tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o -tests/ac97-test$(EXESUF): tests/ac97-test.o tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
tests/ac97-test.c +30 -9
@@ -9,23 +9,44 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" + +typedef struct QAC97 QAC97 ; + +struct QAC97 { +QOSGraphObject obj; +};/* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop (void ) +static void nop (void *obj,void *data,QGuestAllocator *alloc) +{ +} + +static void ac97_destructor (QOSGraphObject *obj) { +QAC97 *ac97 = (QAC97 *)obj; +g_free (ac97); } -int main (int argc,char **argv) +static void *ac97_create (void *pci_bus,QGuestAllocator *alloc,void *addr) { -int ret; +QAC97 *ac97 =g_new0 (QAC97 ,1 ); + ac97->obj.destructor = ac97_destructor; -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/ac97/nop" , nop); +return &ac97->obj; +} -qtest_start ("-device AC97" ); - ret =g_test_run (); +static void ac97_register_nodes (void ) +{ +qos_node_create_driver ("AC97" , ac97_create); +qos_node_consumes ("AC97" ,"pci-bus" ,NULL ); +} -qtest_end (); +libqos_init (ac97_register_nodes); -return ret; +static void register_ac97_test (void ) +{ +qos_add_test ("ac97-test" ,"AC97" , nop,NULL ); } + +libqos_init (register_ac97_test);
Signature · 1 line
2.17.1
PATCH 7/16 test/qgraph: ipoctal232 test node
In reply to Emanuele Giuseppe EspositoConvert tests/ipoctal232-test in qgraph test node, ipoctal232-test. Since it's a nop test, node creation and initialization is made in the same file.
This test creates a tpci200 node that produces an interface ipack consumed by the ipoctal232 device.
--- tests/Makefile.include | 3 +-- tests/ipoctal232-test.c | 42 ++++++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -184,7 +184,6 @@ gcov-files-generic-y = qdev-monitor.c qmp.c check-qtest-generic-y += tests/cdrom-test$(EXESUF) gcov-files-ipack-y += hw/ipack/ipack.c -check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF) gcov-files-ipack-y += hw/char/ipoctal232.c gcov-files-virtioserial-y += hw/char/virtio-console.c
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/virtio-net-test.o libqgraph-tests-obj-y += tests/virtio-scsi-test.o libqgraph-tests-obj-y += tests/ac97-test.o libqgraph-tests-obj-y += tests/tpci200-test.o +libqgraph-tests-obj-y += tests/ipoctal232-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -837,7 +837,6 @@ tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o -tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o tests/qom-test$(EXESUF): tests/qom-test.o tests/test-hmp$(EXESUF): tests/test-hmp.o tests/machine-none-test$(EXESUF): tests/machine-none-test.o
tests/ipoctal232-test.c +33 -9
56 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 9/16 test/qgraph: nvme test node
In reply to Emanuele Giuseppe EspositoConvert tests/nvme-test in qgraph test node, nvme-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 3 +-- tests/nvme-test.c | 43 ++++++++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 12 deletions(-)
tests/Makefile.include +1 -2
@@ -213,7 +213,6 @@ gcov-files-pci-y += hw/net/pcnet-pci.c check-qtest-pci-y += tests/eepro100-test$(EXESUF) gcov-files-pci-y += hw/net/eepro100.c gcov-files-pci-y += hw/net/ne2000.c -check-qtest-pci-y += tests/nvme-test$(EXESUF) gcov-files-pci-y += hw/block/nvme.c gcov-files-pci-y += hw/audio/ac97.c check-qtest-pci-y += tests/es1370-test$(EXESUF)
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/ac97-test.o libqgraph-tests-obj-y += tests/tpci200-test.o libqgraph-tests-obj-y += tests/ipoctal232-test.o libqgraph-tests-obj-y += tests/ne2000-test.o +libqgraph-tests-obj-y += tests/nvme-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -841,7 +841,6 @@ tests/test-hmp$(EXESUF): tests/test-hmp.o tests/machine-none-test$(EXESUF): tests/machine-none-test.o tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y) tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y) -tests/nvme-test$(EXESUF): tests/nvme-test.o tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o tests/es1370-test$(EXESUF): tests/es1370-test.o
tests/nvme-test.c +33 -10
57 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 8/16 test/qgraph: ne2k_pci test node
In reply to Emanuele Giuseppe EspositoConvert tests/ne2000-test in qgraph test node, ne2000-test. Since it's a nop test, node creation and initialization is made in the same file.
The actual device consumed by the test is ne2k_pci.
--- tests/Makefile.include | 3 +-- tests/ne2000-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -212,7 +212,6 @@ gcov-files-pci-y += hw/net/pcnet.c gcov-files-pci-y += hw/net/pcnet-pci.c check-qtest-pci-y += tests/eepro100-test$(EXESUF) gcov-files-pci-y += hw/net/eepro100.c -check-qtest-pci-y += tests/ne2000-test$(EXESUF) gcov-files-pci-y += hw/net/ne2000.c check-qtest-pci-y += tests/nvme-test$(EXESUF) gcov-files-pci-y += hw/block/nvme.c
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/virtio-scsi-test.o libqgraph-tests-obj-y += tests/ac97-test.o libqgraph-tests-obj-y += tests/tpci200-test.o libqgraph-tests-obj-y += tests/ipoctal232-test.o +libqgraph-tests-obj-y += tests/ne2000-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -832,7 +832,6 @@ tests/pcnet-test$(EXESUF): tests/pcnet-test.o tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o -tests/ne2000-test$(EXESUF): tests/ne2000-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
tests/ne2000-test.c +30 -9
@@ -9,23 +9,44 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" + +typedef struct QNe2k_pci QNe2k_pci ; + +struct QNe2k_pci { +QOSGraphObject obj; +};/* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void pci_nop (void *obj,void *data,QGuestAllocator *alloc) +{ +} + +static void ne2k_pci_destructor (QOSGraphObject *obj) { +QNe2k_pci *ne2k_pci = (QNe2k_pci *)obj; +g_free (ne2k_pci); } -int main (int argc,char **argv) +static void *ne2k_pci_create (void *pci_bus,QGuestAllocator *alloc,void *addr) { -int ret; +QNe2k_pci *ne2k_pci =g_new0 (QNe2k_pci,1 ); + ne2k_pci->obj.destructor = ne2k_pci_destructor; -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/ne2000/pci/nop" , pci_nop); +return &ne2k_pci->obj; +} -qtest_start ("-device ne2k_pci" ); - ret =g_test_run (); +static void ne2000_register_nodes (void ) +{ +qos_node_create_driver ("ne2k_pci" , ne2k_pci_create); +qos_node_consumes ("ne2k_pci" ,"pci-bus" ,NULL ); +} -qtest_end (); +libqos_init (ne2000_register_nodes); -return ret; +static void register_ne2000_test (void ) +{ +qos_add_test ("ne2000-test" ,"ne2k_pci" , pci_nop,NULL ); } + +libqos_init (register_ne2000_test);
Signature · 1 line
2.17.1
PATCH 10/16 test/qgraph: pcnet test node
In reply to Emanuele Giuseppe EspositoConvert tests/pcnet-test in qgraph test node, pcnet-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 3 +-- tests/pcnet-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -207,7 +207,6 @@ gcov-files-pci-y += hw/net/e1000.c gcov-files-pci-y += hw/net/e1000e.c hw/net/e1000e_core.c check-qtest-pci-y += tests/rtl8139-test$(EXESUF) gcov-files-pci-y += hw/net/rtl8139.c -check-qtest-pci-y += tests/pcnet-test$(EXESUF) gcov-files-pci-y += hw/net/pcnet.c gcov-files-pci-y += hw/net/pcnet-pci.c check-qtest-pci-y += tests/eepro100-test$(EXESUF)
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/tpci200-test.o libqgraph-tests-obj-y += tests/ipoctal232-test.o libqgraph-tests-obj-y += tests/ne2000-test.o libqgraph-tests-obj-y += tests/nvme-test.o +libqgraph-tests-obj-y += tests/pcnet-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -828,7 +828,6 @@ tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) -tests/pcnet-test$(EXESUF): tests/pcnet-test.o tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
tests/pcnet-test.c +30 -9
@@ -9,23 +9,44 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" + +typedef struct QPcnet QPcnet ; + +struct QPcnet { +QOSGraphObject obj; +};/* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop (void ) +static void pci_nop (void *obj,void *data,QGuestAllocator *alloc) +{ +} + +static void pcnet_destructor (QOSGraphObject *obj) { +QPcnet *pcnet = (QPcnet *)obj; +g_free (pcnet); } -int main (int argc,char **argv) +static void *pcnet_create (void *pci_bus,QGuestAllocator *alloc,void *addr) { -int ret; +QPcnet *pcnet =g_new0 (QPcnet,1 ); + pcnet->obj.destructor = pcnet_destructor; -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/pcnet/pci/nop" , pci_nop); +return &pcnet->obj; +} -qtest_start ("-device pcnet" ); - ret =g_test_run (); +static void pcnet_register_nodes (void ) +{ +qos_node_create_driver ("pcnet" , pcnet_create); +qos_node_consumes ("pcnet" ,"pci-bus" ,NULL ); +} -qtest_end (); +libqos_init (pcnet_register_nodes); -return ret; +static void register_pcnet_test (void ) +{ +qos_add_test ("pcnet-test" ,"pcnet" , pci_nop,NULL ); } + +libqos_init (register_pcnet_test);
Signature · 1 line
2.17.1
PATCH 12/16 test/qgraph: usb-hcd-ohci test node
In reply to Emanuele Giuseppe EspositoConvert tests/usb-hcd-ohci-test in qgraph test node, usb-hcd-ohci-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 4 +--- tests/usb-hcd-ohci-test.c | 46 +++++++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 15 deletions(-)
tests/Makefile.include +1 -3
@@ -268,7 +268,6 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF) gcov-files-i386-y += hw/pci-bridge/i82801b11.c check-qtest-i386-y += tests/ioh3420-test$(EXESUF) gcov-files-i386-y += hw/pci-bridge/ioh3420.c -check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF) gcov-files-i386-y += hw/usb/hcd-ohci.c check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF) gcov-files-i386-y += hw/usb/hcd-uhci.c
@@ -331,7 +330,6 @@ check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y += tests/migration-test$(EXESUF) check-qtest-ppc64-y += tests/rtas-test$(EXESUF) check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF) -check-qtest-ppc64-y += tests/usb-hcd-ohci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-ohci.c check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF) gcov-files-ppc64-y += hw/usb/hcd-uhci.c
@@ -793,6 +791,7 @@ libqgraph-tests-obj-y += tests/ne2000-test.o libqgraph-tests-obj-y += tests/nvme-test.o libqgraph-tests-obj-y += tests/pcnet-test.o libqgraph-tests-obj-y += tests/spapr-phb-test.o +libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -844,7 +843,6 @@ tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o -tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y) tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
tests/usb-hcd-ohci-test.c +34 -12
64 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 11/16 test/qgraph: spapr-phb test node
In reply to Emanuele Giuseppe EspositoConvert tests/spapr-phb-test in qgraph test node,
spapr-phb-test. This test adds another
spapr-pci-host-bridge device in the
ppc64/pseries machine
--- tests/Makefile.include | 3 +-- tests/spapr-phb-test.c | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 19 deletions(-)
tests/Makefile.include +1 -2
@@ -326,7 +326,6 @@ gcov-files-ppc-y += hw/timer/m48t59.c check-qtest-ppc64-y = $(check-qtest-ppc-y) gcov-files-ppc64-y = $(subst ppc-softmmu/,ppc64-softmmu/,$(gcov-files-ppc-y)) -check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF) gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y += tests/migration-test$(EXESUF)
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/ipoctal232-test.o libqgraph-tests-obj-y += tests/ne2000-test.o libqgraph-tests-obj-y += tests/nvme-test.o libqgraph-tests-obj-y += tests/pcnet-test.o +libqgraph-tests-obj-y += tests/spapr-phb-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -805,7 +805,6 @@ tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o tests/rtc-test$(EXESUF): tests/rtc-test.o tests/m48t59-test$(EXESUF): tests/m48t59-test.o tests/endianness-test$(EXESUF): tests/endianness-test.o -tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y) tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y) tests/rtas-test$(EXESUF): tests/rtas-test.o $(libqos-spapr-obj-y) tests/fdc-test$(EXESUF): tests/fdc-test.o
tests/spapr-phb-test.c +11 -17
@@ -7,29 +7,23 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#include "qemu/osdep.h" +#include "qemu/osdep.h" #include "libqtest.h" - -#define TYPE_SPAPR_PCI_HOST_BRIDGE "spapr-pci-host-bridge" +#include "libqos/qgraph.h" /* Tests only initialization so far. TODO: Replace with functional tests */ -static void test_phb_device (void ) +static void test_phb_device (void *obj,void *data,QGuestAllocator *alloc) { } -int main (int argc,char **argv) +static void register_phb_test (void ) { -int ret; - -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/spapr-phb/device" , test_phb_device); - -qtest_start ("-device " TYPE_SPAPR_PCI_HOST_BRIDGE ",index=30" ); - - ret =g_test_run (); - -qtest_end (); - -return ret; +qos_add_test ("spapr-phb-test" ,"ppc64/pseries" , + test_phb_device, &(QOSGraphTestOptions ) { + .edge.before_cmd_line ="-device spapr-pci-host-bridge" +",index=30" , + }); } + +libqos_init (register_phb_test);
Signature · 1 line
2.17.1
PATCH 13/16 test/qgraph: vmxnet3 test node
In reply to Emanuele Giuseppe EspositoConvert tests/vmxnet3-test in qgraph test node, vmxnet3-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 3 +-- tests/vmxnet3-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -258,7 +258,6 @@ check-qtest-i386-y += tests/tco-test$(EXESUF) gcov-files-i386-y += hw/watchdog/watchdog.c hw/watchdog/wdt_ib700.c check-qtest-i386-y += $(check-qtest-pci-y) gcov-files-i386-y += $(gcov-files-pci-y) -check-qtest-i386-y += tests/vmxnet3-test$(EXESUF) gcov-files-i386-y += hw/net/vmxnet3.c gcov-files-i386-y += hw/net/net_rx_pkt.c gcov-files-i386-y += hw/net/net_tx_pkt.c
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/nvme-test.o libqgraph-tests-obj-y += tests/pcnet-test.o libqgraph-tests-obj-y += tests/spapr-phb-test.o libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) +libqgraph-tests-obj-y += tests/vmxnet3-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -828,7 +828,6 @@ tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o tests/eepro100-test$(EXESUF): tests/eepro100-test.o -tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
tests/vmxnet3-test.c +30 -9
@@ -9,23 +9,44 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" + +typedef struct QVmxnet3 QVmxnet3 ; + +struct QVmxnet3 { +QOSGraphObject obj; +};/* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop (void ) +static void nop (void *obj,void *data,QGuestAllocator *alloc) +{ +} + +static void vmxnet3_destructor (QOSGraphObject *obj) { +QVmxnet3 *vmxnet3 = (QVmxnet3 *)obj; +g_free (vmxnet3); } -int main (int argc,char **argv) +static void *vmxnet3_create (void *pci_bus,QGuestAllocator *alloc,void *addr) { -int ret; +QVmxnet3 *vmxnet3 =g_new0 (QVmxnet3,1 ); + vmxnet3->obj.destructor = vmxnet3_destructor; -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/vmxnet3/nop" , nop); +return &vmxnet3->obj; +} -qtest_start ("-device vmxnet3" ); - ret =g_test_run (); +static void vmxnet3_register_nodes (void ) +{ +qos_node_create_driver ("vmxnet3" , vmxnet3_create); +qos_node_consumes ("vmxnet3" ,"pci-bus" ,NULL ); +} -qtest_end (); +libqos_init (vmxnet3_register_nodes); -return ret; +static void register_vmxnet3_test (void ) +{ +qos_add_test ("vmxnet3-test" ,"vmxnet3" , nop,NULL ); } + +libqos_init (register_vmxnet3_test);
Signature · 1 line
2.17.1
PATCH 14/16 test/qgraph: es1370 test node
In reply to Emanuele Giuseppe EspositoConvert tests/es1370-test in qgraph test node, es1370-test. Since it's a nop test, node creation and initialization is made in the same file.
--- tests/Makefile.include | 3 +-- tests/es1370-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)
tests/Makefile.include +1 -2
@@ -214,7 +214,6 @@ gcov-files-pci-y += hw/net/eepro100.c gcov-files-pci-y += hw/net/ne2000.c gcov-files-pci-y += hw/block/nvme.c gcov-files-pci-y += hw/audio/ac97.c -check-qtest-pci-y += tests/es1370-test$(EXESUF) gcov-files-pci-y += hw/audio/es1370.c check-qtest-pci-y += $(check-qtest-virtio-y) gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/pcnet-test.o libqgraph-tests-obj-y += tests/spapr-phb-test.o libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) libqgraph-tests-obj-y += tests/vmxnet3-test.o +libqgraph-tests-obj-y += tests/es1370-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -839,7 +839,6 @@ tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y) tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y) tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o -tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y)
tests/es1370-test.c +30 -9
@@ -9,23 +9,44 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" + +typedef struct QES1370 QES1370 ; + +struct QES1370 { +QOSGraphObject obj; +};/* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop (void ) +static void nop (void *obj,void *data,QGuestAllocator *alloc) +{ +} + +static void es1370_destructor (QOSGraphObject *obj) { +QES1370 *es1370 = (QES1370 *)obj; +g_free (es1370); } -int main (int argc,char **argv) +static void *es1370_create (void *pci_bus,QGuestAllocator *alloc,void *addr) { -int ret; +QES1370 *es1370 =g_new0 (QES1370 ,1 ); + es1370->obj.destructor = es1370_destructor; -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/es1370/nop" , nop); +return &es1370->obj; +} -qtest_start ("-device ES1370" ); - ret =g_test_run (); +static void es1370_register_nodes (void ) +{ +qos_node_create_driver ("ES1370" , es1370_create); +qos_node_consumes ("ES1370" ,"pci-bus" ,NULL ); +} -qtest_end (); +libqos_init (es1370_register_nodes); -return ret; +static void register_es1370_test (void ) +{ +qos_add_test ("es1370-test" ,"ES1370" , nop,NULL ); } + +libqos_init (register_es1370_test);
Signature · 1 line
2.17.1
PATCH 15/16 test/qgraph: eepro100 test node
In reply to Emanuele Giuseppe EspositoConvert tests/eepro100-test in qgraph test nodes, eepro100-test. Since it's a nop test, node creation and initialization is made in the same file.
In addition, all nodes share the same constructor and destructor.
--- tests/Makefile.include | 3 +-- tests/eepro100-test.c | 61 +++++++++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 23 deletions(-)
tests/Makefile.include +1 -2
@@ -209,7 +209,6 @@ check-qtest-pci-y += tests/rtl8139-test$(EXESUF) gcov-files-pci-y += hw/net/rtl8139.c gcov-files-pci-y += hw/net/pcnet.c gcov-files-pci-y += hw/net/pcnet-pci.c -check-qtest-pci-y += tests/eepro100-test$(EXESUF) gcov-files-pci-y += hw/net/eepro100.c gcov-files-pci-y += hw/net/ne2000.c gcov-files-pci-y += hw/block/nvme.c
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/spapr-phb-test.o libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) libqgraph-tests-obj-y += tests/vmxnet3-test.o libqgraph-tests-obj-y += tests/es1370-test.o +libqgraph-tests-obj-y += tests/eepro100-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -827,7 +827,6 @@ tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o -tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
tests/eepro100-test.c +40 -21
82 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 16/16 test/qgraph: e1000 test node
In reply to Emanuele Giuseppe EspositoConvert tests/e1000-test in qgraph test nodes, e1000-test. Since it's a nop test, node creation and initialization is made in the same file.
In addition, all nodes share the same constructor and destructor.
--- tests/Makefile.include | 3 +-- tests/e1000-test.c | 60 ++++++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 22 deletions(-)
tests/Makefile.include +1 -2
@@ -202,7 +202,6 @@ gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c check-qtest-virtio-y += $(check-qtest-virtioserial-y) gcov-files-virtio-y += $(gcov-files-virtioserial-y) -check-qtest-pci-y += tests/e1000-test$(EXESUF) gcov-files-pci-y += hw/net/e1000.c gcov-files-pci-y += hw/net/e1000e.c hw/net/e1000e_core.c check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) libqgraph-tests-obj-y += tests/vmxnet3-test.o libqgraph-tests-obj-y += tests/es1370-test.o libqgraph-tests-obj-y += tests/eepro100-test.o +libqgraph-tests-obj-y += tests/e1000-test.o check-unit-y += tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -824,7 +824,6 @@ tests/m25p80-test$(EXESUF): tests/m25p80-test.o tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) -tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o
tests/e1000-test.c +40 -20
81 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH 03/16] test/qgraph: arm/xlinx-zynq-a9 machine node
In reply to Emanuele Giuseppe EspositoQuoted 4 lines · Emanuele Giuseppe Esposito
Add xlinx-zynq-a9 machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
Signed-off-by Emanuele Giuseppe Esposito <[email protected]>
Alistair
Quoted 136 lines
--- tests/Makefile.include | 1 + tests/libqos/xilinx-zynq-a9-machine.c | 84 +++++++++++++++++++++++++++ tests/sdhci-test.c | 8 +-- 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 tests/libqos/xilinx-zynq-a9-machine.ctests/Makefile.include +1
-0@@ -760,6 +760,7 @@ libqgraph-arm-machines-obj-y = tests/libqos/raspi2-machine.o libqgraph-arm-machines-obj-y += tests/libqos/virt-machine.o libqgraph-arm-machines-obj-y += tests/libqos/smdkc210-machine.o libqgraph-arm-machines-obj-y += tests/libqos/sabrelite-machine.o +libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.otests/libqos/xilinx-zynq-a9-machine.c new file +84
-0@@ -0,0 +1,84 @@ +/* +* libqos driver framework +* +* Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]> +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2 as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/> +*/ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/malloc.h" +#include "libqos/qgraph.h" +#include "sdhci.h" + +typedef struct QXilinx_zynq_a9Machine QXilinx_zynq_a9Machine ; + +struct QXilinx_zynq_a9Machine { +QOSGraphObject obj; +QGuestAllocator *alloc; +QSDHCI_MemoryMapped sdhci; +}; + +static void xilinx_zynq_a9_destructor (QOSGraphObject *obj) +{ +g_free (obj); +} + +static void *xilinx_zynq_a9_get_driver (void *object,const char *interface) +{ +QXilinx_zynq_a9Machine *machine = object; +if (!g_strcmp0 (interface,"memory" )) { +return &machine->alloc; + } + +fprintf (stderr,"%s not present in arm/xilinx-zynq-a9\n" , interface); +g_assert_not_reached (); +} + +static QOSGraphObject *xilinx_zynq_a9_get_device (void *obj,const char *device) +{ +QXilinx_zynq_a9Machine *machine = obj; +if (!g_strcmp0 (device,"generic-sdhci" )) { +return &machine->sdhci.obj; + } + +fprintf (stderr,"%s not present in arm/xilinx-zynq-a9\n" , device); +g_assert_not_reached (); +} + +static void *qos_create_machine_arm_xilinx_zynq_a9 (void ) +{ +QXilinx_zynq_a9Machine *machine =g_new0 (QXilinx_zynq_a9Machine,1 ); + + machine->obj.get_device = xilinx_zynq_a9_get_device; + machine->obj.get_driver = xilinx_zynq_a9_get_driver; + machine->obj.destructor = xilinx_zynq_a9_destructor; +/* Datasheet: UG585 (v1.12.1) */ +qos_init_sdhci_smm (&machine->sdhci,0xe0100000 , &(QSDHCIProperties ) { + .version =2 , + .baseclock =0 , + .capab.sdma = true, + .capab.reg =0x69ec0080 , + }); +return &machine->obj; +} + +static void xilinx_zynq_a9_register_nodes (void ) +{ +qos_node_create_machine ("arm/xilinx-zynq-a9" , + qos_create_machine_arm_xilinx_zynq_a9); +qos_node_contains ("arm/xilinx-zynq-a9" ,"generic-sdhci" ,NULL ); +} + +libqos_init (xilinx_zynq_a9_register_nodes);tests/sdhci-test.c +4
-5@@ -60,14 +60,14 @@ FIELD(SDHC_CAPAB, DRIVER, 36, 3); /* since v3 */ {"arm" ,"sabrelite" , {0x02190000, 3, 0, {1, 0x057834b4} } }, - * - * FIXME: the following drivers are missing: - * - Zynq-7000 { "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1) {0xe0100000, 2, 0, {1, 0x69ec0080} } }, + * + * FIXME: the following drivers are missing: + * + ZynqMP { "aarch64", "xlnx-zcu102", Datasheet: UG1085 (v1.7) {0xff160000, 3, 0, {1, 0x280737ec6481} } }, --2.17.1
Re: [Qemu-devel] [PATCH 04/16] test/qgraph: aarch64/xlnx-zcu102 machine node
In reply to Emanuele Giuseppe EspositoQuoted 4 lines · Emanuele Giuseppe Esposito
Add xlnx-zcu102 machine to the graph. This machine contains generic-sdhci, so its constructor must take care of setting it properly when called.
Signed-off-by Emanuele Giuseppe Esposito <[email protected]>
Alistair
Quoted 174 lines
--- tests/Makefile.include | 1 + tests/libqos/xlnx-zcu102-machine.c | 83 ++++++++++++++++++++++++++++++ tests/sdhci-test.c | 51 ------------------ 3 files changed, 84 insertions(+), 51 deletions(-) create mode 100644 tests/libqos/xlnx-zcu102-machine.ctests/Makefile.include +1
-0@@ -765,6 +765,7 @@ libqgraph-arm-machines-obj-y += tests/libqos/xilinx-zynq-a9-machine.o libqgraph-machines-obj-y = $(libqgraph-arm-machines-obj-y) libqgraph-machines-obj-y += tests/libqos/x86_64_pc-machine.o libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o +libqgraph-machines-obj-y += tests/libqos/xlnx-zcu102-machine.o libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o libqgraph-virtio-obj-y += tests/libqos/virtio-9p.otests/libqos/xlnx-zcu102-machine.c new file +83
-0@@ -0,0 +1,83 @@ +/* +* libqos driver framework +* +* Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]> +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License version 2 as published by the Free Software Foundation. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/> +*/ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/malloc.h" +#include "libqos/qgraph.h" +#include "sdhci.h" + +typedef struct QXlnx_zcu102Machine QXlnx_zcu102Machine ; + +struct QXlnx_zcu102Machine { +QOSGraphObject obj; +QGuestAllocator *alloc; +QSDHCI_MemoryMapped sdhci; +}; + +static void xlnx_zcu102_destructor (QOSGraphObject *obj) +{ +g_free (obj); +} + +static void *xlnx_zcu102_get_driver (void *object,const char *interface) +{ +QXlnx_zcu102Machine *machine = object; +if (!g_strcmp0 (interface,"memory" )) { +return &machine->alloc; + } + +fprintf (stderr,"%s not present in aarch64/xlnx-zcu102\n" , interface); +g_assert_not_reached (); +} + +static QOSGraphObject *xlnx_zcu102_get_device (void *obj,const char *device) +{ +QXlnx_zcu102Machine *machine = obj; +if (!g_strcmp0 (device,"generic-sdhci" )) { +return &machine->sdhci.obj; + } + +fprintf (stderr,"%s not present in aarch64/xlnx-zcu102\n" , device); +g_assert_not_reached (); +} + +static void *qos_create_machine_aarch64_xlnx_zcu102 (void ) +{ +QXlnx_zcu102Machine *machine =g_new0 (QXlnx_zcu102Machine,1 ); + + machine->obj.get_device = xlnx_zcu102_get_device; + machine->obj.get_driver = xlnx_zcu102_get_driver; + machine->obj.destructor = xlnx_zcu102_destructor; +/* Datasheet: UG1085 (v1.7) */ +qos_init_sdhci_smm (&machine->sdhci,0xff160000 , &(QSDHCIProperties ) { + .version =3 , + .baseclock =0 , + .capab.sdma = true, + .capab.reg =0x280737ec6481 + }); +return &machine->obj; +} + +static void xlnx_zcu102_register_nodes (void ) +{ +qos_node_create_machine ("aarch64/xlnx-zcu102" , qos_create_machine_aarch64_xlnx_zcu102); +qos_node_contains ("aarch64/xlnx-zcu102" ,"generic-sdhci" ,NULL ); +} + +libqos_init (xlnx_zcu102_register_nodes);tests/sdhci-test.c +0
-52@@ -22,57 +22,6 @@ FIELD(SDHC_CAPAB, SDR, 32, 3); /* since v3 */FIELD (SDHC_CAPAB ,DRIVER ,36 ,3 );/* since v3 */ #define SDHC_HCVER 0xFE -/** -* Old sdhci_t structure: -* -struct sdhci_t { -const char *arch, *machine; -struct { -uintptr_t addr; -uint8_t version; -uint8_t baseclock; -struct { -bool sdma; -uint64_t reg; -} capab; -} sdhci; -struct { -uint16_t vendor_id, device_id; -} pci; -} -* -* implemented drivers: -* -PC via PCI -{ "x86_64", "pc", -{-1, 2, 0, {1, 0x057834b4} }, -.pci = { PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_SDHCI } }, - -BCM2835 -{ "arm", "raspi2", -{0x3f300000, 3, 52, {0, 0x052134b4} } }, - -Exynos4210 -{ "arm", "smdkc210", -{0x12510000, 2, 0, {1, 0x5e80080} } }, - -i.MX 6 -{ "arm", "sabrelite", -{0x02190000, 3, 0, {1, 0x057834b4} } }, - -Zynq-7000 -{ "arm", "xilinx-zynq-a9", Datasheet: UG585 (v1.12.1) -{0xe0100000, 2, 0, {1, 0x69ec0080} } }, - -* -* FIXME: the following drivers are missing: -* - -ZynqMP -{ "aarch64", "xlnx-zcu102", Datasheet: UG1085 (v1.7) -{0xff160000, 3, 0, {1, 0x280737ec6481} } }, -*/ -static void check_specs_version (QSDHCI *s,uint8_t version) {uint32_t v; --2.17.1