From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68D2F1D0492; Tue, 15 Oct 2024 11:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993253; cv=none; b=eNjS92aAI4YYqiWH0JQNNk4gtmLHiEVYH7eqim1s+UHcqaNcOSNKp+nIYk+NAQ3uz+A09l4wd99XSTpOYtT8zIpZCtm9AB/WMyWyAQboABiC1I5iO4t0FX/nHqFeaAY614onuzSo5EsjTMGhPqc9H9eW/voQvQzUZ7tfN0lrUnw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993253; c=relaxed/simple; bh=EHsDV5PC95b+F33QTXFkok4Kn6s8X+dY5ZgF0MvhHYA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gWSaV7gQP8q5LeckTZDfrcOj9zXWkV5Z4hbQLZava9HAr+vfv147Nm17VCp1y4Vv2rHKEa30/H7IArpiyuuBLgt+hM0nRA4nEfopNKtZlurjzS/HJO62TtfdDZ0WuqirddNBpKyfB21Fu3oCiKV4HFD9GPbMtzoE5/K2YaGrYjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dMA0mrR9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dMA0mrR9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB82CC4CEC6; Tue, 15 Oct 2024 11:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728993253; bh=EHsDV5PC95b+F33QTXFkok4Kn6s8X+dY5ZgF0MvhHYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMA0mrR9uN/DgqG3tBXORsRoxwdtJzC0Sp0rgMUdar4tRjqAhchwq3kPQuDkJLbKn j1HIUM/tVbA4n+KHgjtARl3Vo0ELeujzb0vUivjGgx0RX/1lVogmE1T6apjy6gpV6U M2xlpR0qSOiUzdUWvTU//M1yufvDCzytc4IT3I+I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lukas Wunner , Mathias Nyman , Sasha Levin Subject: [PATCH 5.15 357/691] xhci: Preserve RsvdP bits in ERSTBA register correctly Date: Tue, 15 Oct 2024 13:25:05 +0200 Message-ID: <20241015112454.514766066@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lukas Wunner [ 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 Cc: stable@vger.kernel.org # v6.3+ Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20230915143108.1532163-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: e5fa8db0be3e ("usb: xhci: fix loss of data on Cadence xHC") Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mem.c | 4 ++-- drivers/usb/host/xhci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index bb5b8f20368d9..e762b82545753 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -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 */ diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2a01157f6b5b8..9d63f39398d08 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -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) -- 2.43.0