diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 988d38e434..8c6c95a5b9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -614,6 +614,16 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf, 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)); + } return 0; } diff --git a/tests/qemuxml2argvdata/virtio-options.args b/tests/qemuxml2argvdata/virtio-options.args index 33ecd8f4e8..8253a78830 100644 --- a/tests/qemuxml2argvdata/virtio-options.args +++ b/tests/qemuxml2argvdata/virtio-options.args @@ -24,36 +24,38 @@ server,nowait \ -rtc base=utc \ -no-shutdown \ -no-acpi \ --device virtio-scsi-pci,iommu_platform=on,ats=on,id=scsi0,bus=pci.0,addr=0x8 \ --device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,bus=pci.0,\ -addr=0x9 \ +-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 \ -usb \ -drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ id=drive-virtio-disk0 \ --device virtio-blk-pci,iommu_platform=on,ats=on,bus=pci.0,addr=0xa,\ +-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,\ drive=drive-virtio-disk0,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,bus=pci.0,addr=0x3 \ +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,bus=pci.0,addr=0x4 \ +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 \ --device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on \ +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 \ +ats=on,packed=on \ -device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,\ -ats=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 \ +addr=0x12,iommu_platform=on,ats=on,packed=on \ -chardev socket,id=chr-vu-video0,fd=1729 \ -device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ -bus=pci.0,addr=0x2,iommu_platform=on,ats=on \ +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 \ +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,bus=pci.0,\ -addr=0xd +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0xd diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml index dd9a4f4a01..3ca2784057 100644 --- a/tests/qemuxml2argvdata/virtio-options.xml +++ b/tests/qemuxml2argvdata/virtio-options.xml @@ -15,7 +15,7 @@ /usr/bin/qemu-system-x86_64 - +
@@ -27,22 +27,22 @@
- +
- +
- +
- +
@@ -50,30 +50,30 @@ - +
- +
- +
- +
- +
- + /dev/random - +
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fdeb3c2e65..405227fdf6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2989,7 +2989,8 @@ mymain(void) QEMU_CAPS_OBJECT_RNG_RANDOM, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - QEMU_CAPS_VIRTIO_PCI_ATS); + QEMU_CAPS_VIRTIO_PCI_ATS, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index b4c83fccca..756d4e2ce6 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1291,7 +1291,8 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, QEMU_CAPS_VIRTIO_PCI_ATS, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM);