Skip to content

Instantly share code, notes, and snippets.

@tachang
Last active July 13, 2023 12:24
Show Gist options
  • Save tachang/66d0db979aa6d9149a5a284e15b9bd74 to your computer and use it in GitHub Desktop.
Save tachang/66d0db979aa6d9149a5a284e15b9bd74 to your computer and use it in GitHub Desktop.
Intel 520 Integrated Graphics Card Passthrough Issues on Proxmox

I am having issues getting my Intel 520 integrated graphics card passing through on qemu. I am using Proxmox Virtual Environment 6.2-4.

I am getting some type of fault code when starting up a virtual machine:

qemu-system-x86_64 -machine q35 -m 2G -accel kvm -cpu host \
-device vfio-pci,host=00:02.0 -nographic -vga none \
-cdrom /var/lib/vz/template/iso/Win10_2004_English_x64.iso

DMAR: [DMA Write] Request device [00:02.0] PASID ffffffff fault addr 0 [fault reason 02] Present bit in context entry is clear

Some of the things I have tried:

  • Dumped the vbios ROM by running a live Ubuntu distribution and booting with legacy. I disabled UEFI boot and booted the ubuntu live cd and dumped the video bios.
  • Downloaded rom-parser and compiled. I changed the Vendor and device IDs to match using the tool rom-fixer. I noticed that the PCIR: type 0 is non-UEFI. This means I need to use SeaBIOS right?
./rom-parser /usr/share/kvm/IntelUHD520.bin
Valid ROM signature found @0h, PCIR offset 40h
	PCIR: type 0 (x86 PC-AT), vendor: 8086, device: 1916, class: 030000
	PCIR: revision 3, vendor revision: 0
	Last image
  • I tried using different machine types. I am able to see the screen black out but that's it.

My kernel boot parameters are:

GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on nomodeset nofb rd.driver.pre=vfio-pci video=efifb:off,vesafb:off simplefb=off"

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07) (prog-if 00 [VGA controller])
        Subsystem: Intel Corporation Skylake GT2 [HD Graphics 520]
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at de000000 (64-bit, non-prefetchable) [size=16M]
        Region 2: Memory at c0000000 (64-bit, prefetchable) [size=256M]
        Region 4: I/O ports at f000 [size=64]
        [virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
        Capabilities: [40] Vendor Specific Information: Len=0c <?>
        Capabilities: [70] Express (v2) Root Complex Integrated Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0
                        ExtTag- RBE+
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis-, LTR-, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
        Capabilities: [ac] MSI: Enable- Count=1/1 Maskable- 64bit-
                Address: 00000000  Data: 0000
        Capabilities: [d0] Power Management version 2
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D3 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [100 v1] Process Address Space ID (PASID)
                PASIDCap: Exec+ Priv-, Max PASID Width: 14
                PASIDCtl: Enable- Exec- Priv-
        Capabilities: [200 v1] Address Translation Service (ATS)
                ATSCap: Invalidate Queue Depth: 00
                ATSCtl: Enable+, Smallest Translation Unit: 00
        Capabilities: [300 v1] Page Request Interface (PRI)
                PRICtl: Enable- Reset-
                PRISta: RF- UPRGI- Stopped-
                Page Request Capacity: 00008000, Page Request Allocation: 00000000
        Kernel driver in use: vfio-pci
        Kernel modules: i915

# dmesg | grep -i DMAR
[    0.012506] ACPI: DMAR 0x0000000076532980 0000CC (v01 INTEL  NUC6i3SY 00000048 INTL 00000001)
[    0.059911] DMAR: IOMMU enabled
[    0.119776] DMAR: Host address width 39
[    0.119778] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[    0.119787] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[    0.119790] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[    0.119795] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[    0.119798] DMAR: RMRR base: 0x0000007629b000 end: 0x000000762bafff
[    0.119800] DMAR: RMRR base: 0x00000077800000 end: 0x0000007fffffff
[    0.119802] DMAR: ANDD device: 9 name: \_SB.PCI0.UA00
[    0.119811] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.119813] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[    0.119815] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
[    0.121325] DMAR-IR: Enabled IRQ remapping in x2apic mode
[    1.023492] DMAR: ACPI device "device:67" under DMAR at fed91000 as 00:1e.0
[    1.023503] DMAR: No ATSR found
[    1.023536] DMAR: dmar0: Using Queued invalidation
[    1.023542] DMAR: dmar1: Using Queued invalidation
[    1.040088] DMAR: Intel(R) Virtualization Technology for Directed I/O
[  268.773617] DMAR: DRHD: handling fault status reg 2
[  268.773625] DMAR: [DMA Write] Request device [00:02.0] PASID ffffffff fault addr 0 [fault reason 02] Present bit in context entry is clear
[  601.344121] DMAR: DRHD: handling fault status reg 2
[  601.344133] DMAR: [DMA Write] Request device [00:02.0] PASID ffffffff fault addr 0 [fault reason 02] Present bit in context entry is clear
[  605.585345] DMAR: DRHD: handling fault status reg 2
[  605.585355] DMAR: [DMA Write] Request device [00:02.0] PASID ffffffff fault addr 0 [fault reason 02] Present bit in context entry is clear
# cat /etc/modprobe.d/vfio.conf 
options vfio-pci ids=8086:1916,8086:9d70
#options vfio-pci disable_vga=1

