Skip to contentSkip to conversation

Usb 20180703 patches

GIT PULL Applied Gerd Hoffmann 2 participants 4 messages Jul 3, 2018

lore
Share & tools
lore
#0 lore raw

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/usb-20180703-pull-request

for you to fetch changes up to 8f36ec708834dfad58af6feb0b69bb0be6077f0f:

xhci: fix guest-triggerable assert (2018-07-03 09:50:39 +0200)

----------------------------------------------------------------
usb: bugfixes for ehci and xhci.

----------------------------------------------------------------

Gerd Hoffmann (1):
xhci: fix guest-triggerable assert

Sebastian Bauer (1):
ehci: Don't fetch a NULL current qtd but advance the queue instead.

 hw/usb/hcd-ehci.c | 3 ++-
 hw/usb/hcd-xhci.c | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL 1/2] ehci: Don't fetch a NULL current qtd but advance the queue instead.

From: Sebastian Bauer <[email protected]>

Fetching qtd with the NULL address most likely makes no sense so from now on, we handle it this case similarly as if the terminate (T) bit is not set, which is already an exception as according to section 3.6 of the EHCI spec there is no T bit defined for the current_qtd field.

The spec is a bit vague on how an EHCI driver should initialize these
fields: "The general operational model is that the host controller can detect whether the overlay area contains a description of an active transfer" (p. 49). QEMU primarily uses the QTD_TOKEN_ACTIVE bit of the queue header to infer the activity state but there are other ways conceivable.

This change allows QEMU to boot further into AmigaOS. The public available version of the EHCI driver recycles queue heads in some rare conditions but only clears the current_qtd field but not the status field. This works with many available EHCI PCI cards but e.g., not with the Freescale USB controller's found on the P5040. On the emulated EHCI controller of QEMU the consequence is that some garbage was read in, which resulted in a reset of the controller. This change fixes the problem.

Message-id: [email protected]

---
 hw/usb/hcd-ehci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/hcd-ehci.c +2 -1
index 0134232627..e5acfc5ba5 100644
@@ -1672,7 +1672,8 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async)
         ehci_set_state(ehci, async, EST_HORIZONTALQH);
 
     } else if ((q->qh.token & QTD_TOKEN_ACTIVE) &&
-               (NLPTR_TBIT(q->qh.current_qtd) == 0)) {
+               (NLPTR_TBIT(q->qh.current_qtd) == 0) &&
+               (q->qh.current_qtd != 0)) {
         q->qtdaddr = q->qh.current_qtd;
         ehci_set_state(ehci, async, EST_FETCHQTD);
 
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL 2/2] xhci: fix guest-triggerable assert

In reply to Gerd Hoffmann

Set xhci into error state instead of throwing a core dump.

Message-id: [email protected]

---
 hw/usb/hcd-xhci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
hw/usb/hcd-xhci.c +6 -1
index 721beb5486..8f1a01a405 100644
@@ -1954,7 +1954,12 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
         for (i = 0; i < length; i++) {
             TRBType type;
             type = xhci_ring_fetch(xhci, ring, &xfer->trbs[i], NULL);
-            assert(type);
+            if (!type) {
+                xhci_die(xhci);
+                xhci_ep_free_xfer(xfer);
+                epctx->kick_active--;
+                return;
+            }
         }
         xfer->streamid = streamid;
 
Signature · 1 line
2.9.3
#3 lore raw
In reply to Gerd Hoffmann
Quoted 20 lines · Gerd Hoffmann

The following changes since commit ab08440a4ee09032d1a9cb22fdcab23bc7e1c656:

Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180702' into staging (2018-07-02 17:57:46 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/usb-20180703-pull-request

for you to fetch changes up to 8f36ec708834dfad58af6feb0b69bb0be6077f0f:

xhci: fix guest-triggerable assert (2018-07-03 09:50:39 +0200)

----------------------------------------------------------------
usb: bugfixes for ehci and xhci.

----------------------------------------------------------------

Gerd Hoffmann (1):
xhci: fix guest-triggerable assert

Quoted 6 lines

Sebastian Bauer (1):
ehci: Don't fetch a NULL current qtd but advance the queue instead.

 hw/usb/hcd-ehci.c | 3 ++-
 hw/usb/hcd-xhci.c | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Applied, thanks.

-- PMM