Intel iGPU passthrough support for KVM/Xen with UEFI#5686
Draft
rucoder wants to merge 4 commits intolf-edge:masterfrom
Draft
Intel iGPU passthrough support for KVM/Xen with UEFI#5686rucoder wants to merge 4 commits intolf-edge:masterfrom
rucoder wants to merge 4 commits intolf-edge:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5686 +/- ##
===========================================
+ Coverage 19.52% 29.87% +10.34%
===========================================
Files 19 18 -1
Lines 3021 2417 -604
===========================================
+ Hits 590 722 +132
+ Misses 2310 1549 -761
- Partials 121 146 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
056c12c to
54c2189
Compare
d6cc0e9 to
1dabb63
Compare
… ROM Upgrade EDK2 from edk2-stable202408.01 to edk2-stable202508.01 (commit 3d244c3b364bd4e21261380662186d064659161c). This version added MemDebugLogLib which VfioIgdPkg >= commit c7b537ef requires. Build VfioIgdPkg (commit 348860da) as a standalone EFI Option ROM (igd.rom) containing IgdAssignmentDxe. The DXE driver reads etc/igd-opregion and etc/igd-bdsm-size from QEMU fw_cfg and sets ASLS (0xFC) and BDSM (0x5C or 0xC0 for Gen11+) in the iGPU PCI config space, enabling i915 to initialize the device on q35/UEFI. Regenerate edk2 patches for the new EDK2 base. All four existing patches still apply: 0000: Xen hypervisor spoofing in XenPlatformPei 0001: EveBootOrderLib addition 0002: EVE OS logo replacement 0003: EveBootOrderLib fw_cfg boot order support Signed-off-by: Mikhail Malyshev <[email protected]>
When an Intel iGPU (vendor 0x8086, class 0x03xx) is in the vfio-pci passthrough list: - Place the iGPU at guest BDF 00:02.0 (required for VBIOS/GOP ROM) - Enable x-igd-opregion=on for OpRegion/VBT passthrough via fw_cfg - Load igd.rom as the Option ROM (IgdAssignmentDxe sets ASLS/BDSM) - Move USB root port from slot 0x2 to 0x1b to free the iGPU slot - Support optional proprietary GOP ROMs for UEFI framebuffer Update eve-uefi reference to pick up edk2-stable202508.01 and igd.rom. Signed-off-by: Mikhail Malyshev <[email protected]>
Replace the old Revert^2 stolen-memory patch with four targeted patches
for QEMU's hw/vfio/igd.c enabling Intel iGPU passthrough on q35/UEFI:
Patch 08 — backport upstream igd_gen() with Gen7-Gen12 device ID
detection. The old function returned 8 for all unrecognised IDs,
making generation-specific checks (BDSM offset, GMS encoding)
ineffective on Gen9+ hardware.
Patch 09 — restructure vfio_probe_igd_bar4_quirk() for q35/UEFI:
- Move GMCH/BDSM emulation and etc/igd-bdsm-size fw_cfg write before
the BDF/LPC bridge checks (q35 "Sorry Q35" exits early without it)
- Emulate BDSM at 0xC0 (64-bit) for Gen11+, 0x5C (32-bit) for older
- Preserve GMS in emulated GMCH (guest driver needs stolen memory size)
- Clear stale GTT entries from host POST to prevent IOMMU faults
- Fix GMS encoding for Gen9+ Atom SKUs (0xf0-0xff, 4 MB granularity)
Patch 10 — add BAR0 BDSM MMIO mirror quirk (backported from upstream).
The GPU reads BDSM through BAR0 at offset 0x1080C0 as well as PCI
config space; without the mirror the MMIO read returns the host PA
while PCI config returns the emulated guest PA, crashing the driver.
Patch 11 — temporary diagnostic logging for BDSM/GMCH/GTT/BAR0 mirror.
Also ship igd.rom in xen-tools (where QEMU runs on the host rootfs)
and update the eve-uefi reference.
Co-authored-by: Sergio Santos <[email protected]>
Signed-off-by: Mikhail Malyshev <[email protected]>
Explain how Intel integrated GPU passthrough works in EVE OS: the OpRegion (ASLS) and stolen memory (BDSM) firmware requirements, why SeaBIOS/i440fx works via the legacy VBIOS path, why q35/UEFI fails without special handling, and how VfioIgdPkg's IgdAssignmentDxe EFI Option ROM solves it. Covers the four QEMU patches (igd_gen backport, main rework, BAR0 BDSM mirror, diagnostic logging), supported GPU generations (Gen6 through Gen12+), what works and what does not, and a step-by-step guide for updating EVE when Intel releases a new iGPU generation. Signed-off-by: Mikhail Malyshev <[email protected]>
1dabb63 to
afcda61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add Intel integrated GPU (iGPU) passthrough support for KVM guests running with UEFI (OVMF). Enables Windows and Linux VMs to use the Intel iGPU via VFIO passthrough with full display output (DP, HDMI, hot-plug) once the guest OS driver initializes.
How it works
Three components are modified:
pkg/uefi — builds VfioIgdPkg open-source IGD Option ROM alongside OVMF.
VfioIgdPkg provides
IgdAssignmentDxe: a DXE driver that readsetc/igd-opregionandetc/igd-bdsm-sizefrom fw_cfg and sets PCI config registers ASLS (0xFC) and BDSM (0x5C / 0xC0 for Gen11+) required by the Intel display driver. Unlike the classic out-of-treeIgdAssignmentDxepatch, VfioIgdPkg handles 150+ device IDs from Sandy Bridge through Panther Lake and correctly handles the Gen11+ 64-bit BDSM register at 0xC0 (required for Raptor Lake and later). The builtigd.romis shipped in the EVE image at/usr/lib/xen/boot/igd.rom.pkg/pillar/hypervisor (
kvm.go) — detects Intel iGPU in the passthrough device list and:pcie.0 addr=0x2) — required for VBIOS/GOP ROM initializationx-igd-opregion=onto pass the host OpRegion (including VBT) via fw_cfg — required for DP/HDMI connector detection and hot-plugigd.romas the Option ROM; if a proprietary GOP ROM exists in/persist/gop/<devid>.rom, it is used instead (addsIntelGopDriver: UEFI framebuffer during firmware phase)pkg/xen-tools (qemu-xen patch) — refactors
vfio_probe_igd_bar4_quirk():etc/igd-bdsm-sizefw_cfg write, and BDSM emulation to before the BDF/LPC bridge checks. On q35 the LPC check ("Sorry Q35") always fails so without this patch these registers are never set and the Windows driver fails with Code 43.IgdAssignmentDxeidempotency guard (skip if BDSM ≠ 0) is not falsely triggered by the host physical address.gen >= 0instead ofgen == 6 || gen == 8, which was blocking gen 9–12 devices.Display paths
igd.romonly (default)/persist/gop/DP/HDMI and hot-plug are handled entirely by the guest OS i915/display driver via the OpRegion VBT and HPD interrupts. The UEFI phase only matters if you need a display before the OS boots.
Proprietary GOP ROMs (optional)
GOP ROMs are not included in EVE (licensing). For use cases requiring UEFI framebuffer, ROMs can be placed at
/persist/gop/<devid>.rom(lowercase hex, no0xprefix).NOTE: this is for testing only!!! this PR will be updated to implement other way to store GOP ROMs
ROMs are available at https://github.com/LongQT-sea/intel-igpu-passthru/releases/
Device ID to ROM filename mapping
SNB_GOPv2_igd.rom0102,0106,010aIVB_GOPv3_igd.rom0152,0156,015a,0162,0166HSW_BDW_GOPv5_igd.rom0402,0406,0412,1602,1606,1612SKL_CML_GOPv9_igd.rom1902,1906,190b,9b41,9bca,9bc8CFL_CML_GOPv9.1_igd.rom3e90,3e92,3ea0,9bc4,9bc5GLK_GOPv13_igd.rom3184,3185ICL_GOPv14_igd.rom8a50,8a51,8a52,8a56,8a5a,8a5cRKL_TGL_ADL_RPL_GOPv17_igd.rom4c8a,4c8b,9a40,9a49,4628,46a0,46a2,a780,a7a0,a7a1,a7a8RKL_TGL_ADL_RPL_GOPv17.1_igd.romJSL_GOPv18_igd.rom4e51,4e55,4e57,4e61ADL-H_RPL-H_GOPv21_igd.rom4626,4638,a706,a720,a721ADL-N_TWL_GOPv21_igd.rom46d0,46d1,46d2ARL_MTL_GOPv22_igd.rom7d45,7d67,7d51,7d55LNL_GOPv2X_igd.rom6420,641bExample for i5-1335UE (Raptor Lake-U, PCI device
0xa7a1):How to test and validate this PR
HV=kvmon an x86_64 host with an Intel iGPU (e.g. Intel Core i5-1335UE, device00:02.0)/persist/gop/IGD bdsm-size:entries confirming the fw_cfg writeChangelog notes
Add Intel iGPU passthrough support for KVM/UEFI guests. Enables Windows and Linux VMs to use Intel integrated graphics (Sandy Bridge through Raptor Lake and beyond) via VFIO passthrough, with full DP/HDMI/hot-plug support through the guest OS driver.
PR Backports
Checklist
I've provided a proper description
I've added the proper documentation
I've tested my PR on amd64 device
I've tested my PR on arm64 device
I've written the test verification instructions
I've set the proper labels to this PR
I've checked the boxes above, or I've provided a good reason why I didn't check them.