From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7B362394470; Sat, 17 Oct 2026 17:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257589; cv=none; b=E0eoIUK4ReTVC3ES08szxT23rMAk32WRheVwPkY+ok5azfeZ0rUlPr8bS5qmhNzjNsMw5jRe/T3Vr/6Pl2PS4l1g8RJxqTlnGzCcCOGI+YufksSfXzqSbE7M04LmNJclkXYHSPM9oRnnvd3SW8Tbji43SMt1EVMAZf+wcZgfhEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792257589; c=relaxed/simple; bh=+lHZsH7jY64M1K3iqfmQjE0rnzeJBoimDD1hRjPHNz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iBuzC9F2TJVeHXvKzW3lEuxu30aQ0SvuJFaRNE27FsxAjb3ly+3pr+3oDa+IxAa3G6rr6fXIuEvrsU7gTBpqzVeXpQMdcZ/T5nne9CNDSgnJA80V8Nd6+jDk5w52+GGFpnPGYf2X2VVlliRDP5X3W3gmUB4SpEanoED5c3oz/38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OrcVaGN8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OrcVaGN8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 833091F000C4; Sat, 17 Oct 2026 17:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792257588; bh=NJvNkF9CjUMR5NWL6fKT1PF/U7prUZ4YO+BJmcYQBgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OrcVaGN8UUOG0erTswqXaDBJq2evNfJYoqzOsy8t4GLMayoUPGxlgkMV8OsGaZ5CC hqE6NZhOp2KIRTCKXpC9A9vmC4Qr/P07j1FjgX9JtbjV9E4G2OHIo5B/CEPOogUggs YxhuZMdF46fZm3/dK3/FceIIpi00CvFn+JQ6mxPY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bart Van Assche , Peter Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.6 0606/1674] scsi: ufs: core: Add a comment block above ufshcd_mcq_compl_all_cqes_lock() Date: Sat, 17 Oct 2026 17:47:58 +0200 Message-ID: <20261017160446.637952344@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche [ Upstream commit 1373df88d53594a32534fd8960c51d1d09be8ecb ] Document the aspects of ufshcd_mcq_compl_all_cqes_lock() that are nontrivial in a comment block above this function. Signed-off-by: Bart Van Assche Reviewed-by: Peter Wang Link: https://patch.msgid.link/20260401202506.1445324-2-bvanassche@acm.org Signed-off-by: Martin K. Petersen Stable-dep-of: 375f3a5691dd ("scsi: ufs: core: Avoid unsafe MMIO reads in ufshcd_mcq_compl_all_cqes_lock()") Signed-off-by: Sasha Levin --- drivers/ufs/core/ufs-mcq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 846d4c3eb3923..121601201fcd2 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -285,6 +285,14 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba, } } +/* + * This function is called from the UFS error handler with the UFS host + * controller disabled (HCE = 0). Reading host controller registers, e.g. the + * CQ tail pointer (CQTPy), may not be safe with the host controller disabled. + * Hence, iterate over all completion queue entries. This won't result in + * double completions because ufshcd_mcq_process_cqe() clears a CQE after it + * has been processed. + */ void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba, struct ufs_hw_queue *hwq) { -- 2.53.0