qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] "usb: uhci: Look up queue by address, not token"
Date: Sat, 17 Nov 2012 11:22:51 +0100	[thread overview]
Message-ID: <50A7657B.8010600@redhat.com> (raw)
In-Reply-To: <50A642F3.8060308@redhat.com>

Hi,

On 11/16/2012 02:43 PM, Gerd Hoffmann wrote:
> On 11/16/12 12:24, Jan Kiszka wrote:
>> On 2012-11-16 11:25, Gerd Hoffmann wrote:
>>> On 11/15/12 16:40, Jan Kiszka wrote:
>>>> Hi Hans,
>>>>
>>>> On 2012-11-15 16:19, Hans de Goede wrote:
>>>>> Hi Jan,
>>>>>
>>>>> I just saw your $subject patch in Gerd's usb-next tree, and I've a question
>>>>> about it. The token should be enough to uniquely identify a device + ep,
>>>>> and unless a guest uses multiple qhs for a singe ep, that _should_ be enough.
>>>>
>>>> But what disallows that the guest issues multiple requests (QH + series
>>>> of TDs) for a single endpoint? I'm not finding any trace in the spec
>>>> that disallows this. And my special guest is stumbling over that
>>>> limitation in QEMU.
>>>
>>> The order which the TDs from the two QHs are filled is undefined I
>>> think, so why a guest would do that?
>>
>> If short packets are ok, the next one queued would already be ready to
>> take the next chunk of data.
>
> I don't think you need two queues to model that.  IIRC the alt_next is
> taken on short tansfers, so you can line up all your TDs in one queue
> and let uhci jump forward to the next buffer start on short transfers
> using alt_next.
>

(Un)fortunately alt_next is an ehci only thing, uhci does not have this,
which may be a good thing as it has its own set of issues.

> The problem with two queues is that you simply don't know in which queue
> your transfers will end up and thus in which order your buffers are
> filled.  I don't think you want that.  If the device happens to NAK a
> transfer because it isn't ready yet uhci will go on to the next queue,
> so you can see the second queue being filled before the first is full.
> Wouldn't happen with qemu's uhci emulation, but I'm pretty sure on real
> hardware it can happen.

Ah good one, yes even with depth-first traversal if the device sends a nak
because it is not ready to send/receive, the controller will go horizontal
(so to the next qh), so even with depth first traversal using multiple qhs
per ep can go wrong. So that special legacy guest really is just broken by
design, even if it manages to get away with it on real hardware most of the
time.

Regards,

Hans

  reply	other threads:[~2012-11-17 10:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 15:19 [Qemu-devel] "usb: uhci: Look up queue by address, not token" Hans de Goede
2012-11-15 15:40 ` Jan Kiszka
2012-11-16 10:25   ` Gerd Hoffmann
2012-11-16 11:24     ` Jan Kiszka
2012-11-16 13:43       ` Gerd Hoffmann
2012-11-17 10:22         ` Hans de Goede [this message]
2012-11-16 13:29   ` Hans de Goede
2012-11-16 15:06     ` Jan Kiszka
2012-11-17 10:20       ` Hans de Goede

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=50A7657B.8010600@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).