Re: [PATCH] usb: xhci: fix maximum event ring segments calculation
From: Pierre-David Belanger
Date: Sat Aug 29 2026 - 23:15:11 EST
I ran into this independently on x86_64 under QEMU and had a regression
report half written when I found your patch. Same one line, same reasoning.
Confirmed against vanilla mainline 08dbfad3f504, with v7.2 built from the same
config for comparison:
v7.2 (8d3ae59288f1) USB keyboard enumerates
08dbfad3f504 xhci_hcd does not probe
08dbfad3f504 + this patch USB keyboard enumerates again
The failure on 08dbfad3f504:
xhci_hcd 0000:00:04.0: xHCI Host Controller
xhci_hcd 0000:00:04.0: new USB bus registered, assigned bus number 1
xhci_hcd 0000:00:04.0: Failed to allocate interrupter erst
xhci_hcd 0000:00:04.0: can't setup: -12
xhci_hcd 0000:00:04.0: USB bus 1 deregistered
xhci_hcd 0000:00:04.0: init 0000:00:04.0 fail, -12
xhci_hcd 0000:00:04.0: probe with driver xhci_hcd failed with error -12
Reproduced with:
qemu-system-x86_64 -enable-kvm -m 512 -display none -serial stdio \
-kernel bzImage -initrd initrd \
-device qemu-xhci -device usb-kbd
Both -device qemu-xhci and -device nec-usb-xhci are affected. Reading
HCSPARAMS2 from inside the guest gives 0x0000000f, so ERST Max really is 0
and max_segs comes out as 0 with the current code.
I did not see the page allocator WARNING you hit (my .config is a minimal
tinyconfig-derived one), but the probe failure and the -12 are identical,
and this patch fixes it.
Tested-by: Pierre-David Belanger <pierredavidbelanger@xxxxxxxxx>
Thanks for the quick fix.
Pierre-David