usb: xhci: rework Event Ring Segment Table Address mask
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Thu, 15 May 2025 13:56:16 +0000 (16:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 May 2025 10:35:33 +0000 (12:35 +0200)
Event Ring Segment Table Base Address Register contain two fields:
 - Bits 5:0: RsvdP (Reserved and Preserved)
 - Bits 63:6: Event Ring Segment Table Base Address

Currently, an inverted RsvdP mask (ERST_BASE_RSVDP) is used to extract
bits 63:6. Replaces the inverted mask with a non-inverted mask,
'ERST_BASE_ADDRESS_MASK', which makes the code easier to read.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250515135621.335595-20-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci.h

index ec2c4851c6892963575d9b003fed502ea9049906..bd745a0f2f782e2a73b121a68836677dead37b3a 100644 (file)
@@ -2338,8 +2338,8 @@ void xhci_add_interrupter(struct xhci_hcd *xhci, unsigned int intr_num)
        writel(erst_size, &ir->ir_set->erst_size);
 
        erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base);
-       erst_base &= ERST_BASE_RSVDP;
-       erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP;
+       erst_base &= ~ERST_BASE_ADDRESS_MASK;
+       erst_base |= ir->erst.erst_dma_addr & ERST_BASE_ADDRESS_MASK;
        if (xhci->quirks & XHCI_WRITE_64_HI_LO)
                hi_lo_writeq(erst_base, &ir->ir_set->erst_base);
        else
index 19dd47d761407296cf2270cca6deb50937a16994..7865e21f0b1f186d8777447ea878ce82800066d0 100644 (file)
@@ -255,7 +255,8 @@ struct xhci_intr_reg {
 #define        ERST_SIZE_MASK          (0xffff)
 
 /* erst_base bitmasks */
-#define ERST_BASE_RSVDP                (GENMASK_ULL(5, 0))
+/* bits 63:6 - Event Ring Segment Table Base Address Register */
+#define ERST_BASE_ADDRESS_MASK GENMASK_ULL(63, 6)
 
 /* erst_dequeue bitmasks */
 /* Dequeue ERST Segment Index (DESI) - Segment number (or alias)