usb: bugfixes for ehci and xhci

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZQOlBAAoJEEy22O7T6HE48eEP/RZxC2tViZ6DLL99EQPumeZW
 /rmrGfO7cWOtKgMD2Mvh0NSm7D/D1ga1nrCD4UB5Y3wxAzulpn6wSpDnHEEVzwTP
 91aZXmF8bSzk6pL6Wi2DOq+USPZ9ZSjnNctgO0BEgIj714zgf/XkVitdYmnRii1z
 CnDYZSyWbi0PTr/exL+0eoNXi7NJVcazAK6dCCx9FZ/qcS7fUtuE2B5MIl8xh8E2
 BgswVCIrf047uIRwYb0L02gCojsXfsVYsyYKovUhkukp7tojmZ3JjJ0u9tg9d+x/
 XGTQydr6+Ooo7yulAQdT8ekti0mkAthmy70NjTHDVraTHcOu1L1rRj8gP5aqB+07
 0USCcS5gZjCRbQ6UTql4MdLBY9rJZVAT/5jW+eUqUTY14ycm0ga2jjCMvMNiXmdR
 XqbgV81BKI6lXOTWTQDf+ZqrDNJ4z7gFJsEWRQBtQ+ACfTeQLxSw6lbYFudeOcHy
 NbcmNRddM7DFpuG4gZYFt1x/9erx6SBtmPglauRFowHnGgeXtAttNWByiTcNjrd0
 BcdK08x3w2te/0s0XLhhrMJMpLebYzDcPsSd7p6a44lFOYh50vaaqrhltBr1iskZ
 OymeRa5th4O6uw91tXw6m+P0wQ226ZUNnEz6eDLackfXoLXf+AlAwUWzXJkU9ACp
 ZSY2Ia+SvIUWSDlhGWfC
 =CzSu
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20170614-1' into staging

usb: bugfixes for ehci and xhci

# gpg: Signature made Wed 14 Jun 2017 08:44:01 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/pull-usb-20170614-1:
  ehci: stop recursive calls to ehci_work_bh
  xhci: only update dequeue ptr on completed transfers

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-06-19 17:54:30 +01:00
commit cef8fd6836
3 changed files with 12 additions and 2 deletions

View File

@ -2241,6 +2241,11 @@ static void ehci_work_bh(void *opaque)
uint64_t uframes, skipped_uframes;
int i;
if (ehci->working) {
return;
}
ehci->working = true;
t_now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
ns_elapsed = t_now - ehci->last_run_ns;
uframes = ns_elapsed / UFRAME_TIMER_NS;
@ -2322,6 +2327,8 @@ static void ehci_work_bh(void *opaque)
}
timer_mod(ehci->frame_timer, expire_time);
}
ehci->working = false;
}
static void ehci_work_timer(void *opaque)

View File

@ -297,6 +297,7 @@ struct EHCIState {
*/
QEMUTimer *frame_timer;
QEMUBH *async_bh;
bool working;
uint32_t astate; /* Current state in asynchronous schedule */
uint32_t pstate; /* Current state in periodic schedule */
USBPort ports[NB_PORTS];

View File

@ -1912,6 +1912,8 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
}
assert(!xfer->running_retry);
if (xfer->complete) {
/* update ring dequeue ptr */
xhci_set_ep_state(xhci, epctx, stctx, epctx->state);
xhci_ep_free_xfer(epctx->retry);
}
epctx->retry = NULL;
@ -1962,6 +1964,8 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
xhci_fire_transfer(xhci, xfer, epctx);
}
if (xfer->complete) {
/* update ring dequeue ptr */
xhci_set_ep_state(xhci, epctx, stctx, epctx->state);
xhci_ep_free_xfer(xfer);
xfer = NULL;
}
@ -1979,8 +1983,6 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
break;
}
}
/* update ring dequeue ptr */
xhci_set_ep_state(xhci, epctx, stctx, epctx->state);
epctx->kick_active--;
ep = xhci_epid_to_usbep(epctx);