FreeBSD as guest using GPU-Passthrough reddit / freebsd ---------------------------------------------------------------------- toasty_fe · 2022-06-23 21:01 Hey guys, So recently I've decided to create an interesting project: Use FreeBSD as a guest with my dGPU via GPU Passthrough. But it's got a lot of caveats to it and I wonder if someone could help me. The first reason why I'm not installing straight into my machine is because it's a Surface Book (1st Gen - Performance Base Edition) which doesn't even recognize the keyboard after trying to install it via an external one. So it has to have a Linux kernel and run it as a guest. The second problem is that despite running almost perfectly, the laptop requires a custom kernel called [surface- linux](https://github.com/linux-surface/linux-surface) in order to have stable WiFi connection and recognize the NVIDIA dGPU. Following along, the third problem was switching between the iGPU and the dGPU. In that case, I've opted for the [optimus- manager](https://github.com/Askannz/optimus-manager) project in order to switch between them. It's works great with Arch. So the only way I could run FreeBSD with the NVIDIA dGPU would be by using a Type 1 Hypervisor such as KVM. That would be the only way to get the GPU Passthrough. I've read [ArchWiki article](https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF) regarding GPU Passthrough extensively. I was able to isolate the NVIDIA dGPU, by loading only the `vfio-pci` drivers when turning on, but I'm still not able to connect with the VM using it. **One thing to notice is that when using lspci the NVIDIA dGPU appear as 3D Graphics, and not VGA. I'm pretty sure this is the reason why I cannot fully detach it.** Can anyone help me with this project? ---------------------------------------------------------------------- Anopheli · 2022-06-24 20:54 I looked into this a while back and concluded KVM/vfio is not viable. I could not find any examples of successfully using a vfio device in a FreeBSD guest - though I did find examples of the reverse (FreeBSD Bhyve host, Linux guest). But Bhyve passthrough is not vfio. Also I still find it funny that KVM calls itself type 1, when Bhyve, which has the same design, calls itself type 2. Just shows how meaningless those terms have become. I thought it might be possible to do with Xen. Xen doesn’t support vfio yet, but does support PCI passthrough using static allocation, or plugging using Xen pcifront/pciback. FreeBSD does support Xen pcifront. Unlike vfio this allocates the bare metal hardware without any intermediary software. I thought this might be more successful. I stopped looking into this because of nVidia’s open hostility to GPU virtualization and the complexities of iGPU/dGPU. It wouldn’t have been stable or usable enough for my needs.