Re: [PATCH] qemu: Don't specify vfio-pci.ramfb when ramfb is false

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

 



ping

On 6/13/24 9:50 AM, Jonathon Jongsma wrote:
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@xxxxxxxxxx>
---
  src/qemu/qemu_command.c                                     | 6 ++++--
  .../hostdev-pci-display-ramfb.x86_64-latest.args            | 2 +-
  2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2d0eddc79e..1e9de6460e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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;
diff --git a/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args b/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args
index e6e538ef1c..a681504c3d 100644
--- a/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args
+++ b/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args
@@ -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



[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