OPNsense Forum

English Forums => General Discussion => Topic started by: Nearly9892 on September 23, 2024, 04:39:04 PM

Title: Bhyve PCI Passthrough NIC Issue
Post by: Nearly9892 on September 23, 2024, 04:39:04 PM
I recently set up a new hypervisor using vm-bhyve. I ran into an issue passing through an Intel dual port 82576 NIC and a Mellanox ConnectX-4 Lx MCX4121A-XCAT. I searched the web but did not find anyone discussing this issue.

Following the vm-bhyve man page, I reserved the devices by adding the device ID as shown with  pciconf -lv to the pptdevs variable in /boot/loader.conf.

Mellanox: 1/0/0 and 1/0/1
Intel NIC: 5/0/0 and 5/0/1

Then I rebooted and added the devices to the vm config file.

passthru0="5/0/0=8:0"
passthru1="5/0/1=8:1"
passthru2="1/0/0=9:0"
passthru3="1/0/1=9:1"


The VM would boot, but the nics would show in the VM intermittently and did not work most of the time.

To fix this I went back to /boot/loader.conf and reserved all possible functions (0-7) in the pptdevs variable, not just the ones displayed in pciconf -lv. This fixed the problem.

pptdevs="5/0/0 5/0/1 5/0/2 5/0/3 5/0/4 5/0/5 5/0/6 5/0/7 1/0/0 1/0/1 1/0/2 1/0/3 1/0/4 1/0/5 1/0/6 1/0/7"

I hope this helps someone trying to virtualize opnsense using bhyve.