-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB Passthrough #149
Comments
@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. |
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. |
Any update here? 🤔 |
We now have a potential solution in the form of USB/IP. I wrote up details here. |
Unfortunately that is only a solution for Windows users as MacOS does not have a USB/IP driver. |
More specifically a USB/IP server implementation (drivers aren't the issue.) I reference a few prospective server implementations, but hopefully we see an implementation soon. Docker shipping USB/IP natively unblocks the part that can't be done by the user. |
Huh? You think the "user" can write his own DriverKit driver? If you want this to work on Mac OS, you absolutely need a Mac OS driver (written in C++) which attaches to the USB device and presents it as a USB/IP device. Without this it doesn't work. This driver exists for Windows, but not MacOS |
Ah, I see. I misunderstood your point. I thought you were referencing the VHCI driver on the VM, which is part of what was enabled. USB/IP can be implemented via libusb, which is a user space driver. That's what many implementations are currently doing. While it won't be able to cover all USB use cases like an implementation based on DriverKit, it would allow many. I'm currently using one for embedded development and USB CDC works generally well. I'd love to see someone create a DriverKit-based server one day! |
If this is the method qemu uses, it's horribly broken on MacOS and last I looked nobody is trying to fix it |
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?
The text was updated successfully, but these errors were encountered: