]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
usb: xhci: improve TR Dequeue Pointer mask
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Wed, 17 Sep 2025 21:07:23 +0000 (00:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Sep 2025 07:53:11 +0000 (09:53 +0200)
commit931e468764b22a587febf562e57249e95e84350d
tree88392acfbdb86b75a38bc0329333cf0ae629ab59
parent719de070f764e079cdcb4ddeeb5b19b3ddddf9c1
usb: xhci: improve TR Dequeue Pointer mask

Address the naming and usage of the TR Dequeue Pointer mask in the xhci
driver. The Endpoint Context Field at offset 0x08 is defined as follows:
 Bit 0 Dequeue Cycle State (DCS)
 Bits 3:1 RsvdZ (Reserved and Zero)
 Bits 63:4 TR Dequeue Pointer

When extracting the TR Dequeue Pointer for an Endpoint without Streams,
in xhci_handle_cmd_set_deq(), the inverted Dequeue Cycle State mask
(~EP_CTX_CYCLE_MASK) is used, inadvertently including the Reserved bits.
Although bits 3:1 are typically zero, using the incorrect mask could cause
issues.

The existing mask, named "SCTX_DEQ_MASK," is misleading because "SCTX"
implies exclusivity to Stream Contexts, whereas the TR Dequeue Pointer is
applicable to both Stream and non-Stream Contexts.

Rename the mask to "TR_DEQ_PTR_MASK", utilize GENMASK_ULL() macro and use
the mask when handling the TR Dequeue Pointer field.

Function xhci_get_hw_deq() returns the Endpoint Context Field 0x08, either
directly from the Endpoint context or a Stream.

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/20250917210726.97100-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.h