Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795036871; b=y7TAEnNTguHliFL+6cf+oOsPRZ11AkB40dABQ0f0FUalq9RKBS1sqd+uBJFqCd1TgMk8 lrFGxijAmEXYnaxiwh+HW0n04j5cMLADf6W6J3oRLG+GCn7zEjvRXKuhdvW6kbhyiSn4u cNTEQi49GOuU7YQDesXOFHaImyJVfuEUvs3ljqB5Mk5NK+KoPzpWW7x0IlZvfT43DUCsT VXTrswM0iwvtQzaNk17CZdY/mQ7LVX2DZx0TF66YY6wKenK85+ojE4KecNL1A0eFZ0joj btqXSk/Jl/VowEPr992UgtFphkuSmUG7Jf6U7E6Q+yRwdLMLb28/a3wwhVZh2SDrALA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795036871; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=ieU2rldLlHq3+vJcVSwF0Q9XsztZwluu+TEwxKAIXPI=; b=RuUQHhocFsedhB7qJ+ZA9vO5PBYps/XU4mTtKOWzbGcG0sRegRrRzMgJgHdMMOV6zWKk HUqBlKPBCid/+zFLddk0C+IAAuDN3BvQj+V2jyJx4R3hBsGOOJXrjtxHU2/cq/tHiC5RP dJLragDwbG/hSrd8OgzXvtjB5d+vYlTyetBA4TrFXpMr7k3MxfCNtFf6xmsUMksZx7Oj1 W7BtU9E6T/DgQM12LOcr8Pjss/KHmitXwV+pnvWps2v4HshQB4GQ9dWo3EK9+IDPYF9ZM coJrkvwy8GeAua13Kl4wjfArXf106gEPBFNDXSJmbvUWacKDLmm6o5MC9z38twz6pqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j6lepo3q; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 349F9606A31C; Wed, 18 Nov 2026 21:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j6lepo3q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90DEF1F000C4; Wed, 18 Nov 2026 21:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795036871; bh=ieU2rldLlHq3+vJcVSwF0Q9XsztZwluu+TEwxKAIXPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j6lepo3q8KQ/aIBmniN8A9BWeUGcbBaXKghVWHo/qyeKKfLiqxzcXq9UwQXZNKDcl U9Qswxc+HJjOavNoBKxcPzAl7Ir8TfTkSPbxmrZJU+ziNzEJFJJjjFSWq4sg1P9Qzm 9cW6fJzGKn0xJUscF78o6cjIKp9WDHqxk2jh+A3I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bean Huo , Stanley Jhu , Peter Wang , Bart Van Assche , "Martin K. Petersen (Oracle)" , Sasha Levin Subject: [PATCH 6.6 1214/3318] scsi: ufs: core: Clear stale UIC result byte before peer DME retries Date: Wed, 18 Nov 2026 15:30:36 +0100 Message-ID: <20261118150356.595007580@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stanley Jhu [ Upstream commit e4a9b7640914b248eb7537d4507aa42db080586a ] Peer DME get and set retry a failed attempt with the same struct uic_command. UIC completion ORs the ConfigResultCode into argument2[7:0], and nothing clears it before the next attempt. Once an attempt fails, every retry keeps reporting that error code, even when the device returns success, so a transient failure becomes a hard failure after three retries. Each such retry also triggers the WARN_ON_ONCE() in ufshcd_dispatch_uic_cmd(). In ufshcd_dme_set_attr(), ufshcd_uic_cmd_compl() also overwrites argument3 with the register readback before the next attempt. Clear the result byte and restore argument3 in ufshcd_dme_set_attr() when an attempt fails. Fixes: 64238fbd15ea ("scsi: ufs: add retries to dme_peer get and set attribute") Cc: stable@vger.kernel.org Reviewed-by: Bean Huo Signed-off-by: Stanley Jhu Reviewed-by: Peter Wang Reviewed-by: Bart Van Assche Link: https://patch.msgid.link/20261015001855.3450573-6-stanleyjhu@google.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Sasha Levin --- drivers/ufs/core/ufshcd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 55de8d4a5eef1..24e010c7d12c3 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4116,9 +4116,12 @@ int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel, do { /* for peer attributes we retry upon failure */ ret = ufshcd_send_uic_cmd(hba, &uic_cmd); - if (ret) + if (ret) { dev_dbg(hba->dev, "%s: attr-id 0x%x val 0x%x error code %d\n", set, UIC_GET_ATTR_ID(attr_sel), mib_val, ret); + uic_cmd.argument2 &= ~MASK_UIC_COMMAND_RESULT; + uic_cmd.argument3 = mib_val; + } } while (ret && peer && --retries); if (ret) @@ -4183,9 +4186,11 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel, do { /* for peer attributes we retry upon failure */ ret = ufshcd_send_uic_cmd(hba, &uic_cmd); - if (ret) + if (ret) { dev_dbg(hba->dev, "%s: attr-id 0x%x error code %d\n", get, UIC_GET_ATTR_ID(attr_sel), ret); + uic_cmd.argument2 &= ~MASK_UIC_COMMAND_RESULT; + } } while (ret && peer && --retries); if (ret) -- 2.53.0