# bhyve passthru mystery



## aragats (Mar 20, 2020)

My Dell Precision 7540 has 3 PCI xhci controllers. I pass-through one of them to my MS Windows guest.
The physical connectors are: 2 USB-C (Thunderbolt) and 2 USB-A. Of course, I'm not 100% sure which connector goes to which controller. 

Devices plugged in the USB-A, appear in Windows, thus I can use USB-C connectors for FreeBSD. Today I discovered that a USB-to-Serial adapter plugged into USB-C connector was passed-through to Windows! Right away I unplugged it and plugged in a USB-to-Ethernet adapter and it appeared in FreeBSD!

What am I missing? I don't have any experience with Thunderbolt.


----------



## usdmatt (Mar 20, 2020)

If the same port has appeared both in Windows and FreeBSD, just by changing the connected device, my only guess would be that the serial adaptor uses an older standard (could easily be USBv1 considering the low bandwidth requirement of serial), and has been somehow handed off to another controller (the one passed to Windows).

Would be interesting to know for sure but I don't know for sure if this is even done, or even how to verify how your controllers/ports are wired.


----------



## aragats (Mar 20, 2020)

usdmatt said:


> Would be interesting to know for sure but I don't know for sure if this is even done, or even how to verify how your controllers/ports are wired.


The funny thing is that after a few swappings of my USB devices the motherboard died! Today a Dell technician is supposed to come and replace it. Then I'll try get more detailed on this.


----------



## Phishfry (Mar 20, 2020)

When I was messing with bhyve and passthru onboard USB controllers I could only passthru all USB ports or none.
That was even with two different USB PCI bus addresses 29/0/0 and 30/0/0.
If I passthru one it does not work right. I have to passthru both and then it works but I lose my host USB.
It seems to come back to the xhci/ehci mode of the controller. It controls both pci addresses.
Which mode was the USB passthru PCI address showing? xhciX or ehciX. X=number of port.
For example xhci0@135:0:0 or ehci0@35:0:0


----------



## aragats (Mar 20, 2020)

Phishfry said:


> Which mode was the USB passthru PCI address showing? xhciX or ehciX. X=number of port.
> For example xhci0@135:0:0 or ehci0@35:0:0


I have only xhciX PCI devices in this box. Three of them, unfortunately cannot post the output of `pciconf -lv` at the moment.


----------



## aragats (Apr 4, 2020)

I've found that this "mystery" is caused by another device called "USB connector manager", so I started another thread on this.


----------



## Alain De Vos (Apr 4, 2020)

I have the experience things work when the device is plugged in when you boot a guest os but not more when you remove an plug in again afterwards like the resources are not given free.


----------



## aragats (Apr 4, 2020)

Alain De Vos said:


> ... like the resources are not given free


Yeah, I even submitted a bug report on this a while ago.
However, here it's different. That USB connector manager has its own logic which controller to pass the connected device to. It's well reproducible. The question is how to control/alter its logic?


----------

