WebThings on bhyve and USB

Robert Crowston crowston at protonmail.com
Wed Jun 12 22:22:07 UTC 2019


> How to best approach Mozilla IoT Gateway?

I cannot speak to the meat of this question but I'll respond to the bhyve-related questions.

> I would need to somehow pass the USB ports to bhyve, so that Linux can
> pass them to the docker container. I heard it's not possible to pass
> specific USB ports but instead the whole PCI has to be passed

Yes, you can pass through a whole USB controller, not its individual ports. In practice therefore you will probably need at least two USB controllers on your system, unless it is headless.

> and it seems to be as complex as it sounds:

I think the complexity is overstated in the article. A better (although slightly out-of-date) guide is https://wiki.freebsd.org/bhyve/pci_passthru.

In particular I did not have to recompile the kernel or remove the xhci driver. As far as I remember all that is necessary was to add three lines to /boot/loader.conf:

hw.vmm.amdvi.enable="1" # AMD only: delete this line if you have an Intel processor.
pptdevs="10/0/3"        # Change 10/0/3 to the address of your USB controller.
vmm_load="YES"          # Load the bhyve kernel module on boot.

[There are some other caveats, for instance you may need to enable directed i/o virtualization in your BIOS.]


More information about the freebsd-virtualization mailing list