render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
119c2d
From 563e17f59f088d4ba76e7a95ea8958792ae165e2 Mon Sep 17 00:00:00 2001
119c2d
Message-Id: <563e17f59f088d4ba76e7a95ea8958792ae165e2@dist-git>
119c2d
From: Jonathon Jongsma <jjongsma@redhat.com>
119c2d
Date: Tue, 1 Mar 2022 16:55:21 -0600
119c2d
Subject: [PATCH] qemu: support multiqueue for vdpa net device
119c2d
119c2d
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406
119c2d
119c2d
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
119c2d
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
119c2d
119c2d
(cherry picked from commit a5e659f071ae5f5fc9aadb46ad7c31736425f8cf)
119c2d
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
119c2d
---
119c2d
 src/qemu/qemu_domain.c                        |  3 +-
119c2d
 .../net-vdpa-multiqueue.x86_64-latest.args    | 36 +++++++++++++++++++
119c2d
 .../qemuxml2argvdata/net-vdpa-multiqueue.xml  | 30 ++++++++++++++++
119c2d
 tests/qemuxml2argvtest.c                      |  1 +
119c2d
 .../net-vdpa-multiqueue.xml                   | 36 +++++++++++++++++++
119c2d
 tests/qemuxml2xmltest.c                       |  1 +
119c2d
 6 files changed, 106 insertions(+), 1 deletion(-)
119c2d
 create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
119c2d
 create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
119c2d
 create mode 100644 tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
119c2d
119c2d
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
119c2d
index a8401bac30..68052769af 100644
119c2d
--- a/src/qemu/qemu_domain.c
119c2d
+++ b/src/qemu/qemu_domain.c
119c2d
@@ -4511,7 +4511,8 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,
119c2d
               actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
119c2d
               actualType == VIR_DOMAIN_NET_TYPE_DIRECT ||
119c2d
               actualType == VIR_DOMAIN_NET_TYPE_ETHERNET ||
119c2d
-              actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) {
119c2d
+              actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER ||
119c2d
+              actualType == VIR_DOMAIN_NET_TYPE_VDPA)) {
119c2d
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
119c2d
                            _("interface %s - multiqueue is not supported for network interfaces of type %s"),
119c2d
                            macstr, virDomainNetTypeToString(actualType));
119c2d
diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
119c2d
new file mode 100644
119c2d
index 0000000000..61ba85a847
119c2d
--- /dev/null
119c2d
+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
119c2d
@@ -0,0 +1,36 @@
119c2d
+LC_ALL=C \
119c2d
+PATH=/bin \
119c2d
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
119c2d
+USER=test \
119c2d
+LOGNAME=test \
119c2d
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
119c2d
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
119c2d
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
119c2d
+/usr/bin/qemu-system-x86_64 \
119c2d
+-name guest=QEMUGuest1,debug-threads=on \
119c2d
+-S \
119c2d
+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
119c2d
+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
119c2d
+-accel tcg \
119c2d
+-cpu qemu64 \
119c2d
+-m 214 \
119c2d
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
119c2d
+-overcommit mem-lock=off \
119c2d
+-smp 1,sockets=1,cores=1,threads=1 \
119c2d
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
119c2d
+-display none \
119c2d
+-no-user-config \
119c2d
+-nodefaults \
119c2d
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
119c2d
+-mon chardev=charmonitor,id=monitor,mode=control \
119c2d
+-rtc base=utc \
119c2d
+-no-shutdown \
119c2d
+-no-acpi \
119c2d
+-boot strict=on \
119c2d
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
119c2d
+-add-fd set=0,fd=1732,opaque=/dev/vhost-vdpa-0 \
119c2d
+-netdev vhost-vdpa,vhostdev=/dev/fdset/0,id=hostnet0 \
119c2d
+-device virtio-net-pci,mq=on,vectors=6,netdev=hostnet0,id=net0,mac=52:54:00:95:db:c0,bus=pci.0,addr=0x2 \
119c2d
+-audiodev '{"id":"audio1","driver":"none"}' \
119c2d
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
119c2d
+-msg timestamp=on
119c2d
diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
119c2d
new file mode 100644
119c2d
index 0000000000..6e369c1916
119c2d
--- /dev/null
119c2d
+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml
119c2d
@@ -0,0 +1,30 @@
119c2d
+<domain type='qemu'>
119c2d
+  <name>QEMUGuest1</name>
119c2d
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
119c2d
+  <memory unit='KiB'>219136</memory>
119c2d
+  <currentMemory unit='KiB'>219136</currentMemory>
119c2d
+  <vcpu placement='static'>1</vcpu>
119c2d
+  <os>
119c2d
+    <type arch='x86_64' machine='pc'>hvm</type>
119c2d
+    <boot dev='hd'/>
119c2d
+  </os>
119c2d
+  <clock offset='utc'/>
119c2d
+  <on_poweroff>destroy</on_poweroff>
119c2d
+  <on_reboot>restart</on_reboot>
119c2d
+  <on_crash>destroy</on_crash>
119c2d
+  <devices>
119c2d
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
119c2d
+    <controller type='usb' index='0'/>
119c2d
+    <controller type='ide' index='0'/>
119c2d
+    <controller type='pci' index='0' model='pci-root'/>
119c2d
+    <interface type='vdpa'>
119c2d
+      <mac address='52:54:00:95:db:c0'/>
119c2d
+      <source dev='/dev/vhost-vdpa-0'/>
119c2d
+      <model type='virtio'/>
119c2d
+      <driver queues='2'/>
119c2d
+    </interface>
119c2d
+    <input type='mouse' bus='ps2'/>
119c2d
+    <input type='keyboard' bus='ps2'/>
119c2d
+    <memballoon model='none'/>
119c2d
+  </devices>
119c2d
+</domain>
119c2d
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
119c2d
index cc67d806e4..1abb5d0124 100644
119c2d
--- a/tests/qemuxml2argvtest.c
119c2d
+++ b/tests/qemuxml2argvtest.c
119c2d
@@ -1652,6 +1652,7 @@ mymain(void)
119c2d
     DO_TEST_FAILURE("net-hostdev-fail",
119c2d
                     QEMU_CAPS_DEVICE_VFIO_PCI);
