[PATCH 0/4] move validation of virtio options

Move validation of virtio options (iommu, ats, packed) from QEMU command line generation to domain validation. As a drive-by, increase the granularity of tests for virtio options. Bjoern Walk (4): tests: use latest caps for virtio-options test tests: more fine-granular tests for virtio-options qemu: move virtio capability validation qemu: command: make qemuBuildVirtioOptionsStr void src/qemu/qemu_command.c | 59 +++------- src/qemu/qemu_validate.c | 70 +++++++++++- .../virtio-options-controller-ats.args | 32 ++++++ .../virtio-options-controller-ats.xml | 38 +++++++ .../virtio-options-controller-iommu.args | 34 ++++++ .../virtio-options-controller-iommu.xml | 38 +++++++ .../virtio-options-controller-packed.args | 32 ++++++ .../virtio-options-controller-packed.xml | 38 +++++++ .../virtio-options-disk-ats.args | 36 +++++++ .../virtio-options-disk-ats.xml | 34 ++++++ .../virtio-options-disk-iommu.args | 36 +++++++ .../virtio-options-disk-iommu.xml | 34 ++++++ .../virtio-options-disk-packed.args | 36 +++++++ .../virtio-options-disk-packed.xml | 34 ++++++ .../virtio-options-fs-ats.args | 34 ++++++ .../virtio-options-fs-ats.xml | 34 ++++++ .../virtio-options-fs-iommu.args | 34 ++++++ .../virtio-options-fs-iommu.xml | 34 ++++++ .../virtio-options-fs-packed.args | 34 ++++++ .../virtio-options-fs-packed.xml | 34 ++++++ .../virtio-options-input-ats.args | 30 ++++++ .../virtio-options-input-ats.xml | 30 ++++++ .../virtio-options-input-iommu.args | 30 ++++++ .../virtio-options-input-iommu.xml | 30 ++++++ .../virtio-options-input-packed.args | 30 ++++++ .../virtio-options-input-packed.xml | 30 ++++++ .../virtio-options-memballoon-ats.args | 28 +++++ .../virtio-options-memballoon-ats.xml | 23 ++++ .../virtio-options-memballoon-iommu.args | 28 +++++ .../virtio-options-memballoon-iommu.xml | 23 ++++ .../virtio-options-memballoon-packed.args | 28 +++++ .../virtio-options-memballoon-packed.xml | 23 ++++ .../virtio-options-net-ats.args | 34 ++++++ .../virtio-options-net-ats.xml | 34 ++++++ .../virtio-options-net-iommu.args | 34 ++++++ .../virtio-options-net-iommu.xml | 34 ++++++ .../virtio-options-net-packed.args | 34 ++++++ .../virtio-options-net-packed.xml | 34 ++++++ .../virtio-options-rng-ats.args | 32 ++++++ .../virtio-options-rng-ats.xml | 32 ++++++ .../virtio-options-rng-iommu.args | 34 ++++++ .../virtio-options-rng-iommu.xml | 32 ++++++ .../virtio-options-rng-packed.args | 32 ++++++ .../virtio-options-rng-packed.xml | 32 ++++++ .../virtio-options-video-ats.args | 34 ++++++ .../virtio-options-video-ats.xml | 36 +++++++ .../virtio-options-video-iommu.args | 34 ++++++ .../virtio-options-video-iommu.xml | 36 +++++++ .../virtio-options-video-packed.args | 34 ++++++ .../virtio-options-video-packed.xml | 36 +++++++ .../virtio-options.x86_64-latest.args | 69 ++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 101 ++++++++++++++++-- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +-- 55 files changed, 1818 insertions(+), 70 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml -- 2.24.1

Convert the virtio-options test in qemuxml2argv and qemuxml2xml to use the latest available QEMU capabilities. Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- .../virtio-options.x86_64-latest.args | 69 +++++++++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 12 +--- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +---- 5 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml diff --git a/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args new file mode 100644 index 00000000..e523f73f --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options.x86_64-latest.args @@ -0,0 +1,69 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object secret,id=masterKey0,format=raw,\ +file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ +-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,\ +addr=0x8 \ +-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0x9 \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/img1",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,scsi=off,iommu_platform=on,ats=on,packed=on,bus=pci.0,\ +addr=0xa,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,\ +ats=on,packed=on,bus=pci.0,addr=0x3 \ +-fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,\ +path=/export/fs2 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,\ +ats=on,packed=on,bus=pci.0,addr=0x4 \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ +addr=0x6,iommu_platform=on,ats=on,packed=on \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,\ +packed=on \ +-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,\ +ats=on,packed=on \ +-device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,\ +ats=on,packed=on \ +-device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,\ +addr=0x12,iommu_platform=on,ats=on,packed=on \ +-chardev socket,id=chr-vu-video0,fd=1729 \ +-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,\ +addr=0x2,iommu_platform=on,ats=on,packed=on \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,\ +ats=on,packed=on \ +-object rng-random,id=objrng0,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0xd \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ +resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml index 3ca27840..ba1bf7c0 100644 --- a/tests/qemuxml2argvdata/virtio-options.xml +++ b/tests/qemuxml2argvdata/virtio-options.xml @@ -8,6 +8,9 @@ <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> @@ -20,7 +23,7 @@ <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> </disk> - <controller type='usb' index='0'> + <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 66472a5e..dffca323 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2981,17 +2981,7 @@ mymain(void) DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); - DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_KEYBOARD, - QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VHOST_USER_GPU, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - QEMU_CAPS_VIRTIO_PCI_ATS, - QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST_CAPS_LATEST("virtio-options"); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); diff --git a/tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml b/tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml new file mode 120000 index 00000000..26d8a252 --- /dev/null +++ b/tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/virtio-options.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index cf5abeac..d6f9c43b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1278,21 +1278,7 @@ mymain(void) DO_TEST("memorybacking-set", NONE); DO_TEST("memorybacking-unset", NONE); - DO_TEST("virtio-options", - QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_VIRTIO_KEYBOARD, - QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_TABLET, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - QEMU_CAPS_VIRTIO_PCI_ATS, - QEMU_CAPS_DEVICE_VHOST_USER_GPU, - QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST_CAPS_LATEST("virtio-options"); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); -- 2.24.1

On 4/23/20 3:15 PM, Bjoern Walk wrote:
Convert the virtio-options test in qemuxml2argv and qemuxml2xml to use the latest available QEMU capabilities.
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- .../virtio-options.x86_64-latest.args | 69 +++++++++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 12 +--- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +---- 5 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml
This means that tests/qemuxml2argvdata/virtio-options.args can be removed then (what git detects as rename). No need to resend, I will fix locally before pushing after we figure out 2/4. Michal

Michal Privoznik <mprivozn@redhat.com> [2020-04-27, 12:06PM +0200]:
On 4/23/20 3:15 PM, Bjoern Walk wrote:
Convert the virtio-options test in qemuxml2argv and qemuxml2xml to use the latest available QEMU capabilities.
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- .../virtio-options.x86_64-latest.args | 69 +++++++++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 12 +--- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +---- 5 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml
This means that tests/qemuxml2argvdata/virtio-options.args can be removed then (what git detects as rename). No need to resend, I will fix locally before pushing after we figure out 2/4.
Right, missed that artifact. Thanks for fixing.
Michal

