USB passthrough in bhyve, USB keyboard disconnected

From: Naina Patrascu <patrascu.naina14_at_gmail.com>
Date: Wed, 11 Aug 2021 13:30:06 +0300
Hello,

We are working on the USB passthrough functionality for bhyve and we are
currently focusing on the passthrough of a USB keyboard.
We implemented the enumeration process and it seems to work properly, as we
can see the information about the USB keyboard inside the virtual machine
through the 'usbconfig' command:
(guest) $ usbconfig
(guest) ugen0.2: <Chicony HP Elite USB Keyboard> at usbus0, cfg=0 md=HOST
spd=LOW (1.5Mbps) pwr=ON (100mA)

But at some point during the boot of the guest virtual machine, the USB
keyboard is powered off: any LED from the keyboard is turned off and
pressing any key does not generate logs in the guest or in the host.

We tried multiple commands to display the information about the USB device:
usbconfig, devinfo. We compared the outputs from the host and guest and the
attachment to the guest looks correct.
To inspect the transfers, we used the command below, but nothing is
displayed on the guest:

usbdump -i usbusX -f Y -s 65536 -vvv

In the logs we see the steps of the enumeration successfully executed, and
then some timeout errors, as we cannot execute any transfer with the
keyboard, which seems disconnected.

Could you help us find out why this disconnection happens?
Could you give us a path for investigating this problem?

We used multiple work environments:
- the FreeBSD host started in QEMU kvm; nested virtualization enabled to
create guest machine
- FreeBSD host directly on a PC
The behavior of our feature is the same.

If you want to take a look, [1] is the repo containing our implementation;
here [2] you can find iso files from our sources, and here [3] is a
tutorial, describing the steps we use to create, run and destroy a virtual
machine.

Thank you!

[1]
https://github.com/FreeBSD-UPB/freebsd-src/tree/projects/bhyve_usb_passthrough
[2]
https://drive.google.com/drive/folders/17xUlbWSZ-wn6xT2ouv-M6miHV_LDeIEw?usp=sharing
[3]
https://github.com/FreeBSD-UPB/freebsd-src/wiki/Working-with-virtual-machines-in-bhyve-for-USB-passthrough
Received on Wed Aug 11 2021 - 10:30:06 UTC

Original text of this message