Now you can with the magic that is SR-IOV if you have a intel GPU! (results may vary depending on your GPU, mine is a 12gen intel GPU, UHD Graphics 770)
Do you have NVIDIA or AMD instead? For the first, pay up for enterprise stuff (or use hacks such as this one on supported architectures) and for the latter the answer is to get f****d as the GPUs from AMD that support SR-IOV can be counted with two hands and are enterprise ones anyway.
Until a few months ago there was basically no support (and there still is no support) and a custom intel kernel was needed as even if you enabled the feature, the linux i915 driver (which is needed in the host) would not be able to create the multiple virtual devices. Fortunately this has changed and an experimental DKMS module has been made which works on the pve-kernel-6.1.0-1-pve kernel correctly at the time of writing.
Note: At the time of writing the 6.1 kernel seems to be mandatory and it’s not yet in production so there could be some bugs, but you can ignore that and do:
apt install pve-kernel-6.1
apt install pve-headers-6.1
Of course there was no installation guide on the github page, otherwhise where would the fun be? (Experienced linux developers might know how to compile and install a DKMS module manually, but I didn’t)
Fortunately, the AUR package had an install script so I just reversed it, which boils down to:
git clone https://github.com/strongtz/i915-sriov-dkms
- Edit the
@_PKGBASE@
and@PKGVER@
values with the ones provided in the install script in the dkms.conf file - Copy the folder to
/usr/source
as/usr/src/${_pkgbase}-${pkgver}
- Set permissions for the folder and all files to
755
and permissions for thedkms.conf
file to644
dkms install -m i915-sriov-dkms -v ${pkgver}
- Edit the
/etc/kernel/cmdline
file (I use zfs on proxmox with systemd-boot, you might have the kernel arguments in a different place) and addintel_iommu=on i915.enable_guc=7
(The repository does not use it but I also haveiommu=pt
there) - Refresh the kernel arguments via
proxmox-boot-tool refresh
(see the documentation if you’re not using systemd-boot) apt install sysfsutils
- Create the virtual devices permanently
echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf
(check if your intel GPU is at0000:00:02.0
vialspci -v
) - Reboot
If everything went well by doing lspci
you’ll now have something like this!
You can now add it to your virtual machine like it was a PCI device. (Note: I had to install the recommended driver for Windows from this page)
For future updates this thread would be an interesting thread to follow.