Add separate tests for individual options and devices for virtio-options to have the ability to do more fine-granular testing of various combinations. Also, add negative tests for unavailable capabilities. Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- .../virtio-options-controller-ats.args | 32 ++++++ .../virtio-options-controller-ats.xml | 38 +++++++ .../virtio-options-controller-iommu.args | 34 +++++++ .../virtio-options-controller-iommu.xml | 38 +++++++ .../virtio-options-controller-packed.args | 32 ++++++ .../virtio-options-controller-packed.xml | 38 +++++++ .../virtio-options-disk-ats.args | 36 +++++++ .../virtio-options-disk-ats.xml | 34 +++++++ .../virtio-options-disk-iommu.args | 36 +++++++ .../virtio-options-disk-iommu.xml | 34 +++++++ .../virtio-options-disk-packed.args | 36 +++++++ .../virtio-options-disk-packed.xml | 34 +++++++ .../virtio-options-fs-ats.args | 34 +++++++ .../virtio-options-fs-ats.xml | 34 +++++++ .../virtio-options-fs-iommu.args | 34 +++++++ .../virtio-options-fs-iommu.xml | 34 +++++++ .../virtio-options-fs-packed.args | 34 +++++++ .../virtio-options-fs-packed.xml | 34 +++++++ .../virtio-options-input-ats.args | 30 ++++++ .../virtio-options-input-ats.xml | 30 ++++++ .../virtio-options-input-iommu.args | 30 ++++++ .../virtio-options-input-iommu.xml | 30 ++++++ .../virtio-options-input-packed.args | 30 ++++++ .../virtio-options-input-packed.xml | 30 ++++++ .../virtio-options-memballoon-ats.args | 28 ++++++ .../virtio-options-memballoon-ats.xml | 23 +++++ .../virtio-options-memballoon-iommu.args | 28 ++++++ .../virtio-options-memballoon-iommu.xml | 23 +++++ .../virtio-options-memballoon-packed.args | 28 ++++++ .../virtio-options-memballoon-packed.xml | 23 +++++ .../virtio-options-net-ats.args | 34 +++++++ .../virtio-options-net-ats.xml | 34 +++++++ .../virtio-options-net-iommu.args | 34 +++++++ .../virtio-options-net-iommu.xml | 34 +++++++ .../virtio-options-net-packed.args | 34 +++++++ .../virtio-options-net-packed.xml | 34 +++++++ .../virtio-options-rng-ats.args | 32 ++++++ .../virtio-options-rng-ats.xml | 32 ++++++ .../virtio-options-rng-iommu.args | 34 +++++++ .../virtio-options-rng-iommu.xml | 32 ++++++ .../virtio-options-rng-packed.args | 32 ++++++ .../virtio-options-rng-packed.xml | 32 ++++++ .../virtio-options-video-ats.args | 34 +++++++ .../virtio-options-video-ats.xml | 36 +++++++ .../virtio-options-video-iommu.args | 34 +++++++ .../virtio-options-video-iommu.xml | 36 +++++++ .../virtio-options-video-packed.args | 34 +++++++ .../virtio-options-video-packed.xml | 36 +++++++ tests/qemuxml2argvtest.c | 99 +++++++++++++++++++ 49 files changed, 1666 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.xml diff --git a/tests/qemuxml2argvdata/virtio-options-controller-ats.args b/tests/qemuxml2argvdata/virtio-options-controller-ats.args new file mode 100644 index 00000000..c7186ed2 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-ats.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-device virtio-scsi-pci,ats=on,id=scsi0,bus=pci.0,addr=0x2 \ +-device virtio-scsi-pci,ats=off,id=scsi1,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial0,ats=on,bus=pci.0,addr=0x4 \ +-device virtio-serial-pci,id=virtio-serial1,ats=off,bus=pci.0,addr=0x5 \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 diff --git a/tests/qemuxml2argvdata/virtio-options-controller-ats.xml b/tests/qemuxml2argvdata/virtio-options-controller-ats.xml new file mode 100644 index 00000000..b436eaf0 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-ats.xml @@ -0,0 +1,38 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <controller type='scsi' index='0' model='virtio-scsi'> + <driver ats='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='scsi' index='1' model='virtio-scsi'> + <driver ats='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='virtio-serial' index='0'> + <driver ats='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1'> + <driver ats='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </controller> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-controller-iommu.args b/tests/qemuxml2argvdata/virtio-options-controller-iommu.args new file mode 100644 index 00000000..6d60c5e6 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-iommu.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-device virtio-scsi-pci,iommu_platform=on,id=scsi0,bus=pci.0,addr=0x2 \ +-device virtio-scsi-pci,iommu_platform=off,id=scsi1,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,bus=pci.0,\ +addr=0x4 \ +-device virtio-serial-pci,id=virtio-serial1,iommu_platform=off,bus=pci.0,\ +addr=0x5 \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 diff --git a/tests/qemuxml2argvdata/virtio-options-controller-iommu.xml b/tests/qemuxml2argvdata/virtio-options-controller-iommu.xml new file mode 100644 index 00000000..86be5f0d --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-iommu.xml @@ -0,0 +1,38 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <controller type='scsi' index='0' model='virtio-scsi'> + <driver iommu='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='scsi' index='1' model='virtio-scsi'> + <driver iommu='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='virtio-serial' index='0'> + <driver iommu='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1'> + <driver iommu='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </controller> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-controller-packed.args b/tests/qemuxml2argvdata/virtio-options-controller-packed.args new file mode 100644 index 00000000..e853e53d --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-packed.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-device virtio-scsi-pci,packed=on,id=scsi0,bus=pci.0,addr=0x2 \ +-device virtio-scsi-pci,packed=off,id=scsi1,bus=pci.0,addr=0x3 \ +-device virtio-serial-pci,id=virtio-serial0,packed=on,bus=pci.0,addr=0x4 \ +-device virtio-serial-pci,id=virtio-serial1,packed=off,bus=pci.0,addr=0x5 \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 diff --git a/tests/qemuxml2argvdata/virtio-options-controller-packed.xml b/tests/qemuxml2argvdata/virtio-options-controller-packed.xml new file mode 100644 index 00000000..864fec45 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-controller-packed.xml @@ -0,0 +1,38 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <controller type='scsi' index='0' model='virtio-scsi'> + <driver packed='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </controller> + <controller type='scsi' index='1' model='virtio-scsi'> + <driver packed='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </controller> + <controller type='virtio-serial' index='0'> + <driver packed='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </controller> + <controller type='virtio-serial' index='1'> + <driver packed='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> + </controller> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-disk-ats.args b/tests/qemuxml2argvdata/virtio-options-disk-ats.args new file mode 100644 index 00000000..294ad2d4 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-ats.args @@ -0,0 +1,36 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ +id=drive-virtio-disk0 \ +-device virtio-blk-pci,ats=on,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-drive file=/var/lib/libvirt/images/img2,format=raw,if=none,\ +id=drive-virtio-disk1 \ +-device virtio-blk-pci,ats=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\ +id=virtio-disk1 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-disk-ats.xml b/tests/qemuxml2argvdata/virtio-options-disk-ats.xml new file mode 100644 index 00000000..d0698126 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-ats.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' ats='on'/> + <source file='/var/lib/libvirt/images/img1'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' ats='off'/> + <source file='/var/lib/libvirt/images/img2'/> + <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </disk> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-disk-iommu.args b/tests/qemuxml2argvdata/virtio-options-disk-iommu.args new file mode 100644 index 00000000..185c57ca --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-iommu.args @@ -0,0 +1,36 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ +id=drive-virtio-disk0 \ +-device virtio-blk-pci,iommu_platform=on,bus=pci.0,addr=0x2,\ +drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ +-drive file=/var/lib/libvirt/images/img2,format=raw,if=none,\ +id=drive-virtio-disk1 \ +-device virtio-blk-pci,iommu_platform=off,bus=pci.0,addr=0x3,\ +drive=drive-virtio-disk1,id=virtio-disk1 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-disk-iommu.xml b/tests/qemuxml2argvdata/virtio-options-disk-iommu.xml new file mode 100644 index 00000000..ac09b58e --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-iommu.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' iommu='on'/> + <source file='/var/lib/libvirt/images/img1'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' iommu='off'/> + <source file='/var/lib/libvirt/images/img2'/> + <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </disk> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-disk-packed.args b/tests/qemuxml2argvdata/virtio-options-disk-packed.args new file mode 100644 index 00000000..1fb3735d --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-packed.args @@ -0,0 +1,36 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ +id=drive-virtio-disk0 \ +-device virtio-blk-pci,packed=on,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\ +id=virtio-disk0,bootindex=1 \ +-drive file=/var/lib/libvirt/images/img2,format=raw,if=none,\ +id=drive-virtio-disk1 \ +-device virtio-blk-pci,packed=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\ +id=virtio-disk1 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-disk-packed.xml b/tests/qemuxml2argvdata/virtio-options-disk-packed.xml new file mode 100644 index 00000000..7edbaad6 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-disk-packed.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' packed='on'/> + <source file='/var/lib/libvirt/images/img1'/> + <target dev='vda' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw' packed='off'/> + <source file='/var/lib/libvirt/images/img2'/> + <target dev='vdb' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </disk> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-fs-ats.args b/tests/qemuxml2argvdata/virtio-options-fs-ats.args new file mode 100644 index 00000000..1ab99418 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-ats.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,ats=on,bus=pci.0,\ +addr=0x2 \ +-fsdev local,security_model=passthrough,id=fsdev-fs1,path=/export/fs2 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,ats=off,bus=pci.0,\ +addr=0x3 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-fs-ats.xml b/tests/qemuxml2argvdata/virtio-options-fs-ats.xml new file mode 100644 index 00000000..5338c88a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-ats.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='passthrough'> + <driver ats='on'/> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='passthrough'> + <driver ats='off'/> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-fs-iommu.args b/tests/qemuxml2argvdata/virtio-options-fs-iommu.args new file mode 100644 index 00000000..da40896b --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-iommu.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,\ +bus=pci.0,addr=0x2 \ +-fsdev local,security_model=passthrough,id=fsdev-fs1,path=/export/fs2 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=off,\ +bus=pci.0,addr=0x3 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-fs-iommu.xml b/tests/qemuxml2argvdata/virtio-options-fs-iommu.xml new file mode 100644 index 00000000..31180afc --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-iommu.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='passthrough'> + <driver iommu='on'/> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='passthrough'> + <driver iommu='off'/> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-fs-packed.args b/tests/qemuxml2argvdata/virtio-options-fs-packed.args new file mode 100644 index 00000000..66c16f00 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-packed.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ +-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,packed=on,bus=pci.0,\ +addr=0x2 \ +-fsdev local,security_model=passthrough,id=fsdev-fs1,path=/export/fs2 \ +-device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,packed=off,\ +bus=pci.0,addr=0x3 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-fs-packed.xml b/tests/qemuxml2argvdata/virtio-options-fs-packed.xml new file mode 100644 index 00000000..e8d6d50a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-fs-packed.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <filesystem type='mount' accessmode='passthrough'> + <driver packed='on'/> + <source dir='/export/fs1'/> + <target dir='fs1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </filesystem> + <filesystem type='mount' accessmode='passthrough'> + <driver packed='off'/> + <source dir='/export/fs2'/> + <target dir='fs2'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </filesystem> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-input-ats.args b/tests/qemuxml2argvdata/virtio-options-input-ats.args new file mode 100644 index 00000000..9906d9b6 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-ats.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0x2,ats=on \ +-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x3,ats=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-input-ats.xml b/tests/qemuxml2argvdata/virtio-options-input-ats.xml new file mode 100644 index 00000000..b911ff62 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-ats.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='virtio'> + <driver ats='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </input> + <input type='keyboard' bus='virtio'> + <driver ats='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </input> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-input-iommu.args b/tests/qemuxml2argvdata/virtio-options-input-iommu.args new file mode 100644 index 00000000..69d08897 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-iommu.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0x2,iommu_platform=on \ +-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x3,iommu_platform=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-input-iommu.xml b/tests/qemuxml2argvdata/virtio-options-input-iommu.xml new file mode 100644 index 00000000..31fd74be --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-iommu.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='virtio'> + <driver iommu='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </input> + <input type='keyboard' bus='virtio'> + <driver iommu='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </input> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-input-packed.args b/tests/qemuxml2argvdata/virtio-options-input-packed.args new file mode 100644 index 00000000..f89450cf --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-packed.args @@ -0,0 +1,30 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0x2,packed=on \ +-device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x3,packed=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-input-packed.xml b/tests/qemuxml2argvdata/virtio-options-input-packed.xml new file mode 100644 index 00000000..1378b42d --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-input-packed.xml @@ -0,0 +1,30 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='virtio'> + <driver packed='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </input> + <input type='keyboard' bus='virtio'> + <driver packed='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </input> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-ats.args b/tests/qemuxml2argvdata/virtio-options-memballoon-ats.args new file mode 100644 index 00000000..bb507b74 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-ats.args @@ -0,0 +1,28 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2,ats=on diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml new file mode 100644 index 00000000..f1ac052c --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml @@ -0,0 +1,23 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <driver ats='on'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args b/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args new file mode 100644 index 00000000..9c1d15b8 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args @@ -0,0 +1,28 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2,iommu_platform=on diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml new file mode 100644 index 00000000..eba704e1 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml @@ -0,0 +1,23 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <driver iommu='on'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-packed.args b/tests/qemuxml2argvdata/virtio-options-memballoon-packed.args new file mode 100644 index 00000000..6bda122f --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-packed.args @@ -0,0 +1,28 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2,packed=on diff --git a/tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml b/tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml new file mode 100644 index 00000000..5597ef93 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml @@ -0,0 +1,23 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + <driver packed='on'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-net-ats.args b/tests/qemuxml2argvdata/virtio-options-net-ats.args new file mode 100644 index 00000000..020f1acd --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-ats.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ +addr=0x2,ats=on \ +-netdev user,id=hostnet1 \ +-device virtio-net-pci,netdev=hostnet1,id=net1,mac=62:64:66:68:6a:6c,bus=pci.0,\ +addr=0x3,ats=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-net-ats.xml b/tests/qemuxml2argvdata/virtio-options-net-ats.xml new file mode 100644 index 00000000..b1e3ff28 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-ats.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <interface type='user'> + <mac address='52:54:56:58:5a:5c'/> + <model type='virtio'/> + <driver ats='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </interface> + <interface type='user'> + <mac address='62:64:66:68:6a:6c'/> + <model type='virtio'/> + <driver ats='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-net-iommu.args b/tests/qemuxml2argvdata/virtio-options-net-iommu.args new file mode 100644 index 00000000..7d775c69 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-iommu.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ +addr=0x2,iommu_platform=on \ +-netdev user,id=hostnet1 \ +-device virtio-net-pci,netdev=hostnet1,id=net1,mac=62:64:66:68:6a:6c,bus=pci.0,\ +addr=0x3,iommu_platform=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-net-iommu.xml b/tests/qemuxml2argvdata/virtio-options-net-iommu.xml new file mode 100644 index 00000000..689eaa8f --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-iommu.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <interface type='user'> + <mac address='52:54:56:58:5a:5c'/> + <model type='virtio'/> + <driver iommu='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </interface> + <interface type='user'> + <mac address='62:64:66:68:6a:6c'/> + <model type='virtio'/> + <driver iommu='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-net-packed.args b/tests/qemuxml2argvdata/virtio-options-net-packed.args new file mode 100644 index 00000000..3122ff56 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-packed.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-netdev user,id=hostnet0 \ +-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ +addr=0x2,packed=on \ +-netdev user,id=hostnet1 \ +-device virtio-net-pci,netdev=hostnet1,id=net1,mac=62:64:66:68:6a:6c,bus=pci.0,\ +addr=0x3,packed=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-net-packed.xml b/tests/qemuxml2argvdata/virtio-options-net-packed.xml new file mode 100644 index 00000000..85e39761 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-net-packed.xml @@ -0,0 +1,34 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <interface type='user'> + <mac address='52:54:56:58:5a:5c'/> + <model type='virtio'/> + <driver packed='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </interface> + <interface type='user'> + <mac address='62:64:66:68:6a:6c'/> + <model type='virtio'/> + <driver packed='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </interface> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-rng-ats.args b/tests/qemuxml2argvdata/virtio-options-rng-ats.args new file mode 100644 index 00000000..2ce3be00 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-ats.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-object rng-random,id=objrng0,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng0,id=rng0,ats=on,bus=pci.0,addr=0x2 \ +-object rng-random,id=objrng1,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng1,id=rng1,ats=off,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/virtio-options-rng-ats.xml b/tests/qemuxml2argvdata/virtio-options-rng-ats.xml new file mode 100644 index 00000000..d4b0f5f1 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-ats.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver ats='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </rng> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver ats='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </rng> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-rng-iommu.args b/tests/qemuxml2argvdata/virtio-options-rng-iommu.args new file mode 100644 index 00000000..781d4293 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-iommu.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-object rng-random,id=objrng0,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,bus=pci.0,\ +addr=0x2 \ +-object rng-random,id=objrng1,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng1,id=rng1,iommu_platform=off,bus=pci.0,\ +addr=0x3 diff --git a/tests/qemuxml2argvdata/virtio-options-rng-iommu.xml b/tests/qemuxml2argvdata/virtio-options-rng-iommu.xml new file mode 100644 index 00000000..43bead71 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-iommu.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver iommu='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </rng> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver iommu='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </rng> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-rng-packed.args b/tests/qemuxml2argvdata/virtio-options-rng-packed.args new file mode 100644 index 00000000..c415314f --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-packed.args @@ -0,0 +1,32 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-object rng-random,id=objrng0,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng0,id=rng0,packed=on,bus=pci.0,addr=0x2 \ +-object rng-random,id=objrng1,filename=/dev/random \ +-device virtio-rng-pci,rng=objrng1,id=rng1,packed=off,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/virtio-options-rng-packed.xml b/tests/qemuxml2argvdata/virtio-options-rng-packed.xml new file mode 100644 index 00000000..22f7e413 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-rng-packed.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver packed='on'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </rng> + <rng model='virtio'> + <backend model='random'>/dev/random</backend> + <driver packed='off'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </rng> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-video-ats.args b/tests/qemuxml2argvdata/virtio-options-video-ats.args new file mode 100644 index 00000000..2d1a7086 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-ats.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-chardev socket,id=chr-vu-video0,fd=1729 \ +-chardev socket,id=chr-vu-video1,fd=1729 \ +-device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ +bus=pci.0,addr=0x2,ats=on \ +-device vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,\ +bus=pci.0,addr=0x3,ats=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-video-ats.xml b/tests/qemuxml2argvdata/virtio-options-video-ats.xml new file mode 100644 index 00000000..c39523d9 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-ats.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <video> + <driver ats='on' name='vhostuser'/> + <model type='virtio' heads='1' primary='yes'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <driver ats='off' name='vhostuser'/> + <model type='virtio' heads='1' primary='no'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-video-iommu.args b/tests/qemuxml2argvdata/virtio-options-video-iommu.args new file mode 100644 index 00000000..1ab891c5 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-iommu.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-chardev socket,id=chr-vu-video0,fd=1729 \ +-chardev socket,id=chr-vu-video1,fd=1729 \ +-device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ +bus=pci.0,addr=0x2,iommu_platform=on \ +-device vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,\ +bus=pci.0,addr=0x3,iommu_platform=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-video-iommu.xml b/tests/qemuxml2argvdata/virtio-options-video-iommu.xml new file mode 100644 index 00000000..13d921e2 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-iommu.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <video> + <driver iommu='on' name='vhostuser'/> + <model type='virtio' heads='1' primary='yes'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <driver iommu='off' name='vhostuser'/> + <model type='virtio' heads='1' primary='no'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/virtio-options-video-packed.args b/tests/qemuxml2argvdata/virtio-options-video-packed.args new file mode 100644 index 00000000..93551d0b --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-packed.args @@ -0,0 +1,34 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=tcg,usb=off,dump-guest-core=off \ +-m 214 \ +-realtime mlock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\ +server,nowait \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-chardev socket,id=chr-vu-video0,fd=1729 \ +-chardev socket,id=chr-vu-video1,fd=1729 \ +-device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ +bus=pci.0,addr=0x2,packed=on \ +-device vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,\ +bus=pci.0,addr=0x3,packed=off \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 diff --git a/tests/qemuxml2argvdata/virtio-options-video-packed.xml b/tests/qemuxml2argvdata/virtio-options-video-packed.xml new file mode 100644 index 00000000..4ef06b77 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-options-video-packed.xml @@ -0,0 +1,36 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219136</memory> + <currentMemory unit='KiB'>219136</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='pci' index='0' model='pci-root'/> + <video> + <driver packed='on' name='vhostuser'/> + <model type='virtio' heads='1' primary='yes'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <driver packed='off' name='vhostuser'/> + <model type='virtio' heads='1' primary='no'> + <acceleration accel3d='yes' rendernode='/dev/dri/test'/> + </model> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index dffca323..7ceb3aee 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2982,6 +2982,105 @@ mymain(void) QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); DO_TEST_CAPS_LATEST("virtio-options"); + DO_TEST("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-disk-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-fs-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-memballoon-iommu", + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-net-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-disk-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-fs-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-memballoon-ats", + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-net-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-disk-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-fs-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-memballoon-packed", + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-net-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST_FAILURE("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-iommu", NONE); + DO_TEST_FAILURE("virtio-options-fs-iommu", NONE); + DO_TEST_FAILURE("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-iommu", NONE); + DO_TEST_FAILURE("virtio-options-net-iommu", NONE); + DO_TEST_FAILURE("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_FAILURE("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-ats", NONE); + DO_TEST_FAILURE("virtio-options-fs-ats", NONE); + DO_TEST_FAILURE("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-ats", NONE); + DO_TEST_FAILURE("virtio-options-net-ats", NONE); + DO_TEST_FAILURE("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_FAILURE("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-packed", NONE); + DO_TEST_FAILURE("virtio-options-fs-packed", NONE); + DO_TEST_FAILURE("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-packed", NONE); + DO_TEST_FAILURE("virtio-options-net-packed", NONE); + DO_TEST_FAILURE("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); -- 2.24.1

