public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Jan Henrik Weinstock <jan@mwa.re>,
	mathias.nyman@intel.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Lukas Jünger" <lukas@mwa.re>
Subject: Re: XHCI without USB2 ports
Date: Tue, 13 Feb 2024 11:59:51 +0200	[thread overview]
Message-ID: <1b2558f7-94ea-123e-dd3f-b43ecd85c2ef@linux.intel.com> (raw)
In-Reply-To: <CANi1PHh4W7KPagKkvZW6cNAQqgAeG3zxaaTJKkg3KiTbsFRMdg@mail.gmail.com>

On 12.2.2024 20.39, Jan Henrik Weinstock wrote:
> Hi all,
> 
> I am currently working on an XHCI platform device simulation model. I
> noticed that the Linux driver (Linux 6.5.6 xhci-hcd) stops working
> when I configure the model without any USB2 ports. During an interrupt
> (TRB_PORT_STATUS), I only get "xhci-hcd 12100000.usb: ignore port
> event for removed USB3 hcd."
> 
> During xhci_irq, in handle_port_status, xhci->shared_hcd is NULL [1],
> so the interrupt gets ignored. However, shared_hcd would only ever be
> allocated during xhci_plat_probe [2], if the device has both USB2 and
> USB3 ports, i.e. xhci_has_one_roothub returns false [3].
> 
> Without any USB2 ports, a shared_hcd will never be allocated in the
> first place, and handle_port_status will always exit early.

This is true.
That port handling code is from a time before xhci driver supported single
roothub setups.

I think all single roothub cases so far have been xHC hosts with only USB2
ports. This is probably the first one with only USB3 ports.

I have a vague memory that USB3 specification would require USB3 ports to
be backwards compatible, and support USB2.

But xhci driver could still support it, does this change help:

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index f0d8a607ff21..6ef081f5ef05 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1893,7 +1893,8 @@ static void handle_port_status(struct xhci_hcd *xhci,
         }
  
         /* We might get interrupts after shared_hcd is removed */
-       if (port->rhub == &xhci->usb3_rhub && xhci->shared_hcd == NULL) {
+       if (!xhci_has_one_roothub(xhci) && xhci->shared_hcd == NULL &&
+           port->rhub == &xhci->usb3_rhub) {
                 xhci_dbg(xhci, "ignore port event for removed USB3 hcd\n");
                 bogus_port_status = true;
                 goto cleanup;

Thanks
Mathias


  reply	other threads:[~2024-02-13  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 18:39 XHCI without USB2 ports Jan Henrik Weinstock
2024-02-13  9:59 ` Mathias Nyman [this message]
2024-02-13 14:50   ` Jan Henrik Weinstock
2024-02-13 15:42     ` Mathias Nyman

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=1b2558f7-94ea-123e-dd3f-b43ecd85c2ef@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jan@mwa.re \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@mwa.re \
    --cc=mathias.nyman@intel.com \
    /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