All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Sebastian Bauer <mail@sebastianbauer.info>
Subject: [Qemu-devel] [PULL 2/7] ohci: Clear the interrupt counter for erroneous transfers
Date: Tue, 21 Aug 2018 11:11:43 +0200	[thread overview]
Message-ID: <20180821091148.32220-3-kraxel@redhat.com> (raw)
In-Reply-To: <20180821091148.32220-1-kraxel@redhat.com>

From: Sebastian Bauer <mail@sebastianbauer.info>

This is mandated by the ohci specification. It tells at 6.4.4 on page 104
that for transfer descriptors that are retired with an error the done
queue interrupt counter is cleared as if the interrupt delay field of the
descriptions were zero.

Before this change, error conditions were handled similarly to the
successful condition which is especially troublesome for control transfers.
Some drivers (e.g., the AmigaOS-one) as well as the example code in the
spec, set the setup stage with an interrupt delay of seven (which means no
interrupt). This is fine under normal conditions, because one usually
doesn't want to be notified about the completion of this stage. However, if
an error occurs in this stage, these drivers will not get notified with the
current implementation. The fix addresses this by following the spec more
closely. Also, otherwise, the ability to set interrupt delay to seven would
be useless.

Note that Linux drivers that I looked at don't seem to be affected as they
set six as the interrupt delay presumably for the reason that they won't
get notified otherwise.

Signed-off-by: Sebastian Bauer <mail@sebastianbauer.info>
Message-id: 20180729191928.11254-1-mail@sebastianbauer.info
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ohci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index d4c0293db5..98da5f0f04 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1156,6 +1156,9 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
                 OHCI_SET_BM(td.flags, TD_EC, 3);
                 break;
             }
+            /* An error occured so we have to clear the interrupt counter. See
+             * spec at 6.4.4 on page 104 */
+            ohci->done_count = 0;
         }
         ed->head |= OHCI_ED_H;
     }
-- 
2.9.3

  parent reply	other threads:[~2018-08-21  9:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  9:11 [Qemu-devel] [PULL 0/7] Usb 20180821 patches Gerd Hoffmann
2018-08-21  9:11 ` [Qemu-devel] [PULL 1/7] docs/usb2.txt: ehci has six ports Gerd Hoffmann
2018-08-21  9:11 ` Gerd Hoffmann [this message]
2018-08-21  9:11 ` [Qemu-devel] [PULL 3/7] dev-mtp: add support for canceling transaction Gerd Hoffmann
2018-08-21  9:11 ` [Qemu-devel] [PULL 4/7] dev-mtp: fix buffer allocation for writing file contents Gerd Hoffmann
2018-08-21  9:11 ` [Qemu-devel] [PULL 5/7] dev-mtp: retry write for incomplete transfers Gerd Hoffmann
2018-08-21  9:11 ` [Qemu-devel] [PULL 6/7] dev-mtp: Add support for > 4GB file transfers Gerd Hoffmann
2018-08-21  9:11 ` [Qemu-devel] [PULL 7/7] dev-mtp: rename x-root to rootdir Gerd Hoffmann
2018-08-23  9:19 ` [Qemu-devel] [PULL 0/7] Usb 20180821 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180821091148.32220-3-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=mail@sebastianbauer.info \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.