On 4/23/20 3:15 PM, Bjoern Walk wrote:
Add separate tests for individual options and devices for virtio-options to have the ability to do more fine-granular testing of various combinations.
Also, add negative tests for unavailable capabilities.
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- .../virtio-options-controller-ats.args | 32 ++++++ .../virtio-options-controller-ats.xml | 38 +++++++ .../virtio-options-controller-iommu.args | 34 +++++++ .../virtio-options-controller-iommu.xml | 38 +++++++ .../virtio-options-controller-packed.args | 32 ++++++ .../virtio-options-controller-packed.xml | 38 +++++++ .../virtio-options-disk-ats.args | 36 +++++++ .../virtio-options-disk-ats.xml | 34 +++++++ .../virtio-options-disk-iommu.args | 36 +++++++ .../virtio-options-disk-iommu.xml | 34 +++++++ .../virtio-options-disk-packed.args | 36 +++++++ .../virtio-options-disk-packed.xml | 34 +++++++ .../virtio-options-fs-ats.args | 34 +++++++ .../virtio-options-fs-ats.xml | 34 +++++++ .../virtio-options-fs-iommu.args | 34 +++++++ .../virtio-options-fs-iommu.xml | 34 +++++++ .../virtio-options-fs-packed.args | 34 +++++++ .../virtio-options-fs-packed.xml | 34 +++++++ .../virtio-options-input-ats.args | 30 ++++++ .../virtio-options-input-ats.xml | 30 ++++++ .../virtio-options-input-iommu.args | 30 ++++++ .../virtio-options-input-iommu.xml | 30 ++++++ .../virtio-options-input-packed.args | 30 ++++++ .../virtio-options-input-packed.xml | 30 ++++++ .../virtio-options-memballoon-ats.args | 28 ++++++ .../virtio-options-memballoon-ats.xml | 23 +++++ .../virtio-options-memballoon-iommu.args | 28 ++++++ .../virtio-options-memballoon-iommu.xml | 23 +++++ .../virtio-options-memballoon-packed.args | 28 ++++++ .../virtio-options-memballoon-packed.xml | 23 +++++ .../virtio-options-net-ats.args | 34 +++++++ .../virtio-options-net-ats.xml | 34 +++++++ .../virtio-options-net-iommu.args | 34 +++++++ .../virtio-options-net-iommu.xml | 34 +++++++ .../virtio-options-net-packed.args | 34 +++++++ .../virtio-options-net-packed.xml | 34 +++++++ .../virtio-options-rng-ats.args | 32 ++++++ .../virtio-options-rng-ats.xml | 32 ++++++ .../virtio-options-rng-iommu.args | 34 +++++++ .../virtio-options-rng-iommu.xml | 32 ++++++ .../virtio-options-rng-packed.args | 32 ++++++ .../virtio-options-rng-packed.xml | 32 ++++++ .../virtio-options-video-ats.args | 34 +++++++ .../virtio-options-video-ats.xml | 36 +++++++ .../virtio-options-video-iommu.args | 34 +++++++ .../virtio-options-video-iommu.xml | 36 +++++++ .../virtio-options-video-packed.args | 34 +++++++ .../virtio-options-video-packed.xml | 36 +++++++ tests/qemuxml2argvtest.c | 99 +++++++++++++++++++ 49 files changed, 1666 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.xml
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index dffca323..7ceb3aee 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2982,6 +2982,105 @@ mymain(void) QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
DO_TEST_CAPS_LATEST("virtio-options"); + DO_TEST("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-disk-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-fs-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-memballoon-iommu", + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-net-iommu", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM); + DO_TEST("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-disk-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-fs-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-memballoon-ats", + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-net-ats", QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PCI_ATS); + DO_TEST("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-disk-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-fs-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-memballoon-packed", + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-net-packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); + DO_TEST_FAILURE("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-iommu", NONE); + DO_TEST_FAILURE("virtio-options-fs-iommu", NONE); + DO_TEST_FAILURE("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-iommu", NONE); + DO_TEST_FAILURE("virtio-options-net-iommu", NONE); + DO_TEST_FAILURE("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_FAILURE("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-ats", NONE); + DO_TEST_FAILURE("virtio-options-fs-ats", NONE); + DO_TEST_FAILURE("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-ats", NONE); + DO_TEST_FAILURE("virtio-options-net-ats", NONE); + DO_TEST_FAILURE("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_FAILURE("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_FAILURE("virtio-options-disk-packed", NONE); + DO_TEST_FAILURE("virtio-options-fs-packed", NONE); + DO_TEST_FAILURE("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_FAILURE("virtio-options-memballoon-packed", NONE); + DO_TEST_FAILURE("virtio-options-net-packed", NONE); + DO_TEST_FAILURE("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_FAILURE("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU);
Impressive. But should we turn these into DO_TEST_CAPS_LATEST() and DO_TEST_CAPS_LATEST_FAILURE() respectively? That would need to be followed by .args rename but I'm okay doing both locally if you agree. Michal

Michal Privoznik <mprivozn@redhat.com> [2020-04-27, 12:06PM +0200]:
Impressive. But should we turn these into DO_TEST_CAPS_LATEST() and DO_TEST_CAPS_LATEST_FAILURE() respectively? That would need to be followed by .args rename but I'm okay doing both locally if you agree.
Hmm, I am still a bit fuzzy on the semantics for the _LATEST() tests. For the positive tests, I guess that's fine, I don't see any side-effects with other capabilities. But how does it work with the negative tests? Can we switch off a capability here, or am I misunderstanding something? But yes, if it's working, I don't see a reason not to change it, even better, if you do the work :) Thanks.
Michal

On 4/27/20 4:41 PM, Bjoern Walk wrote:
Michal Privoznik <mprivozn@redhat.com> [2020-04-27, 12:06PM +0200]:
Impressive. But should we turn these into DO_TEST_CAPS_LATEST() and DO_TEST_CAPS_LATEST_FAILURE() respectively? That would need to be followed by .args rename but I'm okay doing both locally if you agree.
Hmm, I am still a bit fuzzy on the semantics for the _LATEST() tests. For the positive tests, I guess that's fine, I don't see any side-effects with other capabilities. But how does it work with the negative tests? Can we switch off a capability here, or am I misunderstanding something? But yes, if it's working, I don't see a reason not to change it, even better, if you do the work :)
Ah, I thought we are testing different XMLs but we are really testing the same XMLs with a different set of capabilities. Yeah, we can change the DO_TEST_CAPS_LATEST() then. The negative tests should stay as they are. Sorry for the noise. Michal

