Skip to content

Instantly share code, notes, and snippets.

@roylez
Last active March 13, 2024 11:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roylez/83abb5fb457d775211d16af762fc7edb to your computer and use it in GitHub Desktop.
Save roylez/83abb5fb457d775211d16af762fc7edb to your computer and use it in GitHub Desktop.

The following works for pve 8 with 6.5 kernel.

The driver is still experimental, use with your own discretion.

  • prepare env
git clone https://github.com/strongtz/i915-sriov-dkms
apt install dkms build-essential proxmox--headers-6.5 
  • modify dkms.conf
PACKAGE_NAME="i915-sriov-dkms"
PACKAGE_VERSION="6.1"
  • build dkms deb package
# add module
dkms add /root/i915-sriov-dkms

# check module status
dkms status

# build
dkms build i915-sriov-dkms/6.1

# install
dkms install i915-sriov-dkms/6.1

# if messed up
dkms uninstall i915-sriov-dkms/6.1
dkms remove i915-sriov-dkms/6.1 --all
  • update grub command line, and add intel_iommu=on i915.enable_guc=3 i915.max_vfs=7 to GRUB_CMDLINE_LINUX_DEFAULT, and run update-grub

  • reboot and check dmesg to see if it is working. If some i915 firmware file is missing, and there are errors like this

i915 0000:00:02.0: GuC firmware i915/tgl_guc_70.bin: fetch failed with error -2
i915 0000:00:02.0: [drm] GuC firmware(s) can be downloaded from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915
i915 0000:00:02.0: [drm] GuC firmware i915/tgl_guc_70.bin version 0.0.0
i915 0000:00:02.0: GuC initialization failed -2

so download the missing firmware file and place it in /usr/lib/firmware/i915, here it is tgl_guc_70.bin for gen 11 CPU. Firmware can be downloaded from here

If you see the following, it is successful.

[  +0.000121] i915 0000:00:02.0: 7 VFs could be associated with this PF
  • now it is possible to specify the number of VFs needed with the following.
echo 2 > /sys/devices/pci0000:00/0000:00:02.0/sriov_numvfs
@stnd
Copy link

stnd commented Mar 6, 2023

Hi, were you able to use one of the VFs with a Windows VM? or any other OS VM?

When I assign one of the VFs with a VM and start the VM (WIn 10) or (Mac OS) the VFs disappear and my igpu goes to vfio driver instead of i915 driver. Curious if you were able to assign a VF to a VM?

@roylez
Copy link
Author

roylez commented Mar 6, 2023

VM, no. Because I am using an unfortunate gen 11 CPU, which has some serious issue that breaks vt-d. No matter if is a physical CPU or VF, it will not work when passed through to a VM. In Windows, usually an error code 43 will be reported. If you are using gen 12 intel, i.e. alder lake, you should have no issue.

For now, I am passing through one VF to a lxc container with bind mount, and jellyfin hardware accelerated encoding works just fine.

@stnd
Copy link

stnd commented Mar 7, 2023

Thank you for the quick response. I feel like I didn't do anything different and now it is working. I do have a 12th gen i5-12500 (UHD77)0)

This is the guide that got me there in case someone comes across this comment section.
https://www.michaelstinkerings.org/gpu-virtualization-with-intel-12th-gen-igpu-uhd-730/

@ovizii
Copy link

ovizii commented Mar 12, 2024

VM, no. Because I am using an unfortunate gen 11 CPU, which has some serious issue that breaks vt-d. No matter if is a physical CPU or VF, it will not work when passed through to a VM. In Windows, usually an error code 43 will be reported. If you are using gen 12 intel, i.e. alder lake, you should have no issue.

For now, I am passing through one VF to a lxc container with bind mount, and jellyfin hardware accelerated encoding works just fine.

Is that confirmed? Can I give up trying to get the GPU of my Intel i5 1135G7 used by a VM in any way?

@roylez
Copy link
Author

roylez commented Mar 12, 2024

Is that confirmed? Can I give up trying to get the GPU of my Intel i5 1135G7 used by a VM in any way?

It is confirmed (not officially from intel) there is some issue with i915 driver on Windows with gen 11 CPU. Considering gen11 is no more a shiny new generation, I would not be surprised that Intel does not hurry to have it fixed.

Also I hear people have some success with latest Debian, though I could not recall if it was bookworm or sid. Anyway it could work with a Linux VM provided that it comes with up-to-date driver.

@ovizii
Copy link

ovizii commented Mar 13, 2024

It is confirmed (not officially from intel) there is some issue with i915 driver on Windows with gen 11 CPU. Considering gen11 is no more a shiny new generation, I would not be surprised that Intel does not hurry to have it fixed.

Also I hear people have some success with latest Debian, though I could not recall if it was bookworm or sid. Anyway it could work with a Linux VM provided that it comes with up-to-date driver.

Damn. I really need to give some sort of GPU to a Win 11 VM. I failed with a Ryzen based mini PC and when I needed a second mini PC I went with an Intel based one in order to swap them around. One of the few that fit my criteria was a 12th gen but had an overheating problem and the replacement I found is (unfortunately) an I5 1135G7 Intel® 11th Gen CoreTM Processor ( Tiger Lake UP3) so it looks like I failed again.
I was hopeful when I read about the new code regarding i915 in the 6.8 kernel but after reading your reply I realize it's the Windows driver part which fails :-(

Thanks for your guide, at least I have managed to give GPU access to a few docker containers although that was not my main objective :-)

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