tests: qtest: Add virtio-iommu test
PATCH v5 1/1 tests: qtest: Add virtio-iommu test
Add the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API.
---
v4 -> v5:
- remove printf and move a comment
- Added Jean-Philippe's T-b and R-b
--- tests/qtest/libqos/meson.build | 1 + tests/qtest/libqos/virtio-iommu.c | 126 ++++++++++++ tests/qtest/libqos/virtio-iommu.h | 40 ++++ tests/qtest/meson.build | 1 + tests/qtest/virtio-iommu-test.c | 326 ++++++++++++++++++++++++++++++ 5 files changed, 494 insertions(+) create mode 100644 tests/qtest/libqos/virtio-iommu.c create mode 100644 tests/qtest/libqos/virtio-iommu.h create mode 100644 tests/qtest/virtio-iommu-test.c
tests/qtest/libqos/meson.build +1 -0
@@ -40,6 +40,7 @@ libqos_srcs = files('../libqtest.c', 'virtio-rng.c', 'virtio-scsi.c', 'virtio-serial.c', + 'virtio-iommu.c', # qgraph machines: 'aarch64-xlnx-zcu102-machine.c',
tests/qtest/libqos/virtio-iommu.c new file +126 -0
126 lines not on this page · raw message
tests/qtest/libqos/virtio-iommu.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* libqos driver virtio-iommu-pci framework +* +* Copyright (c) 2021 Red Hat, Inc. +* +* Authors: +* Eric Auger <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or (at your +* option) any later version. See the COPYING file in the top-level directory. +* +*/ + +#ifndef TESTS_LIBQOS_VIRTIO_IOMMU_H +#define TESTS_LIBQOS_VIRTIO_IOMMU_H + +#include "qgraph.h" +#include "virtio.h" +#include "virtio-pci.h" + +typedef struct QVirtioIOMMU QVirtioIOMMU ; +typedef struct QVirtioIOMMUPCI QVirtioIOMMUPCI ; +typedef struct QVirtioIOMMUDevice QVirtioIOMMUDevice ; + +struct QVirtioIOMMU { +QVirtioDevice *vdev; +QVirtQueue *vq; +}; + +struct QVirtioIOMMUPCI { +QVirtioPCIDevice pci_vdev; +QVirtioIOMMU iommu; +}; + +struct QVirtioIOMMUDevice { +QOSGraphObject obj; +QVirtioIOMMU iommu; +}; + +#endif
tests/qtest/meson.build +1 -0
@@ -230,6 +230,7 @@ qos_test_ss.add( 'virtio-rng-test.c', 'virtio-scsi-test.c', 'virtio-serial-test.c', + 'virtio-iommu-test.c', 'vmxnet3-test.c', ) if have_virtfs
tests/qtest/virtio-iommu-test.c new file +326 -0
326 lines not on this page · raw message
Signature · 1 line
2.26.3
Quoted 7 lines · Eric Auger
Add the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API.
Signed-off-by Eric Auger <[email protected]>Reviewed-by Jean-Philippe Brucker <[email protected]>
Quoted 5 lines
---
v4 -> v5:
- remove printf and move a comment
- Added Jean-Philippe's T-b and R-b
Hi Eric,
I tried to add this patch to my queue, but unfortunately, it fails some of the gitlab CI pipelines, e.g.:
https://gitlab.com/thuth/qemu/-/jobs/1739091817#L311
...
Running test qtest-x86_64/qos-test
qemu-system-x86_64: -device virtio-iommu-pci,addr=04.0:
pc-i440fx-6.2 machine fails to create iommu-map device tree bindings
Check your machine implements a hotplug handler for the virtio-iommu-pci device
Check the guest is booted without FW or with -no-acpi Broken pipe
...
Could you please have a look?
Thanks,
Thomas
Hi Thomas,
Quoted 32 lines · Thomas Huth
Quoted 7 lines · Eric Auger
Add the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API.
Signed-off-by Eric Auger <[email protected]>Reviewed-by Jean-Philippe Brucker <[email protected]>Quoted 5 lines
---
v4 -> v5:
- remove printf and move a comment
- Added Jean-Philippe's T-b and R-bHi Eric,
I tried to add this patch to my queue, but unfortunately, it fails some of the gitlab CI pipelines, e.g.:
https://gitlab.com/thuth/qemu/-/jobs/1739091817#L311
...
Running test qtest-x86_64/qos-test
qemu-system-x86_64: -device virtio-iommu-pci,addr=04.0:
pc-i440fx-6.2 machine fails to create iommu-map device tree bindings
Check your machine implements a hotplug handler for the virtio-iommu-pci device
Check the guest is booted without FW or with -no-acpi Broken pipe
...
Quoted 1 line
Could you please have a look?
The test requires to be applied on top of Jean-Philippe's series [PATCH v6 0/7] virtio-iommu: Add ACPI support (x86 part) and especially 36efa250a4 hw/i386/pc: Allow instantiating a virtio-iommu device which allows the instantiation of the virtio-iommu on q35. The series was merged so the problem should be resolved now.
Thanks
Eric
Quoted 4 lines
Thanks,
Thomas
Quoted 19 lines · Eric Auger
Add the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API.
Signed-off-by Eric Auger <[email protected]>Reviewed-by Jean-Philippe Brucker <[email protected]>---
v4 -> v5:
- remove printf and move a comment
- Added Jean-Philippe's T-b and R-b--- tests/qtest/libqos/meson.build | 1 + tests/qtest/libqos/virtio-iommu.c | 126 ++++++++++++ tests/qtest/libqos/virtio-iommu.h | 40 ++++ tests/qtest/meson.build | 1 + tests/qtest/virtio-iommu-test.c | 326 ++++++++++++++++++++++++++++++ 5 files changed, 494 insertions(+)
Quoted 3 lines
create mode 100644
tests/qtest/libqos/virtio-iommu.ccreate mode 100644tests/qtest/libqos/virtio-iommu.hcreate mode 100644tests/qtest/virtio-iommu-test.c
There's another failure on Travis-CI:
https://app.travis-ci.com/github/huth/qemu/jobs/546268575#L7240
ERROR:../tests/qtest/virtio-iommu-test.c:38:pci_config:
assertion failed (domain_range_end == 32): (536870912 == 32)
536870912 is 0x20000000, so this is likely an endianess issue?
Thomas
Hi Thomas,
Quoted 24 lines · Thomas Huth
Quoted 18 lines · Eric Auger
Add the framework to test the virtio-iommu-pci device and tests exercising the attach/detach, map/unmap API.
Signed-off-by Eric Auger <[email protected]>Reviewed-by Jean-Philippe Brucker <[email protected]>---
v4 -> v5:
- remove printf and move a comment
- Added Jean-Philippe's T-b and R-b
---
tests/qtest/libqos/meson.build | 1 +tests/qtest/libqos/virtio-iommu.c| 126 ++++++++++++tests/qtest/libqos/virtio-iommu.h| 40 ++++ tests/qtest/meson.build | 1 + tests/qtest/virtio-iommu-test.c | 326 ++++++++++++++++++++++++++++++Quoted 4 lines
5 files changed, 494 insertions(+)create mode 100644
tests/qtest/libqos/virtio-iommu.ccreate mode 100644tests/qtest/libqos/virtio-iommu.hcreate mode 100644tests/qtest/virtio-iommu-test.c
Quoted 8 lines
There's another failure on Travis-CI:
https://app.travis-ci.com/github/huth/qemu/jobs/546268575#L7240
ERROR:../tests/qtest/virtio-iommu-test.c:38:pci_config:
assertion failed (domain_range_end== 32): (536870912 == 32)536870912 is
0x20000000, so this is likely an endianess issue?
Hum It seems so. Thank you for reporting the issue. I think the get_config() cb implementation in the virtio-iommu device is wrong and needs to be fixed.
I will send a fix along with the test.
Thanks!
Eric
Quoted 3 lines
Thomas