]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't specify vfio-pci.ramfb when ramfb is false
authorJonathon Jongsma <jjongsma@redhat.com>
Wed, 12 Jun 2024 17:18:49 +0000 (12:18 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Mon, 24 Jun 2024 13:55:50 +0000 (08:55 -0500)
Commit 7c8e606b64c73ca56d7134cb16d01257f39c53ef attempted to fix
the specification of the ramfb property for vfio-pci devices, but it
failed when ramfb is explicitly set to 'off'. This is because only the
'vfio-pci-nohotplug' device supports the 'ramfb' property. Since we use
the base 'vfio-pci' device unless ramfb is enabled, attempting to set
the 'ramfb' parameter to 'off' this will result in an error like the
following:

  error: internal error: QEMU unexpectedly closed the monitor
  (vm='rhel'): 2024-06-06T04:43:22.896795Z qemu-kvm: -device
  {"driver":"vfio-pci","host":"0000:b1:00.4","id":"hostdev0","display":"on
  ","ramfb":false,"bus":"pci.7","addr":"0x0"}: Property 'vfio-pci.ramfb'
  not found.

This also more closely matches what is done for mdev devices.

Resolves: https://issues.redhat.com/browse/RHEL-28808

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_command.c
tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args

index 39f6cf61c55f9ff8c406b3d25aca0062a7c4b53a..6ec1e9cbefae2f2611174bd3eec6e5ef825e139e 100644 (file)
@@ -4760,12 +4760,14 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
     g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
     const char *failover_pair_id = NULL;
     const char *driver = NULL;
+    /* 'ramfb' property must be omitted unless it's to be enabled */
+    bool ramfb = pcisrc->ramfb == VIR_TRISTATE_SWITCH_ON;
 
     /* caller has to assign proper passthrough driver name */
     switch (pcisrc->driver.name) {
     case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
         /* ramfb support requires the nohotplug variant */
-        if (pcisrc->ramfb == VIR_TRISTATE_SWITCH_ON)
+        if (ramfb)
             driver = "vfio-pci-nohotplug";
         else
             driver = "vfio-pci";
@@ -4798,7 +4800,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
                               "p:bootindex", dev->info->effectiveBootIndex,
                               "S:failover_pair_id", failover_pair_id,
                               "S:display", qemuOnOffAuto(pcisrc->display),
-                              "T:ramfb", pcisrc->ramfb,
+                              "B:ramfb", ramfb,
                               NULL) < 0)
         return NULL;
 
index e6e538ef1c65dadfd0332f2d68d35eb565d484e7..a681504c3dd6ca01f3b0cf39f2885041a2126efc 100644 (file)
@@ -29,6 +29,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest2/.config \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -vnc 127.0.0.1:0,audiodev=audio1 \
 -device '{"driver":"vfio-pci-nohotplug","host":"0000:06:12.5","id":"hostdev0","display":"on","ramfb":true,"bus":"pci.0","addr":"0x2"}' \
--device '{"driver":"vfio-pci","host":"0000:06:13.6","id":"hostdev1","display":"off","ramfb":false,"bus":"pci.0","addr":"0x3"}' \
+-device '{"driver":"vfio-pci","host":"0000:06:13.6","id":"hostdev1","display":"off","bus":"pci.0","addr":"0x3"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on