PCI passthru with bhyve works on systems that have the Intel IOMMU (aka VT-d). This can be determined by seeing if there is a DMAR table in the ACPI tables i.e. acpidump -t | grep DMAR

1. Set up vmm.ko to be preloaded at boot-time.

2. Determine the bus/slot/function of the device that you want to pass through to the guest. This can be done with 'pciconf -vl'

alc0@pci0:2:0:0: class=0x020000 card=0xe0001458 chip=0x10831969 rev=0xc0 hdr=0x00

... the bus/slot/function is 2/0/0 (from the end of 'alc0@pci0:2:0:0')

3. Set up a loader environment variable so that vmm.ko's passthru module will grab the PCI device early in the boot sequence and prevent FreeBSD's driver for that device from attaching. The env variable contains the b/s/f of the device to pass through.

3a. Note that multiple devices can be added to this variable

After a reboot, the system will be ready to run with passthru.

4. The slot option to bhyve must be used to bind the host PCI device to the guest, using the b/s/f as the identifier. The guest slot/function has no correlation to the host b/s/f. For example, to assign the Atheros gigE adapter to a guest at slot 7, the bhyve commmand line would contain

Caveats: multi-function devices aren't always independent, and may have to be assigned to guests with the functions being the same. An example is QLogic FC adapters, where function 0 is used for f/w loading, while the other functions are for port data transfer. For these, the mappings of functions must be the same in the guest e.g.

Intel network adapters *don't* have this issue and can be split out to different guest slots e.g. an Intel adapter at host 6/5/0 and with 2 functions could be setup in the guest as two separate devices at slot 3 and slot 8:

bhyve/pci_passthru (last edited 2013-12-20 18:06:33 by NeelNatu)