XHCI without USB2 ports

Jan Henrik Weinstock
2024-02-12T18:39:21Z

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.

I am new to the USB driver framework, so it's quite likely I am just
overlooking something; but to me it seems that the driver cannot work
unless I have an XHCI device that has at least one USB2 and one USB3
port. But during boot, I only get "USB2 root hub has no ports", which
is not fatal.

Best regards
Jan

[1] https://elixir.bootlin.com/linux/v6.5.6/source/drivers/usb/host/xhci-ring.c#L1895
[2] https://elixir.bootlin.com/linux/v6.5.6/source/drivers/usb/host/xhci-plat.c#L282
[3] https://elixir.bootlin.com/linux/v6.5.6/source/drivers/usb/host/xhci.h#L2001

--
Dr.-Ing. Jan Henrik Weinstock
Managing Director

MachineWare GmbH | www.machineware.de
Hühnermarkt 19, 52062 Aachen, Germany
Amtsgericht Aachen HRB25734

Geschäftsführung
Lukas Jünger
Dr.-Ing. Jan Henrik Weinstock