Synopsis: USB keyboard dies after Supermicro BMC reset; xhci(4)
endpoint halted
Category: kernel
Environment:
System : OpenBSD 8.0
Details : OpenBSD 8.0-beta (GENERIC.MP) #108: Sat Aug 22 22:10:43
MDT 2026
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Architecture: OpenBSD.amd64
Machine : amd64
Description:
On a Supermicro X11SSL-F the USB keyboard and mouse emulated by
the on-board ASPEED AST2400 BMC stop responding after the BMC is
reset, and stay dead until the host is rebooted. wskbd(4) and
wsmouse(4) receive no further events. A GENERIC kernel prints
nothing at all when this happens.
The same behaviour is present on every release tried, 7.4 through
-current, and on a Supermicro X10SLL-F as well. A physical USB
keyboard on the same xhci0 keeps working; only the BMC-emulated
HID is affected.
The controller is:
xhci0 at pci0 dev 20 function 0 "Intel 100 Series xHCI"
rev 0x31: msi, xHCI 1.0
and the emulated HID normally attaches behind the BMC's own hub:
uhub1 at uhub0 port 9 "ATEN International product 0x7000"
uhidev2 at uhub1 port 1 "ATEN International product 0x2419"
ukbd1 at uhidev2, wskbd2 at ukbd1
uhidev3 at uhub1 port 1, ums1 at uhidev3
With a kernel built with "option XHCI_DEBUG" the only diagnostic
is the HID's interrupt IN endpoint completing with a USB
Transaction Error:
xhci0: txerr? code 4
Per xHCI r1.1 section 4.10.2.6 a USB Transaction Error completion
leaves the endpoint in the Halted state. The endpoint context
stays Halted in hardware until a Reset Endpoint command is
issued: further doorbell rings are ignored and no transfer event
is ever posted again.
xhci_event_xfer_generic() in sys/dev/usb/xhci.c never issues that
command. At $OpenBSD: xhci.c,v 1.136 2025/03/01 14:43:03 kirill
Exp $:
case XHCI_CODE_TXERR:
case XHCI_CODE_SPLITERR:
DPRINTF(("%s: txerr? code %d\n", DEVNAME(sc), code));
xfer->status = USBD_IOERROR;
break;
After the switch the function only does "return (0)", so the
caller xhci_event_xfer() goes on to call xhci_xfer_done(xfer) and
usb_transfer_complete(). The transfer is completed with
USBD_IOERROR, but no Reset Endpoint command is sent and
xp->halted is never set. From that point the pipe is dead: the
stack keeps queueing transfers onto an endpoint the controller
will not run, and each one is dropped with no indication.
One further observation, which is why resetting the endpoint
alone is not sufficient on this hardware: after the BMC reset the
device does not come back in the same topology. Instead of the
low-speed HID behind the ATEN hub it attaches directly to uhub0
at high speed, and that transient device's interrupt IN endpoint
keeps failing for several seconds. With a change that only
resets the endpoint, the softintr path never converges:
xhci0: txerr? code 4
xhci0: xhci_cmd_reset_ep_async dev 4 dci 3
xhci0: xhci_cmd_set_tr_deq_async dev 4 dci 3
... forever ...
Only tearing the port down and re-enumerating it recovers the
device.
How-To-Repeat:
1. Boot an amd64 GENERIC.MP snapshot on a Supermicro X11SSL-F
(or X10SLL-F) with the BMC iKVM keyboard and mouse enabled.
(I beleive that other Supermicro models are affected as
well)
2. Confirm the emulated HID attached, and that ukbd(4)/wskbd(4)
and ums(4)/wsmouse(4) claimed it:
# usbdevs -v
3. Type on the iKVM keyboard at the console. Keystrokes arrive.
4. Reset the BMC - use the Reset button in the BMC web interface.
5. Wait for the BMC to come back and for the HID to re-attach.
6. Type on the iKVM keyboard again. No keystrokes arrive, the
emulated mouse is dead as well, and nothing is printed on the
console.
7. Reboot the host. The keyboard works again. A BMC-emulated
device cannot be unplugged, so this is the only recovery.
8. To see the completion code, rebuild the kernel with
"option XHCI_DEBUG" and repeat steps 3 to 6. The endpoint
reports "xhci0: txerr? code 4" and no transfer on that pipe
ever completes afterwards.
Fix:
The diff below counts consecutive USB Transaction Errors per pipe
and lets the TXERR/SPLITERR case fall through into the existing
STALL/BABBLE recovery, so the halted endpoint is always reset.
Past XHCI_TXERR_RETRIES it additionally calls
usb_needs_reattach(), so the hub explore task re-enumerates the
device instead of the pipe retrying forever. Because
code != XHCI_CODE_STALL on the fallthrough it lands on
xp->halted = USBD_IOERROR, and it inherits the timeout_del(),
usb_rem_task(), xp->aborted_xfer assignment and the completion
chain unchanged.