bhyve Windows doesn't boot with PCI passthru

Windows loads normally without -s 7,passthru,0/20/0, but with it Windows 8.1 stuck on bootlogo, and Windows 10 shows me bsod with MEMORY_MANAGEMENT error.
My bhyve script
Code:
#!/bin/sh
bhyve -c sockets=1,cores=4,threads=1 -m 4G -w -H -S \
-s 0,hostbridge \
-s 4,ahci-hd,win10.img \
-s 5,virtio-net,tap0 \
-s 7,passthru,0/20/0 \
-s 29,fbuf,tcp=0.0.0.0:5900,w=1600,h=900,wait \
-s 30,xhci,tablet \
-s 31,lpc -l com1,stdio \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
win10
/boot/loader.conf
Code:
pptdevs="0/20/0"
FreeBSD 14.5
 
Just sharing my experience. I have never managed to successfully passing usb in bhyve vm. It may work for some time, but next reboot, or guest machine do some staff with usb and the host may crash or panic. Even with dedicated USB board passed to the guest ... If you really need a guest with working USB - try qemu, it just works. Meybe perfomance will not be the same under FreeBSD, but, it will do everything you need.

PS. If someone has working solution passing USB to the guest, please share.
 
I use ESXi which passes USB ok.
My daily driver is built on dual SSD, bios dual boot to Win10 or MX Linux to avoid entirely any Windows/GRUB conflicts.

Boot device selection at BIOS time is far simpler for me than hacking to get the two to play nicely from a common boot menu.
 
add the following lines to /boot/loader.conf:
vmm_load="YES"
hw.vmm.amdvi.enable="1" (only for AMD cpus)
pptdevs="4/0/3 4/0/4 5/0/0" (all the PCI devices you'll be passing through)

FreeBSD doesn't have much info on IOMMU groups, but ALL devices in a single IOMMU group MUST be passed through to the same VM. You can't split them up, or only pass some through. All or nothin'. I have one device where all the on-board USB ports are in the same IOMMU group, and another device in which they are wonderfully in separate groups each. I did the USB passthrough on both devices, but had to pass all through on one device.

I have noticed that **any** changes to PCI passthrough (adding/removing devices, changing which VM gets them...)seem to require a host reboot before you can use them.
 
  • Like
Reactions: drr
May not be the ideal solution, but I had success passing through an entire PCIe USB card to a bhyve virtual machine, which then correctly detected and used the USB ports on it.
I had ~3 different brands of PCIe usb adapters, all of them initially worked kinda ok, the guest does see devices connected, also works correctly with data. But there is a catch. It may work a day or two, but if guest machine executes USB device suspend / shutdown - the host sometimes crashes, or halts completely, or runs into kernel panic. I did that tests on DELL PowerEdge R540 servers.

Could you please share for how long did you test pass-thru devices ?
 
Could you please share for how long did you test pass-thru devices ?

Not for too long, unfortunately. I used this set up to pass through a DAS data storage pool connected via a PCIe USB adapter to a virtual machine running TrueNAS. I experimented with it for a couple of days before changing the entire set up, replacing the virtual machine with bare metal running Alpine Linux. BTW, the machines were slightly old Dell Optiplex desktops with Intel processors.
 
Back
Top