From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Cameron Esfahani <dirty@apple.com>, qemu-devel@nongnu.org
Cc: Robert Mustacchi <rm@fingolfin.org>,
Paolo Bonzini <pbonzini@redhat.com>,
kraxel@redhat.com, Paul Menzel <pmenzel@molgen.mpg.de>
Subject: Re: [PATCH v1] usb: Add read support for HCIVERSION register to XHCI
Date: Tue, 31 Mar 2020 09:52:00 +0200 [thread overview]
Message-ID: <71ec6105-b2f7-4805-c235-645c25a0b201@redhat.com> (raw)
In-Reply-To: <20200330214444.43494-1-dirty@apple.com>
On 3/30/20 11:44 PM, Cameron Esfahani via wrote:
> macOS will read HCIVERSION separate from CAPLENGTH. Add a distinct
> handler for that register.
Apparently a fix for https://bugs.launchpad.net/qemu/+bug/1693050.
>
> Signed-off-by: Cameron Esfahani <dirty@apple.com>
> ---
> hw/usb/hcd-xhci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index b330e36fe6..061f8438de 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -2739,6 +2739,9 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size)
> case 0x00: /* HCIVERSION, CAPLENGTH */
> ret = 0x01000000 | LEN_CAP;
> break;
> + case 0x02: /* HCIVERSION */
> + ret = 0x0100;
> + break;
But we have:
static const MemoryRegionOps xhci_cap_ops = {
.read = xhci_cap_read,
.write = xhci_cap_write,
.valid.min_access_size = 1,
.valid.max_access_size = 4,
.impl.min_access_size = 4,
.impl.max_access_size = 4,
.endianness = DEVICE_LITTLE_ENDIAN,
};
IIUC ".impl.min_access_size = 4" means the case 'reg == 2' can not
happen. It seems we have a bug in memory.c elsewhere.
How can we reproduce?
If not easy, can you share the backtrace of:
-- >8 --
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index b330e36fe6..d021129f3f 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2735,6 +2735,7 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr
reg, unsigned size)
XHCIState *xhci = ptr;
uint32_t ret;
+ assert(reg != 2);
switch (reg) {
case 0x00: /* HCIVERSION, CAPLENGTH */
ret = 0x01000000 | LEN_CAP;
---
> case 0x04: /* HCSPARAMS 1 */
> ret = ((xhci->numports_2+xhci->numports_3)<<24)
> | (xhci->numintrs<<8) | xhci->numslots;
>
next prev parent reply other threads:[~2020-03-31 7:52 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é [this message]
2020-03-31 9:57 ` Cameron Esfahani via
2020-03-31 10:24 ` Cameron Esfahani via
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=71ec6105-b2f7-4805-c235-645c25a0b201@redhat.com \
--to=philmd@redhat.com \
--cc=dirty@apple.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=qemu-devel@nongnu.org \
--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).