Skip to content

Commit cf97c5e

Browse files
l1kgregkh
authored andcommitted
xhci: Preserve RsvdP bits in ERSTBA register correctly
xhci_add_interrupter() erroneously preserves only the lowest 4 bits when writing the ERSTBA register, not the lowest 6 bits. Fix it. Migrate the ERST_BASE_RSVDP macro to the modern GENMASK_ULL() syntax to avoid a u64 cast. This was previously fixed by commit 8c1cbec ("xhci: fix event ring segment table related masks and variables in header"), but immediately undone by commit b17a57f ("xhci: Refactor interrupter code for initial multi interrupter support."). Fixes: b17a57f ("xhci: Refactor interrupter code for initial multi interrupter support.") Signed-off-by: Lukas Wunner <lukas@wunner.de> Cc: stable@vger.kernel.org # v6.3+ Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20230915143108.1532163-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 15f3ef0 commit cf97c5e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,8 +2285,8 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
22852285
writel(erst_size, &ir->ir_set->erst_size);
22862286

22872287
erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base);
2288-
erst_base &= ERST_PTR_MASK;
2289-
erst_base |= (ir->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK);
2288+
erst_base &= ERST_BASE_RSVDP;
2289+
erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP;
22902290
xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base);
22912291

22922292
/* Set the event ring dequeue address of this interrupter */

drivers/usb/host/xhci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ struct xhci_intr_reg {
514514
#define ERST_SIZE_MASK (0xffff << 16)
515515

516516
/* erst_base bitmasks */
517-
#define ERST_BASE_RSVDP (0x3f)
517+
#define ERST_BASE_RSVDP (GENMASK_ULL(5, 0))
518518

519519
/* erst_dequeue bitmasks */
520520
/* Dequeue ERST Segment Index (DESI) - Segment number (or alias)

0 commit comments

Comments
 (0)