Move capability validation of virtio options from command line generation to post-parse device validation where it belongs. Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 41 ++++++-------------- src/qemu/qemu_validate.c | 70 +++++++++++++++++++++++++++++++-- tests/qemuxml2argvtest.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 120 insertions(+), 75 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 95402fc4..ca9d3f10 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -588,39 +588,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf, static int qemuBuildVirtioOptionsStr(virBufferPtr buf, - virDomainVirtioOptionsPtr virtio, - virQEMUCapsPtr qemuCaps) + virDomainVirtioOptionsPtr virtio) { if (!virtio) return 0; if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the iommu setting is not supported " - "with this QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",iommu_platform=%s", virTristateSwitchTypeToString(virtio->iommu)); } if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_ATS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the ats setting is not supported with this " - "QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",ats=%s", virTristateSwitchTypeToString(virtio->ats)); } if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the packed setting is not supported with this " - "QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } @@ -2150,7 +2131,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(&opt, ",num-queues=%u", disk->queues); } - if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, disk->virtio) < 0) return NULL; if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0) @@ -2615,7 +2596,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, virBufferAsprintf(&opt, ",queue-size=%llu", fs->queue_size); virBufferAddLit(&opt, ",tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, priv->qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) return -1; if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < 0) @@ -2685,7 +2666,7 @@ qemuBuildFSDevStr(const virDomainDef *def, virBufferAddLit(&opt, ",mount_tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) return NULL; if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0) @@ -2917,7 +2898,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, def->iothread); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) return -1; break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: @@ -2964,7 +2945,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, virBufferAsprintf(&buf, ",vectors=%d", def->opts.vioserial.vectors); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) return -1; break; @@ -3916,7 +3897,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, if (bootindex) virBufferAsprintf(&buf, ",bootindex=%u", bootindex); if (usingVirtio && - qemuBuildVirtioOptionsStr(&buf, net->virtio, qemuCaps) < 0) + qemuBuildVirtioOptionsStr(&buf, net->virtio) < 0) return NULL; return virBufferContentAndReset(&buf); @@ -4158,7 +4139,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virTristateSwitchTypeToString(def->memballoon->autodeflate)); } - if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio) < 0) return -1; if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) @@ -4250,7 +4231,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL; - if (qemuBuildVirtioOptionsStr(&buf, dev->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) return NULL; return virBufferContentAndReset(&buf); @@ -4561,7 +4542,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) return NULL; - if (qemuBuildVirtioOptionsStr(&buf, video->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, video->virtio) < 0) return NULL; return virBufferContentAndReset(&buf); @@ -5777,7 +5758,7 @@ qemuBuildRNGDevStr(const virDomainDef *def, virBufferAddLit(&buf, ",period=1000"); } - if (qemuBuildVirtioOptionsStr(&buf, dev->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) return NULL; if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index cb0ff8d6..76691a5b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1045,6 +1045,40 @@ qemuValidateNetSupportsCoalesce(virDomainNetType type) } +static int +qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio, + virQEMUCapsPtr qemuCaps) +{ + if (!virtio) + return 0; + + if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the iommu setting is not supported " + "with this QEMU binary")); + return -1; + } + + if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_ATS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the ats setting is not supported with this " + "QEMU binary")); + return -1; + } + + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the packed setting is not supported with this " + "QEMU binary")); + return -1; + } + return 0; +} + + static int qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, virQEMUCapsPtr qemuCaps) @@ -1122,6 +1156,8 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, _("tx_queue_size has to be a power of two")); return -1; } + if (qemuValidateDomainVirtioOptions(net->virtio, qemuCaps) < 0) + return -1; } if (net->mtu && @@ -1469,12 +1505,15 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *def, static int qemuValidateDomainRNGDef(const virDomainRNGDef *def, - virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) + virQEMUCapsPtr qemuCaps) { if (def->backend == VIR_DOMAIN_RNG_BACKEND_EGD && qemuValidateDomainChrSourceDef(def->source.chardev, qemuCaps) < 0) return -1; + if (qemuValidateDomainVirtioOptions(def->virtio, qemuCaps) < 0) + return -1; + return 0; } @@ -1818,6 +1857,9 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video, } } + if (qemuValidateDomainVirtioOptions(video->virtio, qemuCaps) < 0) + return -1; + return 0; } @@ -1916,6 +1958,11 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, return -1; } + if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO && + qemuValidateDomainVirtioOptions(disk->virtio, qemuCaps) < 0) { + return -1; + } + return 0; } @@ -2146,7 +2193,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName) static int -qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *controller) +qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *controller, + virQEMUCapsPtr qemuCaps) { if (!(controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI || @@ -2177,6 +2225,13 @@ qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *co _("'iothread' is only supported for virtio-scsi controller")); return -1; } + if (qemuValidateDomainVirtioOptions(controller->virtio, qemuCaps) < 0) + return -1; + } + + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && + qemuValidateDomainVirtioOptions(controller->virtio, qemuCaps) < 0) { + return -1; } return 0; @@ -2719,7 +2774,7 @@ qemuValidateDomainDeviceDefController(const virDomainControllerDef *controller, !qemuValidateCheckSCSIControllerModel(qemuCaps, controller->model)) return -1; - if (qemuValidateDomainDeviceDefControllerAttributes(controller) < 0) + if (qemuValidateDomainDeviceDefControllerAttributes(controller, qemuCaps) < 0) return -1; switch ((virDomainControllerType)controller->type) { @@ -3056,6 +3111,9 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, return -1; } + if (qemuValidateDomainVirtioOptions(fs->virtio, qemuCaps) < 0) + return -1; + return 0; } @@ -3324,6 +3382,9 @@ qemuValidateDomainDeviceDefInput(const virDomainInputDef *input, return -1; } + if (qemuValidateDomainVirtioOptions(input->virtio, qemuCaps) < 0) + return -1; + return 0; } @@ -3353,6 +3414,9 @@ qemuValidateDomainDeviceDefMemballoon(const virDomainMemballoonDef *memballoon, return -1; } + if (qemuValidateDomainVirtioOptions(memballoon->virtio, qemuCaps) < 0) + return -1; + return 0; } diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7ceb3aee..7a9c65f0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3039,48 +3039,48 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_VHOST_USER_GPU, QEMU_CAPS_VIRTIO_PACKED_QUEUES); - DO_TEST_FAILURE("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-iommu", NONE); - DO_TEST_FAILURE("virtio-options-fs-iommu", NONE); - DO_TEST_FAILURE("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-iommu", NONE); - DO_TEST_FAILURE("virtio-options-net-iommu", NONE); - DO_TEST_FAILURE("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); - DO_TEST_FAILURE("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-ats", NONE); - DO_TEST_FAILURE("virtio-options-fs-ats", NONE); - DO_TEST_FAILURE("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-ats", NONE); - DO_TEST_FAILURE("virtio-options-net-ats", NONE); - DO_TEST_FAILURE("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); - DO_TEST_FAILURE("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-packed", NONE); - DO_TEST_FAILURE("virtio-options-fs-packed", NONE); - DO_TEST_FAILURE("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-packed", NONE); - DO_TEST_FAILURE("virtio-options-net-packed", NONE); - DO_TEST_FAILURE("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-net-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-net-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-net-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); -- 2.24.1

