Bug 1382331 - Redirected usb-hid devices do not work when using an emulated xhci controller
Summary: Redirected usb-hid devices do not work when using an emulated xhci controller
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-06 11:27 UTC by Hans de Goede
Modified: 2016-10-12 18:57 UTC (History)
10 users (show)

Fixed In Version: qemu-2.7.0-3.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-12 18:57:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
qemu-2.7.0-usb-redirect-wakeup.patch (1.09 KB, patch)
2016-10-10 08:54 UTC, Hans de Goede
no flags Details | Diff

Description Hans de Goede 2016-10-06 11:27:06 UTC
Description of problem:
Redirected usb-hid devices do not work when using an emulated xhci controller

Version-Release number of selected component (if applicable):
qemu-2.7.0-1.fc25.x86_64


How reproducible:

Steps to Reproduce:
1. Start qemu-system-x86_64 with -device nec-usb-xhci + options needed for spice usb-redirection
2. Connect to qemu with e.g. remote-viewer, select a usb-hid device keyboard to redirect
3. Try to use redirected keyboard in guest, nothing happings

Actual results:
Try to use redirected keyboard in guest, nothing happings.

Expected results:
Redirected keyboard can be used to type in guest.

Additional info:

Things do work when replacing "-device nec-usb-xhci" with "-readconfig /etc/qemu/ich9-ehci-uhci.cfg" on the qemu commandline, suggesting that this is a problem with interrupt endpoint handling in the xhci emulation.

remote-viewer in Fedora 25 currently has issues with updating the guest screen, see bug 1382325, when testing with spice either use the workaround described there, or a Fedora 24 spice-client. Note this should reproduce with host-redirection too, so using spice is not necessary.

Comment 1 Gerd Hoffmann 2016-10-07 09:28:50 UTC
> Things do work when replacing "-device nec-usb-xhci" with "-readconfig
> /etc/qemu/ich9-ehci-uhci.cfg" on the qemu commandline, suggesting that this
> is a problem with interrupt endpoint handling in the xhci emulation.
> 
> Note this should reproduce
> with host-redirection too, so using spice is not necessary.

Well, it doesn't, usb-host is doing fine.

I suspect it is a missing usb_wakeup() call somewhere in the redirection code.

ehci and uhci don't fall over in that case because we must poll anyway for correctness reasons.  Worst case is a delay in case ehci throttles polling due to inactivity on the usb bus.  xhci depends on wakeup calls though.  The different hardware design allows us to *not* poll constantly.

Care to have a look?  You know the redirection code better than me ...

Comment 2 Hans de Goede 2016-10-10 08:54:12 UTC
Created attachment 1208771 [details]
qemu-2.7.0-usb-redirect-wakeup.patch

Hi Gerd,

You were right, although the wakeup was there it was being called too early, it seems that now a days more work is done directly (rather then being scheduled) as a result of the call to wakeup and usbredir.c was not ready to handle this when it called usb_wakeup(). This patch fixes this. I've kicked of F25+ builds with this patch and I'll create an update.

Can you take care of upstreaming this ? Feel free to add my S-o-b, I created the patch using the Fedora pkgs, as I no longer have a qemu git clone around.

Regards,

Hans

Comment 3 Fedora Update System 2016-10-11 04:56:21 UTC
qemu-2.7.0-3.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-1db1147b8e

Comment 4 Fedora Update System 2016-10-12 18:57:56 UTC
qemu-2.7.0-3.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.