bhyve USB pass-through clarification - use a separate PCI USB card?

Using bhyve, can you pass through a single (or multiple) built-in USB ports from the host motherboard to the VM, or is it better to add a standalone, PCI USB card to the motherboard? Is the PCI card an easier way to achieve pass-through?

I have read the documentation at: https://wiki.freebsd.org/bhyve/pci_passthru , but I don't see what I'm looking for. Somewhere I saw people discussing this and led me to believe that the easiest way is by using an add-on PCI, USB card. I thought I read that some people said the host might lose control of its own mouse or keyboard when the VM boots which is why they recommend the add-on card.; it's easier for the host and VM to isolate the USB ports.

Suggestions?

Thank you,
Ed
 
You need a separate controller, with its own PCIe interface.

The easiest is to get a card. Note that there are cards specifically for this purpose that have 4 separate controllers on them, so that you can pass them to 4 different VMs.
 
You need a separate controller, with its own PCIe interface.

The easiest is to get a card. Note that there are cards specifically for this purpose that have 4 separate controllers on them, so that you can pass them to 4 different VMs.
Oh, very cool.

Can you give me an example of what you're describing, maybe from Amazon?

Ed
 
Yeah, Startech is usually a premium brand for exotic gear like this.

Screw it, I just ordered one. These things have a tendency to not be available when you need them.
 
Does the card need multiple controllers or just dedicated channels to work with bhyve the way I want it to work, i.e., USB pass-through?
Bhyve does not implement USB pass-through. You'll have to pass-through a PCIe device.
Most PCIe USB cards provide one PCIe device. The trick with the one linked by cracauer@ and myself is that it provides one PCIe device per USB port. That may or may not be necessary for your use case. If you're happy to pass all USB ports to the same VM you don't have to get a "special card".
 
Bhyve does not implement USB pass-through. You'll have to pass-through a PCIe device.
Most PCIe USB cards provide one PCIe device. The trick with the one linked by cracauer@ and myself is that it provides one PCIe device per USB port. That may or may not be necessary for your use case. If you're happy to pass all USB ports to the same VM you don't have to get a "special card".
Oh, thank you for that clarification.

So, in my case, I will be running one (1) VM at a time, but it will need to be able to connect to at least 1 of the host USB slots. I don't care which one, but at least one of them.

Is it still going to be easier if I buy a standalone USB PCIe card, even like the one that I found, for the convenience of my bhyve VM configuration(s)?

Thank you for your feeback!

Ed
 
If you only have the bare metal and one VM then a simple PCIe card will be enough. You run the bare metal one with the on-mainboard controller and the VM with the PCIe card.

But you don't know what you need in the future. Maybe more VMs. As I said these pieces of hardware are not available forever.
 
I think I am lucky that i can passthrough some USB ports of my desktop to one VM without buying anything.

Code:
$ pciconf -lv | grep -A4 xhci
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
--
xhci1@pci0:8:0:3:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1043 subdevice=0x87e1
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB
xhci2@pci0:8:0:4:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1043 subdevice=0x87e1
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB

I pass the 1/0/0 one, yes, I did lose my mouse and keyboard once, but changing the ports made them work again and I could use other ports like the front panel for the VM.
 
I think I am lucky that i can passthrough some USB ports of my desktop to one VM without buying anything.

Code:
$ pciconf -lv | grep -A4 xhci
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
--
xhci1@pci0:8:0:3:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1043 subdevice=0x87e1
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB
xhci2@pci0:8:0:4:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1639 subvendor=0x1043 subdevice=0x87e1
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Renoir/Cezanne USB 3.1'
    class      = serial bus
    subclass   = USB

I pass the 1/0/0 one, yes, I did lose my mouse and keyboard once, but changing the ports made them work again and I could use other ports like the front panel for the VM.
Excellent.

How did you identify and isolate a single USB port? Trial and error?

Did you add that to your .conf file (i.e., passthru0="pci1:0:0") so your VM way created during the OS install or some other way? How'd you get the VM to use that USB slot?

Ed
 
Back
Top