Homelab Guides
Description
In this section we will be using GPU Passthrough to give one particular virtual machine exclusive use of the integrated GPU in the machine running our Proxmox server. We will also set up USB passthrough, allowing us to use the VM with physical monitors and USB peripherals as if it were running bare metal.
Criteria for our iGPU Passthrough setup
There are many variants of GPU passthrough. The end goal we want is:
- Proxmox as the host, and a Windows 10 or 11 guest
- Passthrough of the entire GPU (no virtualisation i.e. GPU splitting)
- The GPU being passed through is an Intel iGPU
- Full display output to a physical monitor
Why another guide?
There is a not-so-obvious catch to getting the above configuration to work. Getting the video output to work requires using an Intel Graphics driver dated 2019 or earlier - newer versions will result in Code 43 errors. Left to its own devices, Windows will automatically update the driver to the latest version, disabling your video output.
After some trial and error with which steps are actually required and what the most efficient order is to perform them, I've finally figured out a procedure that works reliably for myself.
tl;dr?
- Install Windows in the VM with network access disabled.
- Pre-load the 2019 drivers.
- Disable Windows Update from automatically updating drivers.
- Shutdown the VM.
- Change the VM config to passthrough the iGPU with OpRegion support.
- Start up the VM.
Detail Instructions
Preparing the Host
Enabling IOMMU in BIOS
The exact BIOS settings will depend on your specific motherboard, so I won't go through all the options.
On my machine, the setting is named VT-d
, which stands for "IntelĀ® Virtualization Technology
for Directed I/O".
Find the PCI Bus and Slot ID and Device ID
In the Proxmox CLI, run the following command to get the PCI bus, slot ID, and numeric device ID for your iGPU:
lspci -nn | grep VGA
You should see something like this:
00:02.0 VGA compatible controller [0300]: Intel Corporation HD Graphics 530 [8086:1912] (rev 06)
The first set of numbers (00:02.0
) is the PCI bus, slot ID, and function ID. The last pair
of hexadecimal characters (8086:1912
) are the vendor and device ID, with 8086
being the vendor ID for Intel, and 1912
being the device ID for this particular iGPU.
Enable IOMMU in GRUB
Open the file /etc/default/grub
, find the line starting with
GRUB_CMDLINE_LINUX_DEFAULT
, and append the flag intel_iommu=on
to the end.
Before (example):
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
After:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
Then apply the change by executing the below:
update-grub2
Update initramfs
Edit the file /etc/modprobe.d/vfio.conf
so that it contains the following:
options vfio-pci ids=8086:3912
softdep drm pre: vfio-pci
Then apply the change by executing the following:
update-initramfs -u -k all
Reboot your Proxmox host for the changes to take effect.
Linux Guest
I recommend first testing GPU Passthrough with a Linux VM as they have better iGPU passthrough support. This will eliminate any issues with your hardware or host configuration.
- Download your ISO and store it in the
local
storage of your Proxmox node. I did this test using Pop!_OS by System76 as my distro. - Create a normal Linux VM.
- Machine type
i440fx
andSeaBIOS
bios. - Disks: enable
Discard
andSSD Emulation
- CPU: Change
Type
tohost
, and increaseCores
- Machine type
- Install the OS. Once you have a working desktop environment, shut down the VM.
- In the Proxmox web UI, navigate to the VM, select Hardware from the list view, click the
Add
button, and selectPCI Device
. - Select the radio button
Raw Device
if it is present, then change the Device dropdown to the entry for your iGPU. The checkboxes can remain on their defaults. - Repeat the process for your USB Host Controller (or USB devices if you choose that method).
- Start up the VM. You should have video output displaying once the VM has reached the User Login screen for your desktop environment.
Windows 10 Guest
Preparation
Before you start, you will need:
- A Windows 10 ISO saved in
local
storage. - The Windows VirtIO drivers ISO saved in
local
storage.- We'll need these as the Windows setup ISO does not include drivers for our virtualised devices.
- Windows VirtIO Drivers - Proxmox VE
- Intel Graphics Drivers from 2019.
- I've successfully used
igfx_win10_100.7158
dated 2019/09/09. - You will need to get this inside the VM. You can passthrough a USB Flash Drive or USB External HDD, host it on a SMB/CIFS network share, or create an ISO image with the contents of the driver zip file.
- I've successfully used
VM Creation
- Create a Windows 10 VM.
- Set Machine type to
i440fx
and BIOS toSeaBios
. - Network: enable the
Disconnect
checkbox to disable network access. - Start the VM and follow the setup wizard until you arrive on the desktop.
Desktop Configuration
- Next, navigate to the Intel Graphics driver folder, and into the
Graphics
subfolder.. Then run thepnp-util
command. This will take a while.
cd ~\Desktop\igfx\Graphics
pnp-util -a iigd_dch.inf
- Open an elevated command prompt and run the following command:
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f /v ExcludeWUDriversInQualityUpdate /t REG_DWORD /d 1
- Shutdown the VM.
Adding iGPU Passthrough to the VM
- In your Proxmox CLI, navigate to the folder storing your VM configuration files and open the
.conf
file for your VM, e.g./etc/pve/nodes/comet/qemu-server/101.conf
- Add the three following lines:
args: -device vfio-pci,host=00:02.0,x-igd-opregion=on,x-igd-gms=1
vga: none
- The first line tells Proxmox to passthrough the iGPU device at ID
00:02.0
. Theopregion
setting enable OpRegion support which enables physical video out. Thegms
setting allocates a small amount of RAM which seems to be necessary for OpRegion to work. - The second line disables the Proxmox standard virtualised display as it would occupy the same address in the VM as the iGPU, preventing the VM from starting.
- Save and close the file.
Testing video output
- Start up the VM. It should take a bit longer than usual as it will detect the presence of a new device and install the drivers. Once Windows gets to the User Login stage, you should have video output on your monitor.
Windows 11 Guest
VM Creation
- The steps are similar to Windows 10. The main difference is that by default, Proxmox will default to
the
q35
machine type and aOVMF
UEFI instead ofi440fx
andSeaBIOS
. Windows 11 can work without UEFI and TPM, we just need to bypass it. - During VM creation, change the machine type to
i440fx
, the BIOS toSeaBIOS
and disableTPM
. - Start the VM
Windows Setup
- During the first phase of the setup process, when it asks you which version of Windows you'd like to
install, press
Shift+F10
to open a command prompt. - Open
regedit
. Navigate toHKEY_LOCAL_MACHINE\SYSTEM\Setup
and create a key (i.e. folder) namedLabConfig
. - Create two DWORD (32-bit) entries, one named
BypassSecureBootCheck
and the second namedBypassTPMCheck
. Set their values to1
. - Close
regedit
and the command prompt, and continue the installation. - The setup wizard should continue.
- The rest of the steps are the same as for the Windows 10 VM.
Troubleshooting Tips
If you're having difficulty, here are some tips:
- Enable Remote Desktop access (
Win
>Remote Desktop Settings
) and note the IP address of the VM (Win
>cmd
>ipconfig
). - If you enable
Qemu Agent
in the VM and install the guest client tools on the Windows VirtIO drivers CD (D:\virtio-win-guest-tools.exe
) you'll be able to see the IP address of the Windows VM from Proxmox web UI and gracefully reboot/shutdown the VM. - You can enable local network access by setting the network card to use a valid static IP with an
incorrect gateway. e.g.:
- IP:
192.168.8.100
- Mask:
255.255.255.0
- Gateway:
192.168.8.199
(where there is no device using.199
) - You can then disable the
Disconnect
checkbox in Proxmox which simulates the network cable being disconnected.
- IP:
- Make sure your
C:\
drive is at least 48GB. Windows will use up over 32GB halfway through running Windows Updates. - Consider using Proxmox to take a snapshot of the VM once you've reached the desktop. If something goes wrong you can just restore the snapshot instead of going through Windows Setup again.
- There are several settings you can change to improve the performance, such as using
SCSI
instead ofIDE
and playing with the Cache settings. These are general to VM creation and I have not covered them in here.