Looks OK to me. Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 4/23/20 3:15 PM, Bjoern Walk wrote:
Move capability validation of virtio options from command line generation to post-parse device validation where it belongs.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 41 ++++++-------------- src/qemu/qemu_validate.c | 70 +++++++++++++++++++++++++++++++-- tests/qemuxml2argvtest.c | 84 ++++++++++++++++++++-------------------- 3 files changed, 120 insertions(+), 75 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 95402fc4..ca9d3f10 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -588,39 +588,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
static int qemuBuildVirtioOptionsStr(virBufferPtr buf, - virDomainVirtioOptionsPtr virtio, - virQEMUCapsPtr qemuCaps) + virDomainVirtioOptionsPtr virtio) { if (!virtio) return 0;
if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the iommu setting is not supported " - "with this QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",iommu_platform=%s", virTristateSwitchTypeToString(virtio->iommu)); } if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_ATS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the ats setting is not supported with this " - "QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",ats=%s", virTristateSwitchTypeToString(virtio->ats)); } if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the packed setting is not supported with this " - "QEMU binary")); - return -1; - } virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } @@ -2150,7 +2131,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(&opt, ",num-queues=%u", disk->queues); }
- if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, disk->virtio) < 0) return NULL;
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0) @@ -2615,7 +2596,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, virBufferAsprintf(&opt, ",queue-size=%llu", fs->queue_size); virBufferAddLit(&opt, ",tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, priv->qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) return -1;
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < 0) @@ -2685,7 +2666,7 @@ qemuBuildFSDevStr(const virDomainDef *def, virBufferAddLit(&opt, ",mount_tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst);
- if (qemuBuildVirtioOptionsStr(&opt, fs->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) return NULL;
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0) @@ -2917,7 +2898,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, def->iothread); }
- if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) return -1; break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: @@ -2964,7 +2945,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, virBufferAsprintf(&buf, ",vectors=%d", def->opts.vioserial.vectors); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) return -1; break;
@@ -3916,7 +3897,7 @@ qemuBuildNicDevStr(virDomainDefPtr def, if (bootindex) virBufferAsprintf(&buf, ",bootindex=%u", bootindex); if (usingVirtio && - qemuBuildVirtioOptionsStr(&buf, net->virtio, qemuCaps) < 0) + qemuBuildVirtioOptionsStr(&buf, net->virtio) < 0) return NULL;
return virBufferContentAndReset(&buf); @@ -4158,7 +4139,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virTristateSwitchTypeToString(def->memballoon->autodeflate)); }
- if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio) < 0) return -1;
if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) @@ -4250,7 +4231,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) return NULL;
return virBufferContentAndReset(&buf); @@ -4561,7 +4542,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, video->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, video->virtio) < 0) return NULL;
return virBufferContentAndReset(&buf); @@ -5777,7 +5758,7 @@ qemuBuildRNGDevStr(const virDomainDef *def, virBufferAddLit(&buf, ",period=1000"); }
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio, qemuCaps) < 0) + if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) return NULL;
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index cb0ff8d6..76691a5b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1045,6 +1045,40 @@ qemuValidateNetSupportsCoalesce(virDomainNetType type) }
+static int +qemuValidateDomainVirtioOptions(const virDomainVirtioOptions *virtio, + virQEMUCapsPtr qemuCaps) +{ + if (!virtio) + return 0; + + if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the iommu setting is not supported " + "with this QEMU binary")); + return -1; + } + + if (virtio->ats != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_ATS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the ats setting is not supported with this " + "QEMU binary")); + return -1; + } + + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the packed setting is not supported with this " + "QEMU binary")); + return -1; + } + return 0; +} + + static int qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, virQEMUCapsPtr qemuCaps) @@ -1122,6 +1156,8 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, _("tx_queue_size has to be a power of two")); return -1; } + if (qemuValidateDomainVirtioOptions(net->virtio, qemuCaps) < 0) + return -1; }
if (net->mtu && @@ -1469,12 +1505,15 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *def,
static int qemuValidateDomainRNGDef(const virDomainRNGDef *def, - virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) + virQEMUCapsPtr qemuCaps) { if (def->backend == VIR_DOMAIN_RNG_BACKEND_EGD && qemuValidateDomainChrSourceDef(def->source.chardev, qemuCaps) < 0) return -1;
+ if (qemuValidateDomainVirtioOptions(def->virtio, qemuCaps) < 0) + return -1; + return 0; }
@@ -1818,6 +1857,9 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video, } }
+ if (qemuValidateDomainVirtioOptions(video->virtio, qemuCaps) < 0) + return -1; + return 0; }
@@ -1916,6 +1958,11 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, return -1; }
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO && + qemuValidateDomainVirtioOptions(disk->virtio, qemuCaps) < 0) { + return -1; + } + return 0; }
@@ -2146,7 +2193,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName)
static int -qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *controller) +qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *controller, + virQEMUCapsPtr qemuCaps) { if (!(controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI || @@ -2177,6 +2225,13 @@ qemuValidateDomainDeviceDefControllerAttributes(const virDomainControllerDef *co _("'iothread' is only supported for virtio-scsi controller")); return -1; } + if (qemuValidateDomainVirtioOptions(controller->virtio, qemuCaps) < 0) + return -1; + } + + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL && + qemuValidateDomainVirtioOptions(controller->virtio, qemuCaps) < 0) { + return -1; }
return 0; @@ -2719,7 +2774,7 @@ qemuValidateDomainDeviceDefController(const virDomainControllerDef *controller, !qemuValidateCheckSCSIControllerModel(qemuCaps, controller->model)) return -1;
- if (qemuValidateDomainDeviceDefControllerAttributes(controller) < 0) + if (qemuValidateDomainDeviceDefControllerAttributes(controller, qemuCaps) < 0) return -1;
switch ((virDomainControllerType)controller->type) { @@ -3056,6 +3111,9 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, return -1; }
+ if (qemuValidateDomainVirtioOptions(fs->virtio, qemuCaps) < 0) + return -1; + return 0; }
@@ -3324,6 +3382,9 @@ qemuValidateDomainDeviceDefInput(const virDomainInputDef *input, return -1; }
+ if (qemuValidateDomainVirtioOptions(input->virtio, qemuCaps) < 0) + return -1; + return 0; }
@@ -3353,6 +3414,9 @@ qemuValidateDomainDeviceDefMemballoon(const virDomainMemballoonDef *memballoon, return -1; }
+ if (qemuValidateDomainVirtioOptions(memballoon->virtio, qemuCaps) < 0) + return -1; + return 0; }
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7ceb3aee..7a9c65f0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3039,48 +3039,48 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_VHOST_USER_GPU, QEMU_CAPS_VIRTIO_PACKED_QUEUES); - DO_TEST_FAILURE("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-iommu", NONE); - DO_TEST_FAILURE("virtio-options-fs-iommu", NONE); - DO_TEST_FAILURE("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-iommu", NONE); - DO_TEST_FAILURE("virtio-options-net-iommu", NONE); - DO_TEST_FAILURE("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); - DO_TEST_FAILURE("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-ats", NONE); - DO_TEST_FAILURE("virtio-options-fs-ats", NONE); - DO_TEST_FAILURE("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-ats", NONE); - DO_TEST_FAILURE("virtio-options-net-ats", NONE); - DO_TEST_FAILURE("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); - DO_TEST_FAILURE("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_FAILURE("virtio-options-disk-packed", NONE); - DO_TEST_FAILURE("virtio-options-fs-packed", NONE); - DO_TEST_FAILURE("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, - QEMU_CAPS_VIRTIO_KEYBOARD); - DO_TEST_FAILURE("virtio-options-memballoon-packed", NONE); - DO_TEST_FAILURE("virtio-options-net-packed", NONE); - DO_TEST_FAILURE("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST_FAILURE("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_DEVICE_VIRTIO_GPU, - QEMU_CAPS_VIRTIO_GPU_VIRGL, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-iommu", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-iommu", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-net-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-iommu", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-iommu", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-iommu", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-ats", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-ats", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-net-ats", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-ats", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-ats", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU); + DO_TEST_PARSE_ERROR("virtio-options-controller-packed", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_PARSE_ERROR("virtio-options-disk-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-fs-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-input-packed", QEMU_CAPS_VIRTIO_MOUSE, + QEMU_CAPS_VIRTIO_KEYBOARD); + DO_TEST_PARSE_ERROR("virtio-options-memballoon-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-net-packed", NONE); + DO_TEST_PARSE_ERROR("virtio-options-rng-packed", QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_PARSE_ERROR("virtio-options-video-packed", QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, + QEMU_CAPS_DEVICE_VHOST_USER_GPU);
DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM);
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

Now that qemuBuildVirtioOptionsStr can not fail anymore, remove its return value and make it void. Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ca9d3f10..169a418f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -586,12 +586,12 @@ qemuBuildVirtioDevStr(virBufferPtr buf, return 0; } -static int +static void qemuBuildVirtioOptionsStr(virBufferPtr buf, virDomainVirtioOptionsPtr virtio) { if (!virtio) - return 0; + return; if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(buf, ",iommu_platform=%s", @@ -605,8 +605,6 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf, virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } - - return 0; } static int @@ -2131,8 +2129,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(&opt, ",num-queues=%u", disk->queues); } - if (qemuBuildVirtioOptionsStr(&opt, disk->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&opt, disk->virtio); if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0) return NULL; @@ -2596,8 +2593,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, virBufferAsprintf(&opt, ",queue-size=%llu", fs->queue_size); virBufferAddLit(&opt, ",tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&opt, fs->virtio); if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < 0) return -1; @@ -2666,8 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def, virBufferAddLit(&opt, ",mount_tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&opt, fs->virtio); if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0) return NULL; @@ -2898,8 +2893,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, def->iothread); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->virtio); break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: virBufferAddLit(&buf, "lsi"); @@ -2945,8 +2939,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, virBufferAsprintf(&buf, ",vectors=%d", def->opts.vioserial.vectors); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->virtio); break; case VIR_DOMAIN_CONTROLLER_TYPE_CCID: @@ -3896,9 +3889,8 @@ qemuBuildNicDevStr(virDomainDefPtr def, return NULL; if (bootindex) virBufferAsprintf(&buf, ",bootindex=%u", bootindex); - if (usingVirtio && - qemuBuildVirtioOptionsStr(&buf, net->virtio) < 0) - return NULL; + if (usingVirtio) + qemuBuildVirtioOptionsStr(&buf, net->virtio); return virBufferContentAndReset(&buf); } @@ -4139,8 +4131,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virTristateSwitchTypeToString(def->memballoon->autodeflate)); } - if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio); if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) return -1; @@ -4231,8 +4222,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL; - if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, dev->virtio); return virBufferContentAndReset(&buf); } @@ -4542,8 +4532,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) return NULL; - if (qemuBuildVirtioOptionsStr(&buf, video->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, video->virtio); return virBufferContentAndReset(&buf); } @@ -5758,8 +5747,7 @@ qemuBuildRNGDevStr(const virDomainDef *def, virBufferAddLit(&buf, ",period=1000"); } - if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, dev->virtio); if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL; -- 2.24.1

