qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tomita Moeko <tomitamoeko@gmail.com>
To: "Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Tomita Moeko" <tomitamoeko@gmail.com>
Cc: qemu-devel@nongnu.org, "Corvin Köhne" <c.koehne@beckhoff.com>
Subject: [PATCH 01/11] vfio/igd: Restrict legacy mode to Gen6-9 devices
Date: Tue, 22 Apr 2025 00:31:01 +0800	[thread overview]
Message-ID: <20250421163112.21316-2-tomitamoeko@gmail.com> (raw)
In-Reply-To: <20250421163112.21316-1-tomitamoeko@gmail.com>

Intel only provides legacy VBIOS for IGD up to Gen9, and there is no
CSM support on later devices. Additionally, Seabios can only handle
32-bit BDSM register used until Gen9. Since legacy mode requires VGA
capability, restrict it to Gen6 through Gen9 devices.

Link: https://lore.kernel.org/qemu-devel/20250325172239.27926-1-tomitamoeko@gmail.com/T/
Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
---
 hw/vfio/igd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index 6678e0e5cd..01826acf10 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -516,11 +516,13 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
 
     /*
      * For backward compatibility, enable legacy mode when
+     * - Device geneation is 6 to 9 (including both)
      * - Machine type is i440fx (pc_piix)
      * - IGD device is at guest BDF 00:02.0
      * - Not manually disabled by x-igd-legacy-mode=off
      */
     if ((vdev->igd_legacy_mode != ON_OFF_AUTO_OFF) &&
+        (gen >= 6 && gen <= 9) &&
         !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") &&
         (&vdev->pdev == pci_find_device(pci_device_root_bus(&vdev->pdev),
         0, PCI_DEVFN(0x2, 0)))) {
@@ -565,7 +567,9 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
         vdev->features |= VFIO_FEATURE_ENABLE_IGD_LPC;
     } else if (vdev->igd_legacy_mode == ON_OFF_AUTO_ON) {
         error_setg(&err,
-                   "Machine is not i440fx or assigned BDF is not 00:02.0");
+                   "Machine is not i440fx, assigned BDF is not 00:02.0, "
+                   "or device %04x doesn't support legacy mode",
+                   vdev->device_id);
         goto error;
     }
 
-- 
2.47.2



  reply	other threads:[~2025-04-21 16:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 16:31 [PATCH 00/11] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically Tomita Moeko
2025-04-21 16:31 ` Tomita Moeko [this message]
2025-04-24 22:57   ` [PATCH 01/11] vfio/igd: Restrict legacy mode to Gen6-9 devices Alex Williamson
2025-04-21 16:31 ` [PATCH 02/11] vfio/igd: Always emulate ASLS (OpRegion) register Tomita Moeko
2025-04-21 16:31 ` [PATCH 03/11] vfio/igd: Detect IGD device by OpRegion Tomita Moeko
2025-04-23  6:54   ` Corvin Köhne
2025-04-28 15:23     ` Tomita Moeko
2025-04-24 22:57   ` Alex Williamson
2025-04-21 16:31 ` [PATCH 04/11] vfio/igd: Remove vfio_pci_igd_setup_opregion Tomita Moeko
2025-04-21 16:31 ` [PATCH 05/11] vfio/igd: Check vendor and device ID on GVT-g mdev Tomita Moeko
2025-04-21 16:31 ` [PATCH 06/11] vfio/igd: Enable OpRegion by default Tomita Moeko
2025-04-21 16:31 ` [PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled Tomita Moeko
2025-04-24 22:57   ` Alex Williamson
2025-04-28 15:18     ` Tomita Moeko
2025-04-21 16:31 ` [PATCH 08/11] vfio/igd: Allow overriding GMS with 0xf0 to 0xfe on Gen9+ Tomita Moeko
2025-04-23  7:13   ` Corvin Köhne
2025-04-21 16:31 ` [PATCH 09/11] vfio/igd: Only emulate GGC register when x-igd-gms is set Tomita Moeko
2025-04-21 16:31 ` [PATCH 10/11] vfio/igd: Remove generation limitation for IGD passthrough Tomita Moeko
2025-04-23  7:19   ` Corvin Köhne
2025-04-21 16:31 ` [PATCH 11/11] vfio/igd: Update IGD passthrough documentation Tomita Moeko
2025-04-23  7:21   ` Corvin Köhne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250421163112.21316-2-tomitamoeko@gmail.com \
    --to=tomitamoeko@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=c.koehne@beckhoff.com \
    --cc=clg@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).