moby / hyperkit

A toolkit for embedding hypervisor capabilities in your application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

USB Passthrough

jgoldring opened this issue · comments

Are there any plans to add a USB-passthrough feature? This would be hugely beneficial to people like myself who are using Docker toolbox to allow for USB passthrough into containers running on mac OS. I would rather use the newer Docker for Mac, but it is not doable without the ability to forward USB into containers.

If this would violate the verdict to not deviate from xhyve, is this question more appropriately asked in that repo?

@jgoldring we are currently not working on USB device passthrough, xhyve was derived from FreeBSDs bhyve and the code is still fairly similar. According to https://wiki.freebsd.org/bhyve USB device passthrough is in progress on bhyve but even if that was finished, we could only lift the USB device emulation as presented to the guest from it. Then we'd still need to figure out how to implement the macOS side of things. It must be possible on macOS as other VMMs support it, but it may require kernel support (I simply don't know). Some USB device classes might be easier to handle than others. Finally, even if (and that's a big if) HyperKit would support it, it would still needed to be exposed via the UI to select USB devices and whatnot.

Long story short, this is a significant amount of work even if bhyve would support it.

The tentative plan for bhyve is to have a unix-domain socket server that sits at the back-end of the XHCI emulation. USB targets would then connect to this, using something like a serialized version of libusb. The connect/disconnect would be reflected to the guest as a device insert/extract.

Hi, it looks like USB passthrough has been implemented in bhyve.

Has there been any progress/change in plans to port it to Hyperkit?

That is PCI passthrough, not the USB passthrough design described above. It is not clear that PCI passthrough can be implemented on OSX, and for USB purposes it is not that useful as which devices you can passthrough depends on the PCI topology, eg you might only be able to attach all devices to the VM.

you might only be able to attach all devices to the VM.

Does this mean that the whole USB controller can possibly be attached?

If you implemented PCI passthrough, which may not be possible, then yes, it might also be the case that only the whole USB controller could be attached. I don't know the PCI topology in Macs.

Can someone provide an update on the current status of USB passthrough in hyperkit? What are the key blockers?

@djs55 David can you shed any light on this? Does (or did) the commit docker/for-mac#5263 (comment) on 19 Jan 2021 actually resolve this issue?

@djs55 sorry, apologies, I re-read your comment. So I guess even though the current xhyve (and hyperkit) now do have usb passthrough this has not yet made it into docker on Macs. Right?

how about now.