Re: [PATCH] scsi: ufs: rpmb: Fix power-on UNIT ATTENTION retry

From: Damien Le Moal

Date: Tue Sep 29 2026 - 09:28:46 EST


On 2026/09/29 5:13, Stanley Jhu wrote:
> A merge conflict resolution dropped SCMD_FAILURE_ASCQ_ANY from the
> retry added by commit a8a34238e5e6 ("scsi: ufs: rpmb: Retry power-on
> UNIT ATTENTION on the RPMB WLUN"), so only 29h/00h is retried, not
> the other 29h ASCQs.
>
> Link: https://lore.kernel.org/linux-scsi/yq1jyo4onqe.fsf@xxxxxxxxxxxxxxx/
> Signed-off-by: Stanley Jhu <stanleyjhu@xxxxxxxxxx>
> ---
> Tested in QEMU on top of "scsi: ufs: rpmb: Drop the unregistered
> ufs_rpmb bus" (RPMB v5 3/3).
>
> drivers/ufs/core/ufs-rpmb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufs-rpmb.c b/drivers/ufs/core/ufs-rpmb.c
> index 50ef63afd528..7b9b59c9e968 100644
> --- a/drivers/ufs/core/ufs-rpmb.c
> +++ b/drivers/ufs/core/ufs-rpmb.c
> @@ -47,7 +47,8 @@ static int ufs_sec_submit(struct ufs_hba *hba, u16 spsp, void *buffer, size_t le
> {
> .sense_key = UNIT_ATTENTION,
> .sense_code =
> - POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED,
> + POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED |
> + SCMD_FAILURE_ASCQ_ANY,

While that leads to the correct value, I think it is better to use:

.sense_code =
scsi_sense_code(ASC_POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED,
SCMD_FAILURE_ASCQ_ANY),

> .allowed = UFS_RPMB_UA_RETRIES,
> .result = SAM_STAT_CHECK_CONDITION,
> },
>
> base-commit: f09d2c7485b32adb82336d0d748935c8237a649e


--
Damien Le Moal
Western Digital Research