Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Mar 2020 22:58:12 +1000
From:      Peter Grehan <grehan@freebsd.org>
To:        Daniel Nicolescu <daniel.nicolescu10@gmail.com>
Cc:        freebsd-virtualization@freebsd.org, patrascu.naina14@gmail.com, Mihai Carabas <mihai.carabas@cs.pub.ro>
Subject:   Re: USB device passthrough implementation
Message-ID:  <7043f9f6-448d-a76e-920d-9fa17cb0a2be@freebsd.org>
In-Reply-To: <CAG9wUUNFOX-nt6FP1K0hcXycE1AvfzXpa9UdD9%2BQvZeBfY5KJA@mail.gmail.com>
References:  <CAG9wUUNFOX-nt6FP1K0hcXycE1AvfzXpa9UdD9%2BQvZeBfY5KJA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Daniel,
> * We need to disconnect the USB device from host: we are currently not very
> familiar with the kernel API to perform this

  See usbconfig(8) and the detach_kernel_driver command. It's probably 
fine to request a user to issue that command, similar to how external 
commands are required to detach a PCI driver before using it for 
passthru in bhyve.

> * 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.

  pci_xhci.c is an implementation of a USB XHCI host controller so 
should be the place to start: it either has the functionality that is 
needed, or requires slight modifications.

  (Lots of info and pointer to the spec at 
https://en.wikipedia.org/wiki/Extensible_Host_Controller_Interface)

  usb_mouse.c is just an example of a USB device interface, that in turn 
passes through VNC mouse-movement events to the guest o/s.

> * 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.

  ACRN uses libusb as the interface to USB devices on the host (see 
devicemodel/hw/platform/usb_pmapper.c).

later,

Peter.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7043f9f6-448d-a76e-920d-9fa17cb0a2be>