Thanks, Björn. Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 4/23/20 3:15 PM, Bjoern Walk wrote:
Now that qemuBuildVirtioOptionsStr can not fail anymore, remove its return value and make it void.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ca9d3f10..169a418f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -586,12 +586,12 @@ qemuBuildVirtioDevStr(virBufferPtr buf, return 0; }
-static int +static void qemuBuildVirtioOptionsStr(virBufferPtr buf, virDomainVirtioOptionsPtr virtio) { if (!virtio) - return 0; + return;
if (virtio->iommu != VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(buf, ",iommu_platform=%s", @@ -605,8 +605,6 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf, virBufferAsprintf(buf, ",packed=%s", virTristateSwitchTypeToString(virtio->packed)); } - - return 0; }
static int @@ -2131,8 +2129,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, virBufferAsprintf(&opt, ",num-queues=%u", disk->queues); }
- if (qemuBuildVirtioOptionsStr(&opt, disk->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&opt, disk->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0) return NULL; @@ -2596,8 +2593,7 @@ qemuBuildVHostUserFsCommandLine(virCommandPtr cmd, virBufferAsprintf(&opt, ",queue-size=%llu", fs->queue_size); virBufferAddLit(&opt, ",tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst); - if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&opt, fs->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, priv->qemuCaps) < 0) return -1; @@ -2666,8 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def, virBufferAddLit(&opt, ",mount_tag="); virQEMUBuildBufferEscapeComma(&opt, fs->dst);
- if (qemuBuildVirtioOptionsStr(&opt, fs->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&opt, fs->virtio);
if (qemuBuildDeviceAddressStr(&opt, def, &fs->info, qemuCaps) < 0) return NULL; @@ -2898,8 +2893,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, def->iothread); }
- if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->virtio); break; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: virBufferAddLit(&buf, "lsi"); @@ -2945,8 +2939,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, virBufferAsprintf(&buf, ",vectors=%d", def->opts.vioserial.vectors); } - if (qemuBuildVirtioOptionsStr(&buf, def->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->virtio); break;
case VIR_DOMAIN_CONTROLLER_TYPE_CCID: @@ -3896,9 +3889,8 @@ qemuBuildNicDevStr(virDomainDefPtr def, return NULL; if (bootindex) virBufferAsprintf(&buf, ",bootindex=%u", bootindex); - if (usingVirtio && - qemuBuildVirtioOptionsStr(&buf, net->virtio) < 0) - return NULL; + if (usingVirtio) + qemuBuildVirtioOptionsStr(&buf, net->virtio);
return virBufferContentAndReset(&buf); } @@ -4139,8 +4131,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, virTristateSwitchTypeToString(def->memballoon->autodeflate)); }
- if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio) < 0) - return -1; + qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio);
if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) return -1; @@ -4231,8 +4222,7 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, dev->virtio);
return virBufferContentAndReset(&buf); } @@ -4542,8 +4532,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) return NULL;
- if (qemuBuildVirtioOptionsStr(&buf, video->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, video->virtio);
return virBufferContentAndReset(&buf); } @@ -5758,8 +5747,7 @@ qemuBuildRNGDevStr(const virDomainDef *def, virBufferAddLit(&buf, ",period=1000"); }
- if (qemuBuildVirtioOptionsStr(&buf, dev->virtio) < 0) - return NULL; + qemuBuildVirtioOptionsStr(&buf, dev->virtio);
if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) return NULL;
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 4/23/20 10:15 AM, Bjoern Walk wrote:
Move validation of virtio options (iommu, ats, packed) from QEMU command line generation to domain validation. As a drive-by, increase the granularity of tests for virtio options.
Thanks for contributing with the move of validation code. The new fine-grained tests are a nice touch too. All patches: Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