119c2d
     DO_TEST_CAPS_LATEST("net-vdpa");
119c2d
+    DO_TEST_CAPS_LATEST("net-vdpa-multiqueue");
119c2d
 
119c2d
     DO_TEST("hostdev-pci-multifunction",
119c2d
             QEMU_CAPS_KVM,
119c2d
diff --git a/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
119c2d
new file mode 100644
119c2d
index 0000000000..0876d5df62
119c2d
--- /dev/null
119c2d
+++ b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml
119c2d
@@ -0,0 +1,36 @@
119c2d
+<domain type='qemu'>
119c2d
+  <name>QEMUGuest1</name>
119c2d
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
119c2d
+  <memory unit='KiB'>219136</memory>
119c2d
+  <currentMemory unit='KiB'>219136</currentMemory>
119c2d
+  <vcpu placement='static'>1</vcpu>
119c2d
+  <os>
119c2d
+    <type arch='x86_64' machine='pc'>hvm</type>
119c2d
+    <boot dev='hd'/>
119c2d
+  </os>
119c2d
+  <clock offset='utc'/>
119c2d
+  <on_poweroff>destroy</on_poweroff>
119c2d
+  <on_reboot>restart</on_reboot>
119c2d
+  <on_crash>destroy</on_crash>
119c2d
+  <devices>
119c2d
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
119c2d
+    <controller type='usb' index='0'>
119c2d
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
119c2d
+    </controller>
119c2d
+    <controller type='ide' index='0'>
119c2d
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
119c2d
+    </controller>
119c2d
+    <controller type='pci' index='0' model='pci-root'/>
119c2d
+    <interface type='vdpa'>
119c2d
+      <mac address='52:54:00:95:db:c0'/>
119c2d
+      <source dev='/dev/vhost-vdpa-0'/>
119c2d
+      <model type='virtio'/>
119c2d
+      <driver queues='2'/>
119c2d
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
119c2d
+    </interface>
119c2d
+    <input type='mouse' bus='ps2'/>
119c2d
+    <input type='keyboard' bus='ps2'/>
119c2d
+    <audio id='1' type='none'/>
119c2d
+    <memballoon model='none'/>
119c2d
+  </devices>
119c2d
+</domain>
119c2d
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
119c2d
index fb438269b9..772586cf19 100644
119c2d
--- a/tests/qemuxml2xmltest.c
119c2d
+++ b/tests/qemuxml2xmltest.c
119c2d
@@ -461,6 +461,7 @@ mymain(void)
119c2d
     DO_TEST_NOCAPS("net-coalesce");
119c2d
     DO_TEST_NOCAPS("net-many-models");
119c2d
     DO_TEST("net-vdpa", QEMU_CAPS_NETDEV_VHOST_VDPA);
119c2d
+    DO_TEST("net-vdpa-multiqueue", QEMU_CAPS_NETDEV_VHOST_VDPA);
119c2d
 
119c2d
     DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev");
119c2d
     DO_TEST_NOCAPS("serial-tcp-tlsx509-chardev-notls");
119c2d
-- 
119c2d
2.35.1
119c2d