]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xhci: Preserve RsvdP bits in ERSTBA register correctly
authorLukas Wunner <lukas@wunner.de>
Fri, 15 Sep 2023 14:31:08 +0000 (17:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:17 +0000 (15:11 +0200)
[ Upstream commit cf97c5e0f7dda2edc15ecd96775fe6c355823784 ]

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 8c1cbec9db1a ("xhci: fix event ring
segment table related masks and variables in header"), but immediately
undone by commit b17a57f89f69 ("xhci: Refactor interrupter code for
initial multi interrupter support.").

Fixes: b17a57f89f69 ("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>
Stable-dep-of: e5fa8db0be3e ("usb: xhci: fix loss of data on Cadence xHC")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci.h

index bb5b8f20368d942c4f662277c1ae8c6b8fc84346..e762b825457539f5151623f2d27431589b64ba78 100644 (file)
@@ -2316,8 +2316,8 @@ xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned int intr_num, gfp_t flags
        writel(erst_size, &ir->ir_set->erst_size);
 
        erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base);
-       erst_base &= ERST_PTR_MASK;
-       erst_base |= (ir->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK);
+       erst_base &= ERST_BASE_RSVDP;
+       erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP;
        xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base);
 
        /* Set the event ring dequeue address of this interrupter */
index 2a01157f6b5b8ff7d4fe6ac9102214028cde3626..9d63f39398d08304ae8de5775927d567a3e494f2 100644 (file)
@@ -514,7 +514,7 @@ struct xhci_intr_reg {
 #define        ERST_SIZE_MASK          (0xffff << 16)
 
 /* erst_base bitmasks */
-#define ERST_BASE_RSVDP                (0x3f)
+#define ERST_BASE_RSVDP                (GENMASK_ULL(5, 0))
 
 /* erst_dequeue bitmasks */
 /* Dequeue ERST Segment Index (DESI) - Segment number (or alias)