summary refs log tree commit diff stats
path: root/hw/vfio/igd.c
diff options
context:
space:
mode:
authorTomita Moeko <tomitamoeko@gmail.com>2025-03-07 02:01:28 +0800
committerCédric Le Goater <clg@redhat.com>2025-03-11 17:01:14 +0100
commit434ac62ef2443f25956dafcfcbf29663fd0cd3e1 (patch)
tree09dcd64801e8ab6297373e142628b9ead096db63 /hw/vfio/igd.c
parent2fedccf03c889562855bfbe0628ac577938c50a2 (diff)
downloadfocaccia-qemu-434ac62ef2443f25956dafcfcbf29663fd0cd3e1.tar.gz
focaccia-qemu-434ac62ef2443f25956dafcfcbf29663fd0cd3e1.zip
vfio/igd: Handle x-igd-opregion option in config quirk
Both enable OpRegion option (x-igd-opregion) and legacy mode require
setting up OpRegion copy for IGD devices. As the config quirk no longer
depends on legacy mode, we can now handle x-igd-opregion option there
instead of in vfio_realize.

Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Corvin Köhne <c.koehne@beckhoff.com>
Link: https://lore.kernel.org/qemu-devel/20250306180131.32970-9-tomitamoeko@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Diffstat (limited to 'hw/vfio/igd.c')
-rw-r--r--hw/vfio/igd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index ee36875310..12e07517b4 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -189,7 +189,7 @@ static bool vfio_pci_igd_opregion_init(VFIOPCIDevice *vdev,
     return true;
 }
 
-bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp)
+static bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp)
 {
     g_autofree struct vfio_region_info *opregion = NULL;
     int ret;
@@ -560,10 +560,8 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
             goto error;
         }
 
-        /* Setup OpRegion access */
-        if (!vfio_pci_igd_setup_opregion(vdev, &err)) {
-            goto error;
-        }
+        /* Enable OpRegion quirk */
+        vdev->features |= VFIO_FEATURE_ENABLE_IGD_OPREGION;
 
         /* Setup LPC bridge / Host bridge PCI IDs */
         if (!vfio_pci_igd_setup_lpc_bridge(vdev, &err)) {
@@ -575,6 +573,12 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
         goto error;
     }
 
+    /* Setup OpRegion access */
+    if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) &&
+        !vfio_pci_igd_setup_opregion(vdev, errp)) {
+        goto error;
+    }
+
     /*
      * Allow user to override dsm size using x-igd-gms option, in multiples of
      * 32MiB. This option should only be used when the desired size cannot be