Daniel Henrique Barboza <danielhb413@gmail.com> [2020-04-24, 05:57PM -0300]:
On 4/23/20 10:15 AM, Bjoern Walk wrote:
Move validation of virtio options (iommu, ats, packed) from QEMU command line generation to domain validation. As a drive-by, increase the granularity of tests for virtio options.
Thanks for contributing with the move of validation code. The new fine-grained tests are a nice touch too.
All patches:
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Thanks! -- IBM Systems Linux on Z & Virtualization Development -------------------------------------------------- IBM Deutschland Research & Development GmbH Schönaicher Str. 220, 71032 Böblingen Phone: +49 7031 16 1819 -------------------------------------------------- Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 4/23/20 3:15 PM, Bjoern Walk wrote:
Move validation of virtio options (iommu, ats, packed) from QEMU command line generation to domain validation. As a drive-by, increase the granularity of tests for virtio options.
Bjoern Walk (4): tests: use latest caps for virtio-options test tests: more fine-granular tests for virtio-options qemu: move virtio capability validation qemu: command: make qemuBuildVirtioOptionsStr void
src/qemu/qemu_command.c | 59 +++------- src/qemu/qemu_validate.c | 70 +++++++++++- .../virtio-options-controller-ats.args | 32 ++++++ .../virtio-options-controller-ats.xml | 38 +++++++ .../virtio-options-controller-iommu.args | 34 ++++++ .../virtio-options-controller-iommu.xml | 38 +++++++ .../virtio-options-controller-packed.args | 32 ++++++ .../virtio-options-controller-packed.xml | 38 +++++++ .../virtio-options-disk-ats.args | 36 +++++++ .../virtio-options-disk-ats.xml | 34 ++++++ .../virtio-options-disk-iommu.args | 36 +++++++ .../virtio-options-disk-iommu.xml | 34 ++++++ .../virtio-options-disk-packed.args | 36 +++++++ .../virtio-options-disk-packed.xml | 34 ++++++ .../virtio-options-fs-ats.args | 34 ++++++ .../virtio-options-fs-ats.xml | 34 ++++++ .../virtio-options-fs-iommu.args | 34 ++++++ .../virtio-options-fs-iommu.xml | 34 ++++++ .../virtio-options-fs-packed.args | 34 ++++++ .../virtio-options-fs-packed.xml | 34 ++++++ .../virtio-options-input-ats.args | 30 ++++++ .../virtio-options-input-ats.xml | 30 ++++++ .../virtio-options-input-iommu.args | 30 ++++++ .../virtio-options-input-iommu.xml | 30 ++++++ .../virtio-options-input-packed.args | 30 ++++++ .../virtio-options-input-packed.xml | 30 ++++++ .../virtio-options-memballoon-ats.args | 28 +++++ .../virtio-options-memballoon-ats.xml | 23 ++++ .../virtio-options-memballoon-iommu.args | 28 +++++ .../virtio-options-memballoon-iommu.xml | 23 ++++ .../virtio-options-memballoon-packed.args | 28 +++++ .../virtio-options-memballoon-packed.xml | 23 ++++ .../virtio-options-net-ats.args | 34 ++++++ .../virtio-options-net-ats.xml | 34 ++++++ .../virtio-options-net-iommu.args | 34 ++++++ .../virtio-options-net-iommu.xml | 34 ++++++ .../virtio-options-net-packed.args | 34 ++++++ .../virtio-options-net-packed.xml | 34 ++++++ .../virtio-options-rng-ats.args | 32 ++++++ .../virtio-options-rng-ats.xml | 32 ++++++ .../virtio-options-rng-iommu.args | 34 ++++++ .../virtio-options-rng-iommu.xml | 32 ++++++ .../virtio-options-rng-packed.args | 32 ++++++ .../virtio-options-rng-packed.xml | 32 ++++++ .../virtio-options-video-ats.args | 34 ++++++ .../virtio-options-video-ats.xml | 36 +++++++ .../virtio-options-video-iommu.args | 34 ++++++ .../virtio-options-video-iommu.xml | 36 +++++++ .../virtio-options-video-packed.args | 34 ++++++ .../virtio-options-video-packed.xml | 36 +++++++ .../virtio-options.x86_64-latest.args | 69 ++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 101 ++++++++++++++++-- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +-- 55 files changed, 1818 insertions(+), 70 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal

