qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Intel IGD passthrough working intermittently


From: Corvin Köhne
Subject: Re: Intel IGD passthrough working intermittently
Date: Wed, 2 Oct 2024 12:30:11 +0000

On Wed, 2024-10-02 at 13:05 +0200, Marco wrote:
> CAUTION: External Email!!
> First of all, I'm not really sure where the problem might be, whether
> libvirt itself, qemu or some other component; so I'm writing here to
> begin the discussion, but please direct me to a more appropriate place
> if needed.
> 
> I have a machine with an integrated Intel GPU:
> 
> 00:02.0 VGA compatible controller [0300]: Intel Corporation
> CoffeeLake-S GT2 [UHD Graphics 630] [8086:3e91]
> 
> That's the only GPU on the machine. I'm doing passthrough of this GPU
> to a Windows VM (KVM), with the purpose of getting video output sent
> to an external physical display. I'm not interested in host video
> output, as the machine is managed via SSH.
> 
> After doing all the module blacklisting and vfio-pci binding, and
> following the instructions at
> https://github.com/qemu/qemu/blob/master/docs/igd-assign.txt, I think
> I managed to set up the so-called "legacy" mode.
> 
> I'm configuring everything in the grub command line:
> 
> vfio-pci.ids=8086:3e91 modprobe.blacklist=i915 intel_iommu=on iommu=pt
> pcie_acs_override=downstream,multifunction
> initcall_blacklist=sysfb_init video=simplefb:off video=vesafb:off
> video=efifb:off video=vesa:off
> vfio_iommu_type1.allow_unsafe_interrupts=1 kvm.ignore_msrs=1
> 
> (I'm not sure all those options are needed, either)
> 
> On Ubuntu 22.04, with libvirt 8.0.0-1ubuntu7.10 and qemu
> 6.2+dfsg-2ubuntu6.22, I have this domain XML definition:
> 
> <domain type='kvm'
> xmlns:qemu='https://nospamproxywebp.beckhoff.com/enQsig/link?id=BAgAAA
> AJZQ60y84vDYAAAAADgOSW17L2g1OEAPIu9yIrW8OA6PinTjCKdBaAq17rngJ8Qj5Wqchm
> eoW9MtNa7XGe5liNO6O8-IsqifrCnI-
> vxrtPROrD8Aibk85hZloi6HsPe_o3GdVtRSvm7sxpAep82vpzM1sspSHu4i3ygnRRK51px
> VrKQ3dUPmJDqR-uEw2 '>
>   ...snip...
>   <devices>
>     ...snip...
>     <hostdev mode='subsystem' type='pci' managed='yes'>
>       <source>
>         <address domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>       </source>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>     </hostdev>
>   </devices>
>   <qemu:commandline>
>     <qemu:arg value='-set'/>
>     <qemu:arg value='device.hostdev0.x-vga=on'/>
>     <qemu:arg value='-set'/>
>     <qemu:arg value='device.hostdev0.x-igd-opregion=on'/>
>     <qemu:arg value='-set'/>
>     <qemu:arg value='device.hostdev0.x-igd-gms=2'/>
>   </qemu:commandline>
> </domain>
> 
> This generates the following QEMU command line fragment:
> 
> -device vfio-pci,host=0000:00:02.0,id=hostdev0,bus=pcie.0,addr=0x2
> -set device.hostdev0.x-vga=on -set device.hostdev0.x-igd-opregion=on
> -set device.hostdev0.x-igd-gms=2
> 

Hi,

First of all, you should make sure to pass the correct gms value to the
guest. I've already seen issues when passing the wrong value to guests.
That's why I've recently send a patch to qemu to always reuse the host
value [1].

[1]
https://gitlab.com/qemu-project/qemu/-/commit/971ca22f041b8a1e67314a777caf3ce6f2832034

> This works "most" of the times. When it works, I don't see anything
> upon VM boot, but as soon as Windows graphics starts, I see output on
> the external display.
> When it doesn't work, the screen stays black.
> In both cases, I see this in dmesg when I start the VM:
> 

I assume that you're booting in UEFI mode by using OVMF?

I don't know why it boots sometimes fine and sometimes not. However,
your black screen at boot is caused by a missing GOP. It's the EFI
graphics driver. That's why you only get graphics output when an OS
driver like i915 or the Windows driver is available. Unfortunately,
there're currently some constraints making it very hard to get a working
GOP:

1. The Intel GOP requires that the Graphics Stolen Memory and the
OpRegion are set up by the firmware. Additionally, the firmware has to
implement the PlatformGopPolicy Protocol [1]. OVMF doesn't do that yet
and is unwilling to do so [2].
2. It's mostly impossible do extract the GOP from the IGD in order to
pass it as romfile to the guest. Even Intel suggests asking your board
manufacturer.

[1] https://edk2.groups.io/g/devel/topic/89057277#msg87086
[2] https://edk2.groups.io/g/devel/message/88407
[3]
https://projectacrn.github.io/latest/tutorials/gpu-passthru.html#enable-the-gvt-d-gop-driver

> [ 1446.153682] vfio-pci 0000:00:02.0: vfio_ecap_init: hiding ecap
> 0x1b@0x100
> [ 1446.340324] vfio-pci 0000:00:02.0: Invalid PCI ROM header
> signature: expecting 0xaa55, got 0x0000
> [ 1448.162082] vfio-pci 0000:00:02.0: Invalid PCI ROM header
> signature: expecting 0xaa55, got 0x0000
> 
> 
> I've tried to upgrade QEMU to see whether there would be any change,
> using Ubuntu 24.04, with libvirt 10.0.0-2ubuntu8.3 and qemu
> 8.2.2+ds-0ubuntu1.2. Since I see that libvirt XML syntax for qemu
> command override has changed, I've updated the XML as follows:
> 
> <domain type='kvm'
> xmlns:qemu='https://nospamproxywebp.beckhoff.com/enQsig/link?id=BAgAAA
> AJZQ60y84vDYAAAAADgOSW17L2g1OEAPIu9yIrW8OA6PinTjCKdBaAq17rngJ8Qj5Wqchm
> eoW9MtNa7XGe5liNO6O8-IsqifrCnI-
> vxrtPROrD8Aibk85hZloi6HsPe_o3GdVtRSvm7sxpAep82vpzM1sspSHu4i3ygnRRK51px
> VrKQ3dUPmJDqR-uEw2 '>
>   ...snip...
>   <devices>
>     ...snip...
>     <hostdev mode='subsystem' type='pci' managed='yes'>
>       <source>
>         <address domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>       </source>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>     </hostdev>
>   </devices>
>   <qemu:override>
>     <qemu:device alias='hostdev0'>
>       <qemu:frontend>
>         <qemu:property name='x-vga' type='bool' value='true'/>
>         <qemu:property name='x-igd-opregion' type='bool'
> value='true'/>
>         <qemu:property name='x-igd-gms' type='signed' value='2'/>
>       </qemu:frontend>
>     </qemu:device>
>   </qemu:override>
> </domain>
> 
> My understanding is that this should be equivalent to the old
> <qemu:arg> syntax I used before.
> The generated qemu command line fragment is
> 
> -device {"driver":"vfio-
> pci","host":"0000:00:02.0","id":"hostdev0","bus":"pcie.0","addr":"0x2"
> ,"x-vga":true,"x-igd-opregion":true,"x-igd-gms":2}
> 
> But again, this also works only intermittently, in fact I have the
> impression that it works less frequently than with the old version of
> QEMU (this is of course just an impression; what's certain is that
> sometimes it works, sometimes it doesn't).
> 
> So I'm trying to see whether this is something I'm doing wrong, some
> config I'm missing, or some sort of bug (not sure where). Thanks for
> any help.

-- 
Kind regards,
Corvin

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]