Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: xhci: Simplify clearing the Event Interrupt bit

USBSTS is mostly RW1C, so to clear EINT we should write just this
one bit. Remove pointless code which ORs the bit with current value
of the register, even though the bit is already known to be set,
and writes the result back, which clears all active RW1C flags.

We used to inadvertently clear PCD and SRE in this way. PCD isn't
used by the driver and SRE is only used at resume, so clearing them
should make no difference. Don't clear them anymore.

Tested by connecting and mounting a storage device on a few HCs.

Before: xhci_irq USBSTS 0x00000018 EINT PCD -> 0x00000000
xhci_irq USBSTS 0x00000008 EINT -> 0x00000000
After: xhci_irq USBSTS 0x00000018 EINT PCD -> 0x00000010 PCD
xhci_irq USBSTS 0x00000018 EINT PCD -> 0x00000010 PCD

Some flags are RsvdZ - should be written as zero regardless of the
value read, so technically it was a bug. But no problems are known.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260402131342.2628648-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michal Pecio and committed by
Greg Kroah-Hartman
88a985cf abe93f27

+2 -3
+2 -3
drivers/usb/host/xhci-ring.c
··· 3208 3208 /* 3209 3209 * Clear the op reg interrupt status first, 3210 3210 * so we can receive interrupts from other MSI-X interrupters. 3211 - * Write 1 to clear the interrupt status. 3211 + * USBSTS bits are write 1 to clear. 3212 3212 */ 3213 - status |= STS_EINT; 3214 - writel(status, &xhci->op_regs->status); 3213 + writel(STS_EINT, &xhci->op_regs->status); 3215 3214 3216 3215 /* This is the handler of the primary interrupter */ 3217 3216 xhci_handle_events(xhci, xhci->interrupters[0], false);