* [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts
@ 2026-11-23 7:23 Kuangyi Chiang
2026-11-23 7:30 ` sashiko-bot
2026-11-23 11:23 ` Michal Pecio
0 siblings, 2 replies; 3+ messages in thread
From: Kuangyi Chiang @ 2026-11-23 7:23 UTC (permalink / raw)
To: mathias.nyman, gregkh; +Cc: linux-usb, linux-kernel, ki.chiang65
On Etron xHCs, a USB2 remote wakeup may also move other suspended
USB2 ports into the resume state without generating individual Port
Status Change Events.
The issue can be reproduced as follows:
1. Connect a USB2 hub to each downstream port of the Etron xHC.
2. Wait for all hubs, including the root hub, to autosuspend.
3. Connect a USB device, such as a mouse, to each USB2 hub in turn.
4. The last connected mouse does not work.
The affected USB2 ports may remain in the resume state, preventing
newly connected devices from enumerating. Reconnecting an affected
hub or mouse does not help. Reloading the xHCI driver restores
normal operation.
When handling a USB2 resume event on an Etron xHC, check the other
USB2 ports for the resume state and track them so the normal resume
handling can complete.
Before the patch, the root hub status bitmap reported only port 2
(evt 0004), leaving port 3 in the resume state.
[ 4621.396100] xhci_hcd 0000:01:00.0: Port change event, 3-2, id 2, portsc: 0x400fe3
[ 4621.396158] xhci_hcd 0000:01:00.0: port resume event for port 2
[ 4621.396164] xhci_hcd 0000:01:00.0: resume HS port 2
[ 4621.437164] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 0004
[ 4621.569169] usb usb3-port2: resume, status 0
After the patch, the bitmap includes both ports (evt 000c), allowing
port 3 to complete resume through the normal resume handling.
[ 4824.829350] xhci_hcd 0000:01:00.0: Port change event, 3-2, id 2, portsc: 0x400fe3
[ 4824.829425] xhci_hcd 0000:01:00.0: port resume event for port 2
[ 4824.829431] xhci_hcd 0000:01:00.0: resume HS port 2
[ 4824.829439] xhci_hcd 0000:01:00.0: HS port 3 in resume without event, portsc: 0xfe3
[ 4824.870180] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 000c
[ 4825.001183] usb usb3-port2: resume, status 0
[ 4825.027484] usb usb3-port3: resume, status 0
Tested on Etron EJ168 (1b6f:7023) and EJ188 (1b6f:7052).
Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
---
drivers/usb/host/xhci-ring.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index fffd901..c640952 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1997,6 +1997,39 @@ static void xhci_cavium_reset_phy_quirk(struct xhci_hcd *xhci)
} while (!(pll_lock_check & 0x1) && --retry_count);
}
+/*
+ * Etron xHCs may resume other suspended USB2 ports without generating
+ * individual Port Status Change Events. Track those ports so the normal
+ * USB2 resume handling can finish.
+ */
+static void xhci_handle_etron_usb2_resume(struct xhci_hcd *xhci)
+{
+ struct xhci_hub *rhub = &xhci->usb2_rhub;
+ struct xhci_bus_state *bus_state = &rhub->bus_state;
+ struct xhci_port *port;
+ unsigned int i;
+ u32 portsc;
+
+ for (i = 0; i < rhub->num_ports; i++) {
+ if (test_bit(i, &bus_state->resuming_ports))
+ continue;
+
+ port = rhub->ports[i];
+ portsc = xhci_portsc_readl(port);
+ if ((portsc & PORT_RESET) || !(portsc & PORT_PE))
+ continue;
+
+ if ((portsc & PORT_PLS_MASK) == XDEV_RESUME) {
+ xhci_dbg(xhci, "HS port %d in resume without event, portsc: 0x%x\n",
+ port->hw_portnum + 1, portsc);
+ port->resume_timestamp = jiffies +
+ msecs_to_jiffies(USB_RESUME_TIMEOUT);
+ set_bit(i, &bus_state->resuming_ports);
+ usb_hcd_start_port_resume(&rhub->hcd->self, i);
+ }
+ }
+}
+
static void handle_port_status(struct xhci_hcd *xhci, union xhci_trb *event)
{
struct xhci_virt_device *vdev = NULL;
@@ -2103,6 +2136,8 @@ static void handle_port_status(struct xhci_hcd *xhci, union xhci_trb *event)
mod_timer(&hcd->rh_timer,
port->resume_timestamp);
usb_hcd_start_port_resume(&hcd->self, hcd_portnum);
+ if (xhci->quirks & XHCI_ETRON_HOST)
+ xhci_handle_etron_usb2_resume(xhci);
bogus_port_status = true;
}
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts
2026-11-23 7:23 [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts Kuangyi Chiang
@ 2026-11-23 7:30 ` sashiko-bot
2026-11-23 11:23 ` Michal Pecio
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-23 7:30 UTC (permalink / raw)
To: Kuangyi Chiang; +Cc: linux-usb
> On Etron xHCs, a USB2 remote wakeup may also move other suspended
> USB2 ports into the resume state without generating individual Port
> Status Change Events.
>
> The issue can be reproduced as follows:
>
> 1. Connect a USB2 hub to each downstream port of the Etron xHC.
> 2. Wait for all hubs, including the root hub, to autosuspend.
> 3. Connect a USB device, such as a mouse, to each USB2 hub in turn.
> 4. The last connected mouse does not work.
>
> The affected USB2 ports may remain in the resume state, preventing
> newly connected devices from enumerating. Reconnecting an affected
> hub or mouse does not help. Reloading the xHCI driver restores
> normal operation.
> [ ... ]
> [ 4825.027484] usb usb3-port3: resume, status 0
>
> Tested on Etron EJ168 (1b6f:7023) and EJ188 (1b6f:7052).
>
> Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123072320.5967-1-ki.chiang65@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts
2026-11-23 7:23 [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts Kuangyi Chiang
2026-11-23 7:30 ` sashiko-bot
@ 2026-11-23 11:23 ` Michal Pecio
1 sibling, 0 replies; 3+ messages in thread
From: Michal Pecio @ 2026-11-23 11:23 UTC (permalink / raw)
To: Kuangyi Chiang; +Cc: mathias.nyman, gregkh, linux-usb, linux-kernel
On Mon, 23 Nov 2026 15:23:20 +0800, Kuangyi Chiang wrote:
> On Etron xHCs, a USB2 remote wakeup may also move other suspended
> USB2 ports into the resume state without generating individual Port
> Status Change Events.
>
> The issue can be reproduced as follows:
>
> 1. Connect a USB2 hub to each downstream port of the Etron xHC.
> 2. Wait for all hubs, including the root hub, to autosuspend.
> 3. Connect a USB device, such as a mouse, to each USB2 hub in turn.
> 4. The last connected mouse does not work.
>
> The affected USB2 ports may remain in the resume state, preventing
> newly connected devices from enumerating. Reconnecting an affected
> hub or mouse does not help. Reloading the xHCI driver restores
> normal operation.
>
> When handling a USB2 resume event on an Etron xHC, check the other
> USB2 ports for the resume state and track them so the normal resume
> handling can complete.
>
> Before the patch, the root hub status bitmap reported only port 2
> (evt 0004), leaving port 3 in the resume state.
>
> [ 4621.396100] xhci_hcd 0000:01:00.0: Port change event, 3-2, id 2, portsc: 0x400fe3
> [ 4621.396158] xhci_hcd 0000:01:00.0: port resume event for port 2
> [ 4621.396164] xhci_hcd 0000:01:00.0: resume HS port 2
> [ 4621.437164] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 0004
> [ 4621.569169] usb usb3-port2: resume, status 0
>
> After the patch, the bitmap includes both ports (evt 000c), allowing
> port 3 to complete resume through the normal resume handling.
>
> [ 4824.829350] xhci_hcd 0000:01:00.0: Port change event, 3-2, id 2, portsc: 0x400fe3
> [ 4824.829425] xhci_hcd 0000:01:00.0: port resume event for port 2
> [ 4824.829431] xhci_hcd 0000:01:00.0: resume HS port 2
> [ 4824.829439] xhci_hcd 0000:01:00.0: HS port 3 in resume without event, portsc: 0xfe3
> [ 4824.870180] hub 3-0:1.0: state 7 ports 4 chg 0000 evt 000c
> [ 4825.001183] usb usb3-port2: resume, status 0
> [ 4825.027484] usb usb3-port3: resume, status 0
>
> Tested on Etron EJ168 (1b6f:7023) and EJ188 (1b6f:7052).
>
> Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
Hi,
This repro doesn't seem to work for me.
Etron Technology, Inc. EJ168 USB 3.0 Host Controller [1b6f:7023] (rev 01)
/: Bus 008.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 480M
|__ Port 001: Dev 040, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 002: Dev 034, If 0, Class=Hub, Driver=hub/4p, 480M
# connecting a mouse to hub 2 resumes the bus:
[ 8316.191894] xhci_hcd 0000:07:00.0: Port change event, 8-2, id 2, portsc: 0xc400fe3
[ 8316.191911] xhci_hcd 0000:07:00.0: resume root hub
[ 8316.191930] xhci_hcd 0000:07:00.0: port resume event for port 2
[ 8316.191936] xhci_hcd 0000:07:00.0: resume HS port 2
[ 8316.191992] usb usb8: usb wakeup-resume
[ 8316.192001] usb usb8: usb auto-resume
[ 8316.192015] hub 8-0:1.0: hub_resume
# core polls both RH ports for status, both are resuming:
[ 8316.192030] xhci_hcd 0000:07:00.0: Get port status 8-1 read: 0xfe3, return 0x507
[ 8316.192059] usb usb8-port1: status 0507 change 0000
[ 8316.192069] xhci_hcd 0000:07:00.0: Get port status 8-2 read: 0xfe3, return 0x507
[ 8316.192079] usb usb8-port2: status 0507 change 0000
[ 8316.192094] hub 8-0:1.0: state 7 ports 2 chg 0000 evt 0000
[ 8316.232936] hub 8-0:1.0: state 7 ports 2 chg 0000 evt 0006
# hub 1 is resumend, inspected and suspended again
[ 8316.232961] xhci_hcd 0000:07:00.0: resume USB2 port 8-1
[ 8316.232970] xhci_hcd 0000:07:00.0: Set port 8-1 link state, portsc: 0xfe3, write 0x10e01
[ 8316.233017] xhci_hcd 0000:07:00.0: Port change event, 8-1, id 1, portsc: 0x400e03
[ 8316.233041] xhci_hcd 0000:07:00.0: Get port status 8-1 read: 0xfe3, return 0x40503
[ 8316.233061] xhci_hcd 0000:07:00.0: clear port1 suspend/resume change, portsc: 0xe03
[ 8316.244881] usb 8-1: usb wakeup-resume
[ 8316.244921] xhci_hcd 0000:07:00.0: Get port status 8-1 read: 0xe03, return 0x503
[ 8316.256001] usb 8-1: Waited 0ms for CONNECT
[ 8316.256014] usb 8-1: finish resume
[ 8316.256917] hub 8-1:1.0: hub_resume
[ 8316.259088] usb usb8-port1: resume, status 0
[ 8316.259122] xhci_hcd 0000:07:00.0: resume USB2 port 8-2
[ 8316.259131] xhci_hcd 0000:07:00.0: Set port 8-2 link state, portsc: 0xfe3, write 0x10e01
[ 8316.259158] hub 8-1:1.0: state 7 ports 4 chg 0000 evt 0000
[ 8316.259345] xhci_hcd 0000:07:00.0: Port change event, 8-2, id 2, portsc: 0x400e03
[ 8316.259410] xhci_hcd 0000:07:00.0: Get port status 8-2 read: 0xfe3, return 0x40503
[ 8316.259552] xhci_hcd 0000:07:00.0: clear port2 suspend/resume change, portsc: 0xe03
[ 8316.261302] hub 8-1:1.0: hub_suspend
[ 8316.262137] xhci_hcd 0000:07:00.0: Set port 8-1 link state, portsc: 0xe03, write 0x10e61
# hub 2 is resumend, inspected and the device enabled
[ 8316.270925] usb 8-2: usb wakeup-resume
[ 8316.270950] xhci_hcd 0000:07:00.0: Get port status 8-2 read: 0xe03, return 0x503
[ 8316.272785] usb 8-1: usb auto-suspend, wakeup 1
[ 8316.282855] usb 8-2: Waited 0ms for CONNECT
[ 8316.282867] usb 8-2: finish resume
[ 8316.283835] hub 8-2:1.0: hub_resume
[ 8316.284504] usb 8-2-port1: status 0301 change 0001
[ 8316.391951] usb usb8-port2: resume, status 0
[ 8316.391985] hub 8-2:1.0: state 7 ports 4 chg 0002 evt 0000
[ 8316.392650] usb 8-2-port1: status 0301, change 0000, 1.5 Mb/s
[ 8316.393099] usb 8-2-port1: indicator auto status 0
[ 8316.447829] xhci_hcd 0000:07:00.0: xhci_hub_status_data: stopping usb8 port polling
[ 8316.457913] usb 8-2.1: new low-speed USB device number 46 using xhci_hcd
# (not shown): hub 1 works normally, including wake on connection
Regards,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-23 11:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 7:23 [PATCH RESEND] xhci: Handle missing USB2 resume events on Etron hosts Kuangyi Chiang
2026-11-23 7:30 ` sashiko-bot
2026-11-23 11:23 ` Michal Pecio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox