From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 D8DD83009D4 for ; Mon, 20 Jul 2026 09:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784538989; cv=none; b=rYRktKG8/P2mmkWs7t77RMtbP6bAnlOk1xJMHhW6jFuZSN+ytLaDCIasXsBnGQBvWiKh00o9u0JoGGrR1qeq2u2yCyJDzxqkuyyyH01ude6hqFB1YOL52/cRTN4Au3CoROBGbKEbaEEKICkuAKCBNMAaNmJXPtxqSG9zFM3qxDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784538989; c=relaxed/simple; bh=YCH1yylulf8EbgQrB2WZCIRrwVIgjivx9cOy+yUc6pQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GdM7Z/Z6TcSpviDFCryG7UYAT7/x/bqGs8qZ1rU4kSlsWuxrrWf2kfDQXrIXacAO0LP9kVXKzHUCK3yqp9qck03HTPXKpcyGxb5WGRUrNbIPt8ULuECziAJqKxbewDWlpGmJTl4Cmks0gtmeuvX8ekw5K2DiJMpzEl54u5Ra5Xc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=K4kwxY9r; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=cvaWQJFB; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="K4kwxY9r"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="cvaWQJFB" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66K6Rg4d1774817 for ; Mon, 20 Jul 2026 09:16:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=WqcCf+Dhdx6 Y50GJtvfwTO5MqJahdd7ZlfJbqzun1ro=; b=K4kwxY9rK8TnGL3mvm3P3oFNOLC kcHMtlYKiz97ppJ3a+0DgeFKTfBkZIYWAV4iEuHurYoNAJcouz2SGqkpTLALd7qH SWD4rClqcpApXIdokAGHZMNHSkzm0zj169O32vQYjMFnCf8yBOBvJXA0Jnmu8zzY 4ALwwLRlaNj23jkewlWF6cH5hnayyjbL5AMnJI8SM3z74rdbcGd4FCwc1K8bTiJ9 NrWDydTVulWp3ZIBhetPsArnUX5mzpPVpuUQQ6QwYmZQ65OHMzPjE6zInSgdBKFh n/uOPr/K0UI3Yrr/vYv8XpP1SUe/5POlIPnlGnJzeZjqTYPEK373dD7tH4w== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fg2af5eqp-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 09:16:21 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-51a8db414c7so164791361cf.0 for ; Mon, 20 Jul 2026 02:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784538980; x=1785143780; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=WqcCf+Dhdx6Y50GJtvfwTO5MqJahdd7ZlfJbqzun1ro=; b=cvaWQJFBzAwHhpJHv0n5054MiTWanWuO1/43NwTgVTePeTHKHaZO6ULnv0r3LegWVM OFhnXFZCAGRI4F/Dl1R8AVFjsOydKDYhqMfAx39kOhoviwvQoqcFxX5T170adbzPt5Js G1sjXGUBmD3noxi0F2rwsqWsqRDWMwb/orSaMycGBMZWahbOB8nLzZCLV4tsVJAtE3Vg qPWCMQ/CtHonae8qZ5faRC1dd8jCKZW9rE7EI0rotqKAk3h/9BpXsvudG2bvwF6U5h1M k81SJE7KKR5He2t315dvYHKZODNVYwE9rrCwutOaW/MYjGQ6xf+kE+uSj5aIfYkN++Sy W8zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784538980; x=1785143780; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=WqcCf+Dhdx6Y50GJtvfwTO5MqJahdd7ZlfJbqzun1ro=; b=r0qMIg/nfLJgLb++nLKpal6wVWc7eWNpEUCpKEyI6+jPasQxLSG6U1YjD818Ggvvyz qOB1zDVGpiP12Xj/a3/eHnYzOucgWczSt46aPxEAy3kBGmc+6OM91cP9RN9P5F5Mm9DB Ksg4FE1sKc//k+oSdMgVllItLOGYIELT+8cjALQtxqplR5iekT/cO8jra8Y560opWnBU I1xmzEMf4xeTSj+uY9uva+WYZQ8PD/WmyFAXEubu087aX/dAt/93Rls5Ob5ZPdABtkrz afQTXGeCm0V898oUq0w7JQZ+IHkyE6/ioaqYQhSlkdKUeQFOi5rVrnV0VAH0k9VH/V1M 4phA== X-Forwarded-Encrypted: i=1; AHgh+Roxmo3olEC0FnvrVibOot6ByH6vEN0qD+g4fPPVX4CoeThNKWLx9+f787kB8D8Hue7WJx4kFY8M+12HHcU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9JEMSQr8fvt2/i5yKBkSx4mBbr/VFnbmAF2pDOlmjOfbfjEvr aan2cIF3ml0CMDNt6HI1ilrJ0TlOuITdNYZLOEC0rpxph0IdimW/ZncVsWefIAN6ztkzgNRnsg7 FdB3Yl+O+h60CkKhcHaV8ta4lsy+Ma5XpnYVbc1kYQZiaedflB2TTxoVBT8Ml2pEpT+U= X-Gm-Gg: AfdE7ckMoeJWgW3W9gPALoUWOffpHFh5UNkmrTxkOnsGDaDp6R4Sol4MCCcEpJsMh/k +xRVfr75OiekLxFwjgWVlfvxI5GEDl8PFaQdCPZ7tnFO9N5lEJ1cV/CgXTK6njPSZshR63EXqBx ot9nVu+X0WTLivT7qfSkZ6nKkwHDav8eI3N/G4lsEaA//DfVzD4j4odKNCNEu/NyBXV+u5/dCz4 IAAqO51qK8ccGgwp7w9IIYuS0xOdRqsUz8p6e9+vLPmTuXbtwJCzP311bZzV0wrRUiQYJLVC+rE hyyJbwRmUeBn/I5Aj1LUZN3Yy5kc6FyAewBRIMj6qEt/ZdhvbGbiR4CtRBfaDnm4tuVFPDrOwdN kGKm7yjS42lz113oTvM82T9p5YFCWYG+fDdM4xJrFV5cbnRpnlHk= X-Received: by 2002:a05:622a:90b:b0:51e:aa39:4fc6 with SMTP id d75a77b69052e-5213ceccc62mr122232471cf.23.1784538980264; Mon, 20 Jul 2026 02:16:20 -0700 (PDT) X-Received: by 2002:a05:622a:90b:b0:51e:aa39:4fc6 with SMTP id d75a77b69052e-5213ceccc62mr122232241cf.23.1784538979813; Mon, 20 Jul 2026 02:16:19 -0700 (PDT) Received: from trex (182.red-79-144-196.dynamicip.rima-tde.net. [79.144.196.182]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49563969482sm12331985e9.3.2026.07.20.02.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 02:16:19 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez@oss.qualcomm.com, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, can.guo@oss.qualcomm.com, beanhuo@micron.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jenswi@kernel.org, sumit.garg@oss.qualcomm.com Subject: [PATCH v2 1/2] ufs: rpmb: retry power-on UNIT ATTENTION on the RPMB WLUN Date: Mon, 20 Jul 2026 11:16:10 +0200 Message-ID: <20260720091614.544968-2-jorge.ramirez@oss.qualcomm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260720091614.544968-1-jorge.ramirez@oss.qualcomm.com> References: <20260720091614.544968-1-jorge.ramirez@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEwMiBTYWx0ZWRfX8uTEEusstRWY JD8T27SeLztM0hKaO6UovPfTsjnj7u9RsXTXVjbcjn4YVn0+uRoPO5x09IK2kfpt2qsxf3X98Qd tfTriuQ8DOBMJ+tTJpEaqDNfIK+7KgM= X-Proofpoint-GUID: g3iDUi5jRzGNKyHnjhrwnLSUJZIjeIYy X-Proofpoint-ORIG-GUID: g3iDUi5jRzGNKyHnjhrwnLSUJZIjeIYy X-Authority-Analysis: v=2.4 cv=a+sAM0SF c=1 sm=1 tr=0 ts=6a5de765 cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=2lELrtOEK2EaG96G7mOeag==:17 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=w0io_FmA1e-6CLxyNa8A:9 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEwMiBTYWx0ZWRfXyWt5s2oXBwW1 0nxsdDCmLEISSuSgpalOAbF+EGZpCcisSa4UrZgXNuQeAlAZNzZmPZ1jZT8VABaSGaYD2ShAT9p aJXvzUdhmGIXFPZwXGDh2ZjemuGKjYDh5kzhtV5++qLPynhkwIJ8z/S5auySIBnzv0IYNz5PsZ4 v31evH7AdOSYFbh08eR+OeiSg31zJQjTCIoYWbBK5ZykYTFVF5PWGj2WUw4txSPdQxfF5yy7oTL pFLPSYSqDIw7QiTPGdgnywaOvhY3nb3T3pCsjBjcsRlI1hjmDgJi+CH33YkM/wnHWD1GtQ0YBEm e4cTu3CBgeS/17UXtUo9z/vVCpzyyGLuOs8BrHT+MEuoO7LKgtQ9kvsIVlBybLzZXocdKwrRJ/I zwpZIosLZVwsv4JQPPdBNM+Y3TXQHq7e98bKfPkpiy2+INzXwC0AutXGM6vPh31dSHeNrB8HZNX oHW3PPI+nZb42ObhAxQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-20_01,2026-07-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200102 After a power cycle, the first command sent to a UFS logical unit completes with CHECK CONDITION and a power-on UNIT ATTENTION (ASC 0x29). The SCSI core reports this to the caller instead of retrying it. For the RPMB well-known LU, that first command is the first RPMB frame sent after boot, so the frame fails. RPMB has no earlier, guaranteed access that could clear the condition beforehand, so this breaks RPMB on every cold boot. Ask the SCSI core to retry the power-on UNIT ATTENTION on the RPMB WLUN so that RPMB works from the very first access after a power cycle. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/ufs/core/ufs-rpmb.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufs-rpmb.c b/drivers/ufs/core/ufs-rpmb.c index ffad049872b9..d0c7ea7a36f4 100644 --- a/drivers/ufs/core/ufs-rpmb.c +++ b/drivers/ufs/core/ufs-rpmb.c @@ -40,6 +40,23 @@ struct ufs_rpmb_dev { static int ufs_sec_submit(struct ufs_hba *hba, u16 spsp, void *buffer, size_t len, bool send) { struct scsi_device *sdev = hba->ufs_rpmb_wlun; + /* Retry the power-on UNIT ATTENTION (ASC 0x29); the SCSI core does not. */ + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; + const struct scsi_exec_args exec_args = { + .failures = &failures, + }; u8 cdb[12] = { }; cdb[0] = send ? SECURITY_PROTOCOL_OUT : SECURITY_PROTOCOL_IN; @@ -48,7 +65,8 @@ static int ufs_sec_submit(struct ufs_hba *hba, u16 spsp, void *buffer, size_t le put_unaligned_be32(len, &cdb[6]); return scsi_execute_cmd(sdev, cdb, send ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, - buffer, len, /*timeout=*/30 * HZ, 0, NULL); + buffer, len, /*timeout=*/30 * HZ, /*retries=*/0, + &exec_args); } /* UFS RPMB route frames implementation */ -- 2.54.0