qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio/igd: Check host PCI address when probing
@ 2025-03-25 17:22 Tomita Moeko
  2025-04-09 17:18 ` Alex Williamson
  0 siblings, 1 reply; 13+ messages in thread
From: Tomita Moeko @ 2025-03-25 17:22 UTC (permalink / raw)
  To: Alex Williamson, Cédric Le Goater, Tomita Moeko; +Cc: qemu-devel

So far, all Intel VGA adapters, including discrete GPUs like A770 and
B580, were treated as IGD devices. While this had no functional impact,
a error about "unsupported IGD device" will be printed when passthrough
Intel discrete GPUs.

Since IGD devices must be at "0000:00:02.0", let's check the host PCI
address when probing.

Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
---
 hw/vfio/igd.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 265fffc2aa..ff250017b0 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -53,6 +53,13 @@
  * headless setup is desired, the OpRegion gets in the way of that.
  */
 
+static bool vfio_is_igd(VFIOPCIDevice *vdev)
+{
+    return vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) &&
+           vfio_is_vga(vdev) &&
+           vfio_pci_host_match(&vdev->host, "0000:00:02.0");
+}
+
 /*
  * This presumes the device is already known to be an Intel VGA device, so we
  * take liberties in which device ID bits match which generation.  This should
@@ -427,13 +434,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
     VFIOConfigMirrorQuirk *ggc_mirror, *bdsm_mirror;
     int gen;
 
-    /*
-     * This must be an Intel VGA device at address 00:02.0 for us to even
-     * consider enabling legacy mode. Some driver have dependencies on the PCI
-     * bus address.
-     */
-    if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
-        !vfio_is_vga(vdev) || nr != 0) {
+    if (nr != 0 || !vfio_is_igd(vdev)) {
         return;
     }
 
@@ -490,13 +491,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
     bool legacy_mode_enabled = false;
     Error *err = NULL;
 
-    /*
-     * This must be an Intel VGA device at address 00:02.0 for us to even
-     * consider enabling legacy mode.  The vBIOS has dependencies on the
-     * PCI bus address.
-     */
-    if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
-        !vfio_is_vga(vdev)) {
+    if (!vfio_is_igd(vdev)) {
         return true;
     }
 
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-04-16 17:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 17:22 [PATCH] vfio/igd: Check host PCI address when probing Tomita Moeko
2025-04-09 17:18 ` Alex Williamson
2025-04-10  7:34   ` Cédric Le Goater
2025-04-13 17:23     ` Tomita Moeko
2025-04-14 22:05       ` Alex Williamson
2025-04-15 17:36         ` Tomita Moeko
2025-04-15 19:04           ` Alex Williamson
2025-04-16 15:45             ` Tomita Moeko
2025-04-16 16:10               ` Alex Williamson
2025-04-16 17:41                 ` Tomita Moeko
2025-04-16 17:57                   ` Alex Williamson
2025-04-13 11:30   ` Tomita Moeko
2025-04-14 21:51     ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).