Michal Privoznik <mprivozn@redhat.com> [2020-04-27, 05:27PM +0200]:
On 4/23/20 3:15 PM, Bjoern Walk wrote:
Move validation of virtio options (iommu, ats, packed) from QEMU command line generation to domain validation. As a drive-by, increase the granularity of tests for virtio options.
Bjoern Walk (4): tests: use latest caps for virtio-options test tests: more fine-granular tests for virtio-options qemu: move virtio capability validation qemu: command: make qemuBuildVirtioOptionsStr void
src/qemu/qemu_command.c | 59 +++------- src/qemu/qemu_validate.c | 70 +++++++++++- .../virtio-options-controller-ats.args | 32 ++++++ .../virtio-options-controller-ats.xml | 38 +++++++ .../virtio-options-controller-iommu.args | 34 ++++++ .../virtio-options-controller-iommu.xml | 38 +++++++ .../virtio-options-controller-packed.args | 32 ++++++ .../virtio-options-controller-packed.xml | 38 +++++++ .../virtio-options-disk-ats.args | 36 +++++++ .../virtio-options-disk-ats.xml | 34 ++++++ .../virtio-options-disk-iommu.args | 36 +++++++ .../virtio-options-disk-iommu.xml | 34 ++++++ .../virtio-options-disk-packed.args | 36 +++++++ .../virtio-options-disk-packed.xml | 34 ++++++ .../virtio-options-fs-ats.args | 34 ++++++ .../virtio-options-fs-ats.xml | 34 ++++++ .../virtio-options-fs-iommu.args | 34 ++++++ .../virtio-options-fs-iommu.xml | 34 ++++++ .../virtio-options-fs-packed.args | 34 ++++++ .../virtio-options-fs-packed.xml | 34 ++++++ .../virtio-options-input-ats.args | 30 ++++++ .../virtio-options-input-ats.xml | 30 ++++++ .../virtio-options-input-iommu.args | 30 ++++++ .../virtio-options-input-iommu.xml | 30 ++++++ .../virtio-options-input-packed.args | 30 ++++++ .../virtio-options-input-packed.xml | 30 ++++++ .../virtio-options-memballoon-ats.args | 28 +++++ .../virtio-options-memballoon-ats.xml | 23 ++++ .../virtio-options-memballoon-iommu.args | 28 +++++ .../virtio-options-memballoon-iommu.xml | 23 ++++ .../virtio-options-memballoon-packed.args | 28 +++++ .../virtio-options-memballoon-packed.xml | 23 ++++ .../virtio-options-net-ats.args | 34 ++++++ .../virtio-options-net-ats.xml | 34 ++++++ .../virtio-options-net-iommu.args | 34 ++++++ .../virtio-options-net-iommu.xml | 34 ++++++ .../virtio-options-net-packed.args | 34 ++++++ .../virtio-options-net-packed.xml | 34 ++++++ .../virtio-options-rng-ats.args | 32 ++++++ .../virtio-options-rng-ats.xml | 32 ++++++ .../virtio-options-rng-iommu.args | 34 ++++++ .../virtio-options-rng-iommu.xml | 32 ++++++ .../virtio-options-rng-packed.args | 32 ++++++ .../virtio-options-rng-packed.xml | 32 ++++++ .../virtio-options-video-ats.args | 34 ++++++ .../virtio-options-video-ats.xml | 36 +++++++ .../virtio-options-video-iommu.args | 34 ++++++ .../virtio-options-video-iommu.xml | 36 +++++++ .../virtio-options-video-packed.args | 34 ++++++ .../virtio-options-video-packed.xml | 36 +++++++ .../virtio-options.x86_64-latest.args | 69 ++++++++++++ tests/qemuxml2argvdata/virtio-options.xml | 5 +- tests/qemuxml2argvtest.c | 101 ++++++++++++++++-- .../virtio-options.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 16 +-- 55 files changed, 1818 insertions(+), 70 deletions(-) create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-controller-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-disk-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-fs-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-input-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-memballoon-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-net-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-rng-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-ats.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-iommu.xml create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.args create mode 100644 tests/qemuxml2argvdata/virtio-options-video-packed.xml create mode 100644 tests/qemuxml2argvdata/virtio-options.x86_64-latest.args create mode 120000 tests/qemuxml2xmloutdata/virtio-options.x86_64-latest.xml
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
and pushed.
Cool, thanks!
Michal
participants (4)
-
Bjoern Walk
-
Boris Fiuczynski
-
Daniel Henrique Barboza
-
Michal Privoznik