Re: [PATCH 3/4] qemu: command: support for virtio packed option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks sane as well
Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>


On 3/26/20 11:32 AM, Bjoern Walk wrote:
Pass the packed option on the QEMU command line of the capability for
packed virtqueues is detected and the parameter is set explicitly.

Signed-off-by: Bjoern Walk <bwalk@xxxxxxxxxxxxx>
---
  src/qemu/qemu_command.c                    | 10 +++++++
  tests/qemuxml2argvdata/virtio-options.args | 32 ++++++++++++----------
  tests/qemuxml2argvdata/virtio-options.xml  | 26 +++++++++---------
  tests/qemuxml2argvtest.c                   |  3 +-
  tests/qemuxml2xmltest.c                    |  3 +-
  5 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d1b689df..81f089ba 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 33ecd8f4..8253a788 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 dd9a4f4a..3ca27840 100644
--- a/tests/qemuxml2argvdata/virtio-options.xml
+++ b/tests/qemuxml2argvdata/virtio-options.xml
@@ -15,7 +15,7 @@
    <devices>
      <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <disk type='file' device='disk'>
-      <driver name='qemu' type='raw' iommu='on' ats='on'/>
+      <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/>
        <source file='/var/lib/libvirt/images/img1'/>
        <target dev='vda' bus='virtio'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
@@ -27,22 +27,22 @@
        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
      </controller>
      <controller type='scsi' index='0' model='virtio-scsi'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
      </controller>
      <controller type='pci' index='0' model='pci-root'/>
      <controller type='virtio-serial' index='0'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
      </controller>
      <filesystem type='mount' accessmode='passthrough'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <source dir='/export/fs1'/>
        <target dir='fs1'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
      </filesystem>
      <filesystem type='mount' accessmode='mapped'>
-      <driver type='path' wrpolicy='immediate' iommu='on' ats='on'/>
+      <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/>
        <source dir='/export/fs2'/>
        <target dir='fs2'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
@@ -50,30 +50,30 @@
      <interface type='user'>
        <mac address='52:54:56:58:5a:5c'/>
        <model type='virtio'/>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
      </interface>
      <input type='mouse' bus='virtio'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
      </input>
      <input type='keyboard' bus='virtio'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
      </input>
      <input type='tablet' bus='virtio'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
      </input>
      <input type='passthrough' bus='virtio'>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <source evdev='/dev/input/event1234'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
      </input>
      <input type='mouse' bus='ps2'/>
      <input type='keyboard' bus='ps2'/>
      <video>
-      <driver iommu='on' ats='on' name='vhostuser'/>
+      <driver iommu='on' ats='on' packed='on' name='vhostuser'/>
        <model type='virtio' heads='1' primary='yes'>
          <acceleration accel3d='yes' rendernode='/dev/dri/test'/>
        </model>
@@ -81,11 +81,11 @@
      </video>
      <memballoon model='virtio'>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
      </memballoon>
      <rng model='virtio'>
        <backend model='random'>/dev/random</backend>
-      <driver iommu='on' ats='on'/>
+      <driver iommu='on' ats='on' packed='on'/>
        <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
      </rng>
    </devices>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 4d44286b..f66c9854 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2987,7 +2987,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 a3c25b4a..5675957d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1289,7 +1289,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);



--
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






[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux