USB device passthrough implementation

Daniel Nicolescu daniel.nicolescu10 at gmail.com
Tue Mar 17 15:34:18 UTC 2020


Hi,

We would like to implement it in user-space.

On Tue, Mar 17, 2020 at 3:13 PM Hans Petter Selasky <hps at selasky.org> wrote:

> Hi,
>
> On 2020-03-17 13:41, Daniel Nicolescu wrote:
> > Hi,
> >
> > We want to implement the USB pass through feature for bhyve so that users
> > will be able to pass through individual USB devices like in QEMU. We are
> > trying to emulate the USB controller and pass to the virtual machine only
> > one port.
> >
> > * We need to disconnect the USB device from host: we are currently not
> very
> > familiar with the kernel API to perform this
>
> See:
> libusb_detach_kernel_driver().
>
> > * We need to emulate a USB device controller: we are currently looking
> into
> > pci_xhci.c and usb_mouse.c to reuse some of the code from there and we
> > would like to know if there is some sort of in depth documentation
> > regarding these.
> > * We need to pass the USB device to the guest through an emulated port of
> > the device controller: we know that project ACRN implements USB device
> > passthrough and we are trying to figure out how they do it.
> >
> > Could you give us a few suggestions on how to tackle these?
>
> USB has four transfer types:
>
> 1) Control transfers
> 2) Interrupt transfers
> 3) Bulk transfers
> 4) Isochronous transfers
>
> If your implementation is supposed to be fully USB compliant you need to
> support and test all transfer types.
>
> Please also pay attention to error conditions.
>
> USB has different speeds, LOW, HIGH, FULL, SUPER, which impose different
> characteristics on the USB wMaxPacketSize for example.
>
> You should know about the principle of short-terminated USB transfers.
>
> Is the wrapper supposed to be implemented in the kernel or in user-space?
>
> --HPS
>


More information about the freebsd-virtualization mailing list