7548c0
From 9a993a7d566b7acdc548c1f0114b99fe17ba3c12 Mon Sep 17 00:00:00 2001
7548c0
Message-Id: <9a993a7d566b7acdc548c1f0114b99fe17ba3c12@dist-git>
7548c0
From: Jonathon Jongsma <jjongsma@redhat.com>
7548c0
Date: Fri, 4 Dec 2020 15:02:42 -0600
7548c0
Subject: [PATCH] qemu: format 'ramfb' attribute for mediated devices
7548c0
MIME-Version: 1.0
7548c0
Content-Type: text/plain; charset=UTF-8
7548c0
Content-Transfer-Encoding: 8bit
7548c0
7548c0
It's possible to use ramfb as the boot display of an assigned vgpu
7548c0
device. This was introduced in 4b95738c, but unfortunately the attribute
7548c0
was not formatted into the xml output for such a device. This patch
7548c0
fixes that oversight and adds a xml2xml test to verify proper behavior.
7548c0
7548c0
https://bugzilla.redhat.com/show_bug.cgi?id=1847791
7548c0
7548c0
(the expected test results were massaged slightly due to the fact that
7548c0
commit 3b8feb4793cef66f5dbfb9bdabe4d40834f1e90e is not present in this
7548c0
build).
7548c0
7548c0
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
7548c0
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
7548c0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
7548c0
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7548c0
(cherry picked from commit c5815b31976f3982d18c7f6c1367ab6e403eb7eb)
7548c0
7548c0
https://bugzilla.redhat.com/show_bug.cgi?id=1876297
7548c0
7548c0
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
7548c0
Message-Id: <20201204210242.822641-2-jjongsma@redhat.com>
7548c0
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
7548c0
---
7548c0
 src/conf/domain_conf.c                        |  3 ++
7548c0
 ...stdev-mdev-display-ramfb.x86_64-latest.xml | 41 +++++++++++++++++++
7548c0
 tests/qemuxml2xmltest.c                       |  1 +
7548c0
 3 files changed, 45 insertions(+)
7548c0
 create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml
7548c0
7548c0
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
7548c0
index cd5c15f297..c5a0442c6f 100644
7548c0
--- a/src/conf/domain_conf.c
7548c0
+++ b/src/conf/domain_conf.c
7548c0
@@ -27603,6 +27603,9 @@ virDomainHostdevDefFormat(virBufferPtr buf,
7548c0
             if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT)
7548c0
                 virBufferAsprintf(buf, " display='%s'",
7548c0
                                   virTristateSwitchTypeToString(mdevsrc->display));
7548c0
+            if (mdevsrc->ramfb != VIR_TRISTATE_SWITCH_ABSENT)
7548c0
+                virBufferAsprintf(buf, " ramfb='%s'",
7548c0
+                                  virTristateSwitchTypeToString(mdevsrc->ramfb));
7548c0
         }
7548c0
 
7548c0
     }
7548c0
diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml
7548c0
new file mode 100644
7548c0
index 0000000000..90c49842a5
7548c0
--- /dev/null
7548c0
+++ b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml
7548c0
@@ -0,0 +1,41 @@
7548c0
+<domain type='qemu'>
7548c0
+  <name>QEMUGuest2</name>
7548c0
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
7548c0
+  <memory unit='KiB'>219136</memory>
7548c0
+  <currentMemory unit='KiB'>219136</currentMemory>
7548c0
+  <vcpu placement='static'>1</vcpu>
7548c0
+  <os>
7548c0
+    <type arch='i686' machine='pc'>hvm</type>
7548c0
+    <boot dev='hd'/>
7548c0
+  </os>
7548c0
+  <clock offset='utc'/>
7548c0
+  <on_poweroff>destroy</on_poweroff>
7548c0
+  <on_reboot>restart</on_reboot>
7548c0
+  <on_crash>destroy</on_crash>
7548c0
+  <devices>
7548c0
+    <emulator>/usr/bin/qemu-system-i386</emulator>
7548c0
+    <controller type='usb' index='0' model='piix3-uhci'>
7548c0
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
7548c0
+    </controller>
7548c0
+    <controller type='pci' index='0' model='pci-root'/>
7548c0
+    <controller type='ide' index='0'>
7548c0
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
7548c0
+    </controller>
7548c0
+    <input type='mouse' bus='ps2'/>
7548c0
+    <input type='keyboard' bus='ps2'/>
7548c0
+    <graphics type='vnc' port='-1' autoport='yes'>
7548c0
+      <listen type='address'/>
7548c0
+    </graphics>
7548c0
+    <video>
7548c0
+      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
7548c0
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
7548c0
+    </video>
7548c0
+    <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-pci' display='on' ramfb='on'>
7548c0
+      <source>
7548c0
+        <address uuid='53764d0e-85a0-42b4-af5c-2046b460b1dc'/>
7548c0
+      </source>
7548c0
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
7548c0
+    </hostdev>
7548c0
+    <memballoon model='none'/>
7548c0
+  </devices>
7548c0
+</domain>
7548c0
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
7548c0
index f790bbc6f1..60efcac6c8 100644
7548c0
--- a/tests/qemuxml2xmltest.c
7548c0
+++ b/tests/qemuxml2xmltest.c
7548c0
@@ -524,6 +524,7 @@ mymain(void)
7548c0
             QEMU_CAPS_VFIO_PCI_DISPLAY,
7548c0
             QEMU_CAPS_DEVICE_VFIO_PCI,
7548c0
             QEMU_CAPS_VNC);
7548c0
+    DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb");
7548c0
     DO_TEST("pci-rom", NONE);
7548c0
     DO_TEST("pci-rom-disabled", NONE);
7548c0
     DO_TEST("pci-rom-disabled-invalid", NONE);
7548c0
-- 
7548c0
2.29.2
7548c0