bhyve Can multiple bhyve VMs use the same USB PCIe device as long as they run individually?

I like the suggestion that cracauer@ made to use a USB card with four (4) separate controllers, so each controller can be assigned to a different VM.

I need a clarification; can a single "dumb" PCIe USB card (without individual controllers) be assigned to more than one (1) VM as long as only a single VM runs at any given time? Or, do you have to have one of the PCIe cards with individual controllers (like: https://www.amazon.com/gp/product/B00HJZEA2S/ref=ox_sc_saved_title_5?smid=ATVPDKIKX0DER&th=1 ) with each controller assigned to a different VM, even if only a single VM runs at any time?

I hope that makes sense.

:-)

Ed
 
Why wouldn't that work? I can't think of a reason.
Thank you Sir.

:-)

In my case, I just need USB availability to a single VM at any one time. I will have multiple bhyve VMs installed and all with the necessary "passthru0="x/x/x" settings as part of their own .conf files, but I don't plan on running more than one of the VMs at a time.

If I understand the PCI passthrough, the PCIe USB card will not be available (seen) to the host OS because it is a line entry in the loader.conf file? That hides it from the kernel when FBSD boots? If that's true, the way to make it available to a VM only when you want to is like what nxjoseph@ said, ..."I don't like permanently setting the passthrough PCI device through /boot/loader.conf but do # devctl set driver -f pci0:1:0:0 ppt(?, was something like that)(ppt for passthrough driver, xhci for normal driver) instead."

Ed
 
If I understand the PCI passthrough, the PCIe USB card will not be available (seen) to the host OS because it is a line entry in the loader.conf file?
I guess this way, the system does not try to attach a driver to the PCI card but the device can be seen with pciconf(8). I don't know if it is still allowed to attach a driver to it later after boot but probably.

Yes, I passthrough the PCI device when I need to, for example.

Rich (BB code):
root@freebsd:~ # pciconf -lv | grep -A4 pci0:1:0:0
xhci0@pci0:1:0:0:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'A520 Series Chipset USB 3.1 XHCI Controller'
    class      = serial bus
    subclass   = USB
root@freebsd:~ # devctl set driver -f pci0:1:0:0 ppt
root@freebsd:~ # pciconf -lv | grep -A4 pci0:1:0:0
ppt0@pci0:1:0:0:        class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'A520 Series Chipset USB 3.1 XHCI Controller'
    class      = serial bus
    subclass   = USB
root@freebsd:~ # devctl set driver -f pci0:1:0:0 xhci
root@freebsd:~ # pciconf -lv | grep -A4 pci0:1:0:0
xhci0@pci0:1:0:0:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'A520 Series Chipset USB 3.1 XHCI Controller'
    class      = serial bus
    subclass   = USB
root@freebsd:~ # man -f xhci
xhci(4) - USB eXtensible Host Controller driver
 
Back
Top