# lspci -n
00:00.0 0600: 8086:1904 (rev 08)
00:02.0 0300: 8086:1916 (rev 07)
00:14.0 0c03: 8086:9d2f (rev 21)
00:14.2 1180: 8086:9d31 (rev 21)
00:16.0 0780: 8086:9d3a (rev 21)
00:17.0 0106: 8086:9d03 (rev 21)
00:1c.0 0604: 8086:9d14 (rev f1)
00:1d.0 0604: 8086:9d18 (rev f1)
00:1e.0 1180: 8086:9d27 (rev 21)
00:1e.6 0805: 8086:9d2d (rev 21)
00:1f.0 0601: 8086:9d48 (rev 21)
00:1f.2 0580: 8086:9d21 (rev 21)
00:1f.3 0403: 8086:9d70 (rev 21)
00:1f.4 0c05: 8086:9d23 (rev 21)
00:1f.6 0200: 8086:1570 (rev 21)
01:00.0 0280: 8086:24f3 (rev 3a)
02:00.0 0108: 15b7:5009 (rev 01)
# qm monitor 101
Entering Qemu Monitor for VM 101 - type 'help' for help
qm> info pci

  Bus  0, device  16, function 0:
    VGA controller: PCI device 8086:1916
      PCI subsystem 8086:2063
      IRQ 11.
      BAR0: 64 bit memory at 0xfd000000 [0xfdffffff].
      BAR2: 64 bit prefetchable memory at 0xe0000000 [0xefffffff].
      BAR4: I/O at 0xe080 [0xe0bf].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id "hostpci0"

Wondering if this has anything to do with it?

https://forum.proxmox.com/threads/igd-passthrough-and-hard-coded-pci-bridges.68285/

/usr/bin/kvm -id 101 -name Win -chardev socket,id=qmp,path=/var/run/qemu-server/101.qmp,server,nowait -mon chardev=qmp,mode=control -chardev socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5 -mon chardev=qmp-event,mode=control -pidfile /var/run/qemu-server/101.pid -daemonize -smbios type=1,uuid=cc16295f-dbfd-4ab5-9832-2d990d70c3f1 -smp 4,sockets=2,cores=2,maxcpus=4 -nodefaults -boot menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg -vga none -nographic -no-hpet -cpu kvm64,enforce,hv_ipi,hv_relaxed,hv_reset,hv_runtime,hv_spinlocks=0x1fff,hv_stimer,hv_synic,hv_time,hv_vapic,hv_vpindex,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 9056 -device pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e -device pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f -device vmgenid,guid=ad432063-8193-4cdd-8597-1a7258b5e8b6 -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device vfio-pci,host=0000:00:02.0,id=hostpci0,bus=pci.0,addr=0x10,romfile=/usr/share/kvm/IntelUHD520.bin -chardev socket,id=serial0,path=/var/run/qemu-server/101.serial0,server,nowait -device isa-serial,chardev=serial0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -iscsi initiator-name=iqn.1993-08.org.debian:01:4f15f9461236 -drive if=none,id=drive-ide2,media=cdrom,aio=threads -device ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200 -drive file=/dev/pve/vm-101-disk-0,if=none,id=drive-virtio0,format=raw,cache=none,aio=native,detect-zeroes=on -device virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100 -netdev type=tap,id=net0,ifname=tap101i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown -device e1000,mac=22:4B:99:E9:07:05,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300 -rtc driftfix=slew,base=localtime -machine type=pc+pve0 -global kvm-pit.lost_tick_policy=discard

/etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on nomodeset nofb rd.driver.pre=vfio-pci video=efifb:off,vesafb:off simplefb=off modprobe.blacklist=i915 pcie_acs_override=downstream iommu=pt vfio-pci.ids=8086:1916"

/etc/modprobe.d/vfio.conf

options vfio-pci ids=8086:1916
/usr/bin/qemu-system-x86_64 \
-name guest=fedora-2,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-4-fedora-2/master-key.aes \
-machine pc-i440fx-4.2,accel=kvm,usb=off,vmport=off,dump-guest-core=off \
-cpu Skylake-Client-IBRS,ss=on,vmx=on,hypervisor=on,tsc-adjust=on,clflushopt=on,umip=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaves=on,pdpe1gb=on,ibpb=on,amd-ssbd=on,skip-l1dfl-vmentry=on \
-m 10000 \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-uuid 3bc39504-8455-4156-b4a0-7f27e5d89ae1 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=31,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global PIIX4_PM.disable_s3=1 \
-global PIIX4_PM.disable_s4=1 \
-boot strict=on \
-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.0,addr=0x4 \
-device ahci,id=sata0,bus=pci.0,addr=0x5 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/fedora-2.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2","file":"libvirt-2-storage","backing":null}' \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=libvirt-2-format,id=virtio-disk0,bootindex=1 \
-device ide-cd,bus=sata0.0,id=sata0-0-0 \
-netdev tap,fd=33,id=hostnet0,vhost=on,vhostfd=34 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:29:7f:c2,bus=pci.0,addr=0x8 \
-device usb-tablet,id=input0,bus=usb.0,port=1 \
-device vfio-pci,host=0000:00:02.0,id=hostdev0,bus=pci.0,addr=0x2,rombar=1,romfile=IntelUHD520.bin \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0xa \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
@anthonydublin
Copy link

Cute.. Stupid but cute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment