This patchset intends to decouple existing quirks from legacy mode. Currently all quirks depends on legacy mode (except x-igd-opregion), which includes following conditions: * Machine type is i440fx * IGD device is at guest BDF 00:02.0 * VBIOS in ROM BAR or file * VGA IO/MMIO ranges are claimed by IGD * OpRegion * Same LPC bridge and Host bridge VID/DID/SVID/SSID as host
If one of the condition is not met, the quirks will not be applied. However, for recent generations, espcially Gen 11+ devices that removed VBIOS support, not all the conditions are required. For example, on EFI- based systems, VBIOS ROM is unnecessary, and VGA ranges are not used. To have better support on newer UEFI-based VMs, this patchset makes the quirks independent of legacy mode. The BDSM and GGC register quirks are applied to all supported IGD devices, new x-igd-lpc option for the LPC bridge / Host bridge ID quirk is introduced for possible Q35 support. It also prepares for supporting IGD passthrough when it is not primary display later (kernel change will be merged in 6.15). To maintain backward compatbility with exising configuration, legacy mode will automatically be enabled when: * Machine type is i440fx * IGD device is at guest BDF 00:02.0 If the legacy mode behavior is unwanted, option x-igd-legacy-mode=off is provided for users to disable it. Note that a major difference is that instead of simply continues, legacy mode will now fail immediately on error, this may break functionality, but the impact should be low as IGD passthrough is not working, and there would be no display output if it fails halfway. The first 2 patches of this patchset was taken from a previous one, details can be found at: https://lore.kernel.org/all/20250124191245.12464-1-tomitamo...@gmail.com/ This patchest was mainly tested on Alder Lake UHD770, with Debian 12 (kernel 6.1), Windows 11 (driver 32.0.101.6458) and Intel GOP driver 17.0.1081. Btw, documentation change would be added after everyone considers the proposed change is okay. Changelog: v2: * Keep legacy mode for compatbility * Renamed from "vfio/igd: Remove legacy mode" Link: https://lore.kernel.org/all/20250224182927.31519-1-tomitamo...@gmail.com/ Tomita Moeko (9): vfio/igd: Remove GTT write quirk in IO BAR 4 vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size vfio/igd: Consolidate OpRegion initialization into a single function vfio/igd: Move LPC bridge initialization to a separate function vfio/pci: Add placeholder for device-specific config space quirks vfio/igd: Refactor vfio_probe_igd_bar4_quirk into pci config quirk vfio/igd: Decouple common quirks from legacy mode vfio/igd: Handle x-igd-opregion option in config quirk vfio/igd: Introduce x-igd-lpc option for LPC bridge ID quirk hw/vfio/igd.c | 503 +++++++++++++++++-------------------------- hw/vfio/pci-quirks.c | 51 +---- hw/vfio/pci.c | 33 +-- hw/vfio/pci.h | 13 +- 4 files changed, 214 insertions(+), 386 deletions(-) -- 2.47.2