Open enochleung opened 10 months ago
After reading the source code from PVE/QemuServer/PCI.pm, I found those workarouds:
If you are using libvirt domain xml, you should add the following part, which works as hostpci0: 0000:00:02,legacy-igd=1,romfile=XXX.rom
in PVE, to add iGPU as a pci device.
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
</source>
<rom file="/PATH_TO_YOUR_VBIOS.rom"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
</hostdev>
Then you should add the following xml, which is equal to -set device.hostpci0.x-igd-gms=6 -set device.hostpci0.x-igd-opregion=on
.
<qemu:commandline>
<qemu:arg value='-set'/>
<qemu:arg value='device.hostdev0.x-igd-gms=6'/>
<qemu:arg value='-set'/>
<qemu:arg value='device.hostdev0.x-igd-opregion=on'/>
</qemu:commandline>
As for the ROM for Alder Lake U
, you can try the rom for TigerLake
, AlderLakeP
, AlderLakeH
from the latest release. If none of above works, you should try to extract GOP from UEFI for similar motherboard(motherboards from other bands coming with the same CPU) or read the UEFI of your machine with a EEPROM/Flash Chip Programmer such as CH341A.
Thanks for quick reply!
I have the above xml fragment in my domain xml, so my config should be good then, thanks for checking it out for me; I had a working GVT-d with my Thinkpad L470 which has a i3-7100U (along with smbios based Windows activation inside VM plus PS/2 passthrough using evdev for its keyboard etc), but I can't copy and modify accordingly and use the VM definition successfully with the new 倍控 G31F yet.
As for the ROM part, I tried the AIO.rom with something like the above xml fragment
<rom file="myroms/AIO.rom"/>
and it does not show anything; before the first run, I have "residual" text on screen as I turned off vesa and efi fb from kernel boot args, and once I started VM, screen flicker with a few little rainbow color "stripes", and then kinda stopped -> monitor goes to sleep mode. I assume it is the same as trying with all those rom you'd suggested above already?
At last, what is the meaning of the values with that x-igd-gms=6
parameter? Never know about it, but I have it =1 for my Thinkpad VM definition. How do I determine the correct value of it for my 8505, if that would be the reason of why I don't see anything on screen?
According to Intel ECI, the x-igd-gms property sets a value multiplied by 32 as the amount of pre-allocated memory (in units of MB) to support IGD in VGA modes.
Larger value makes the iGPU use more pre-allocated memory. On some machines, external screen only lights up when the pre-allocated memory is larger than(or at least the same of) the size in the BIOS of the Host Machine.
By the way, turning vseafb
and efifb
off is not necessary, all you need is to unbind iGPU with i915
and bind it with vfio-pci
in the host system like pvevm-hooks/vm-start.sh.
As for the little rainbow color stripes
on the screen, try enlarging x-igd-gms
and replacing AIO.rom
with roms for specific platform. As the screen is already light up, there should be only a few tweaks to get it work.
Asked the seller and was given the UEFI binary (16MB in size), extracted ROMs via UBU and it is still not working for me. Tried even bigger values with x-igd-gms
and they are all the same. I also suspected that it may be using DP instead (my mini PC has HDMI and DP, that's it) and connecting to either one also make no difference = not working, sigh. Did I get anything wrong? some dmesg lines and my VM definition below
--> make sure IOMMU is working [ 0.403100] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics [ 0.403105] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff] [ 0.403142] pci 0000:00:02.0: reg 0x344: [mem 0x00000000-0x00ffffff 64bit] [ 0.403145] pci 0000:00:02.0: VF(n) BAR0 space: [mem 0x00000000-0x06ffffff 64bit] (contains BAR0 for 7 VFs) [ 0.403152] pci 0000:00:02.0: reg 0x34c: [mem 0x00000000-0x1fffffff 64bit pref] [ 0.403155] pci 0000:00:02.0: VF(n) BAR2 space: [mem 0x00000000-0xdfffffff 64bit pref] (contains BAR2 for 7 VFs)
--> starting VM [ 75.508614] VFIO - User Level meta-driver version: 0.3 [ 75.513683] Console: switching to colour dummy device 80x25 [ 75.513744] vfio-pci 0000:00:02.0: vgaarb: deactivate vga console [ 75.513747] vfio-pci 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
these should be "normal", always appear when I use my old L470 [ 75.777228] DMAR: DRHD: handling fault status reg 3 [ 75.777258] DMAR: [DMA Read NO_PASID] Request device [00:02.0] fault addr 0x4c800000 [fault reason 0x06] PTE Read access is not set [ 75.782385] DMAR: DRHD: handling fault status reg 3 [ 75.782391] DMAR: [DMA Read NO_PASID] Request device [00:02.0] fault addr 0x4c909000 [fault reason 0x06] PTE Read access is not set [ 75.786886] DMAR: DRHD: handling fault status reg 3 [ 75.786900] DMAR: [DMA Read NO_PASID] Request device [00:02.0] fault addr 0x4ca06000 [fault reason 0x06] PTE Read access is not set [ 75.786903] DMAR: DRHD: handling fault status reg 3 [ 82.696254] vfio-pci 0000:00:02.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0x2340 [ 82.696267] vfio-pci 0000:00:02.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0x2340 [ 82.696276] vfio-pci 0000:00:02.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0x2340 [ 82.696287] vfio-pci 0000:00:02.0: Invalid PCI ROM header signature: expecting 0xaa55, got 0x2340
and my VM xml fragments below:
Only providing GOP and Vbt is not sufficient to get GVT-D work as it still lacks PlatformGOPPolicyDxe and IgdAssignmentDxe.
You could try to extract GOP in .efi form, and follow readme.md to build your OpROM for your own Platform. Provideing only the new built OpROM in VM XML should work.
Thanks, finally I'm at the last mile: I get GVT-d passthrough basically working now after I combined Intel GOP EFI with the two EFI you'd mentioned above and used that OpROM, except that I cannot use SecureBoot OVMF, or I will still get a blank screen. Based on what I see on screen when it works, it will prompt me with "press any key..." to boot to Windows 10 Install ISO, and if I press nothing, then it will default to EFI shell and stay there. I can keep using SecureBoot OVMF and just "blindly" press keys to boot for performing Windows install.
Are ppl using SecureBoot OVMF? At least the default ed2k OVMF that comes with Ubuntu (OVMF_CODE.ms.fd or OVMF_CODE_4M.ms.fd) are not working with the above setup. I think without using SecureBoot OVMF, I cannot install Windows 10 or above, which requires SecureBoot.
Besides, I also need to use the DP output (with a DP->HDMI adapter) to see the screen, instead of the HDMI out.
In fact I am not using SecureBoot, and a simple way to bypass SecureBoot requirement on Windows 11 is pre-install the operating system on the virtual disk before you switch to GVT-d (as for Windows 10, it does not require SecureBoot at all).
Besides, a potential way to get SecureBoot work is to use a customized OVMF_CODE_4M.secboot.fd
with GVT-d and SecureBoot support (and do not load OpROM anymore). You can build it by running build_ovmf.sh
from this project.
Want to know if you may be able to make a next release will support Alder Lake U in later release? I bought a Pentium Gold 8505 based machine (倍控 G31F) and is struggling with this issue, and I don't see anywhere I can download UEFI for that machine.
Morevoer, I am not PVE user and I use Ubuntu server + libvirt instead. Do you have any idea if it is not working just because of missing Alder Lake U ROM? I am asking because I see most other articles (mainly Chinese) mentioned the need of applying "legacy-igd=1" with qemu under PVE, but I can't do that as I am not using PVE: it will complain "no [legacy-igd] property in vfio-pci" if I do something similar by using inside libvirt domain xml, which technically just let me modify the VM launching qemu command.