I wanted to share my experiences from bhyve GPU passthrough with Windows 10 guest. Many tutorials covered the most of the steps I needed to get it working but there were a few details which I wanted to write down and share with the community. I hope that this post helps others struggling to get GPU passthrough working.
Please feel free to share your experience and comment my configuration.
Hardware: Lenovo ThinkCentre M910 Tiny
CPU: Intel i7-7700T
GPU: Intel HD Graphics 630
OS: FreeBSD 14.1-RELEASE-p2 (clean install)
Part I: Host preparation:
Identify GPU device which will be passed to the vm:
pciconf -lv
vga@pci0:0:2:0: class=0x030000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x5912 subvendor=0x17aa subdevice=0x310b
vendor = 'Intel Corporation'
device = 'HD Graphics 630'
class = display
subclass = VGA
We see that vga@pci0:0:2:0 is the GPU and it uses PCI bus/slot/function 0/2/0.
The GPU needs to be detached from the host using ppt assignment. This can be done with the following entries to /boot/loader.conf (using the PCI bus/slot/function format above):
pptdevs="0/2/0"
vmm_load="YES"
From my experience, vmm_load="YES" must be included to loader.conf. Otherwise, the GPU won't detach from the host properly. In other words, it is NOT enough to have vm_enable="YES" in /etc/rc.conf (which will also load vmm.ko module but later stage during the boot process).
Reboot the host.
Verify that ppt is working as expected (vga0 has changed to ppt0):
pciconf -lv
ppt0@pci0:0:2:0: class=0x030000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x5912 subvendor=0x17aa subdevice=0x310b
vendor = 'Intel Corporation'
device = 'HD Graphics 630'
class = display
subclass = VGA
Now the host GPU is ready for bhyve passthrough.
Part II: Virtual machine configuration
I am using vm-bhyve to manage virtual machines but these steps can be followed also without vm-bhyve.
Passthrough can be enabled with the following entry in the vm-bhyve virtual machine configuration:
passthru0="0/2/0=2:0"
The above vm-bhyve statement translates into the following bhyve argument (which can also be seen from vm-bhyve logs):
-s 2:0,passthru,0/2/0
Note that the above statement specifies that PCI device 0/2/0 is assigned to guest slot 2:0. Without 2:0 slot statement, I wasn't able to get the GPU detected by the VM. I got the idea to test 2:0 from https://infosys.beckhoff.com/englis...cat_bsd/12607678219.html&id=17880199243163018
However, I was wondering how to identify the correct slot for other GPUs? Ideas?
Passthrough requires memory wiring (bhyve -S flag). However, vm-bhyve adds the -S flag automatically when VM config includes passthru statement. If you are not using vm-bhyve, -S must be included manually.
Start the vm.
Part III: Update GPU drivers to get rid off error 43
I discovered that Windows detected the GPU and installed drivers automatically. However, after a few seconds, Windows Device Manager returned error 43 for the device.
It seems that Windows stock drivers for the GPU are quite old (2022). Therefore, I installed new (dated 5/2024) drivers from the Intel website using Intel installer.
Once the updated drivers have been installed, power off the VM and reboot the host.
Once the host comes back online, start the vm.
Now, Windows detects the GPU properly and does not display any error messages. Also 3D acceleration seems to be working fine.
I will be testing the system under heavy load to check how it works. I will report back if I encounter any further issues.
Please feel free to share your experience and comment my configuration.
Hardware: Lenovo ThinkCentre M910 Tiny
CPU: Intel i7-7700T
GPU: Intel HD Graphics 630
OS: FreeBSD 14.1-RELEASE-p2 (clean install)
Part I: Host preparation:
Identify GPU device which will be passed to the vm:
pciconf -lv
vga@pci0:0:2:0: class=0x030000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x5912 subvendor=0x17aa subdevice=0x310b
vendor = 'Intel Corporation'
device = 'HD Graphics 630'
class = display
subclass = VGA
We see that vga@pci0:0:2:0 is the GPU and it uses PCI bus/slot/function 0/2/0.
The GPU needs to be detached from the host using ppt assignment. This can be done with the following entries to /boot/loader.conf (using the PCI bus/slot/function format above):
pptdevs="0/2/0"
vmm_load="YES"
From my experience, vmm_load="YES" must be included to loader.conf. Otherwise, the GPU won't detach from the host properly. In other words, it is NOT enough to have vm_enable="YES" in /etc/rc.conf (which will also load vmm.ko module but later stage during the boot process).
Reboot the host.
Verify that ppt is working as expected (vga0 has changed to ppt0):
pciconf -lv
ppt0@pci0:0:2:0: class=0x030000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x5912 subvendor=0x17aa subdevice=0x310b
vendor = 'Intel Corporation'
device = 'HD Graphics 630'
class = display
subclass = VGA
Now the host GPU is ready for bhyve passthrough.
Part II: Virtual machine configuration
I am using vm-bhyve to manage virtual machines but these steps can be followed also without vm-bhyve.
Passthrough can be enabled with the following entry in the vm-bhyve virtual machine configuration:
passthru0="0/2/0=2:0"
The above vm-bhyve statement translates into the following bhyve argument (which can also be seen from vm-bhyve logs):
-s 2:0,passthru,0/2/0
Note that the above statement specifies that PCI device 0/2/0 is assigned to guest slot 2:0. Without 2:0 slot statement, I wasn't able to get the GPU detected by the VM. I got the idea to test 2:0 from https://infosys.beckhoff.com/englis...cat_bsd/12607678219.html&id=17880199243163018
However, I was wondering how to identify the correct slot for other GPUs? Ideas?
Passthrough requires memory wiring (bhyve -S flag). However, vm-bhyve adds the -S flag automatically when VM config includes passthru statement. If you are not using vm-bhyve, -S must be included manually.
Start the vm.
Part III: Update GPU drivers to get rid off error 43
I discovered that Windows detected the GPU and installed drivers automatically. However, after a few seconds, Windows Device Manager returned error 43 for the device.
It seems that Windows stock drivers for the GPU are quite old (2022). Therefore, I installed new (dated 5/2024) drivers from the Intel website using Intel installer.
Once the updated drivers have been installed, power off the VM and reboot the host.
Once the host comes back online, start the vm.
Now, Windows detects the GPU properly and does not display any error messages. Also 3D acceleration seems to be working fine.
I will be testing the system under heavy load to check how it works. I will report back if I encounter any further issues.