Re: XHCI without USB2 ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux