From: Cameron Esfahani via <qemu-devel@nongnu.org>
To: Cameron Esfahani <dirty@apple.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Cameron Esfahani via" <qemu-devel@nongnu.org>,
kraxel@redhat.com, "Paolo Bonzini" <pbonzini@redhat.com>,
"Paul Menzel" <pmenzel@molgen.mpg.de>,
"Robert Mustacchi" <rm@fingolfin.org>
Subject: Re: [PATCH v1] usb: Add read support for HCIVERSION register to XHCI
Date: Tue, 31 Mar 2020 03:24:28 -0700 [thread overview]
Message-ID: <58CE5200-AB75-4014-AA2B-EE6E2F265A43@apple.com> (raw)
In-Reply-To: <C89783E6-965B-4C0B-BB2F-6CB52D47F625@apple.com>
Actually, reading the specification a little more, the only fields which are documented as being smaller than 4-bytes are CAPLENGTH (1-byte) and HCIVERSION (2-bytes).
So maybe change impl.min_access_size to 1 and rely on the fact that traditionally callers haven't read less than 4-bytes for any of the 4-byte fields...
Cameron Esfahani
dirty@apple.com
"In the elder days of Art, Builders wrought with greatest care each minute and unseen part; For the gods see everywhere."
"The Builders", H. W. Longfellow
> On Mar 31, 2020, at 2:57 AM, Cameron Esfahani via <qemu-devel@nongnu.org> wrote:
>
> Philippe -
> From what I've seen, access size has nothing to do with alignment.
>
> What the code in access_with_adjusted_size() will do is make sure that "size" is >= min_access_size and <= max_access_size.
>
> So reading 2-bytes from address 2 turns into reading 4-bytes from address 2: xhci_cap_read() is called with reg 2, size 4.
>
> But, due to the fact our change to support reg 2 only returns back 2-bytes, and how the loops work in access_with_adjusted_size(), we only call xhci_cap_read() once.
>
> It seems like we should also change impl.min_access_size for xhci_cap_ops to be 2.
>
> But, after that, to support people doing strange things like reading traditionally 4-byte values as 2 2-byte values, we probably need to change xhci_cap_read() to handle every memory range in steps of 2-bytes.
>
> But I'll defer to Gerd on this...
>
next prev parent reply other threads:[~2020-03-31 10:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 21:44 [PATCH v1] usb: Add read support for HCIVERSION register to XHCI Cameron Esfahani via
2020-03-31 7:52 ` Philippe Mathieu-Daudé
2020-03-31 9:57 ` Cameron Esfahani via
2020-03-31 10:24 ` Cameron Esfahani via [this message]
2020-03-31 11:02 ` Philippe Mathieu-Daudé
2020-04-01 11:23 ` Cédric Le Goater
2020-04-03 0:48 ` Andrew Jeffery
2020-04-06 22:54 ` Cameron Esfahani via
2020-03-31 14:42 ` Gerd Hoffmann
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=58CE5200-AB75-4014-AA2B-EE6E2F265A43@apple.com \
--to=qemu-devel@nongnu.org \
--cc=dirty@apple.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=rm@fingolfin.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).