* [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
@ 2026-11-16 13:39 Enric Balletbo i Serra
2026-11-16 14:38 ` Larisa Ileana Grigore
2026-11-16 22:27 ` Bean Huo
0 siblings, 2 replies; 3+ messages in thread
From: Enric Balletbo i Serra @ 2026-11-16 13:39 UTC (permalink / raw)
To: Alim Akhtar, Bart Van Assche, Bean Huo, Stanley Jhu,
James E.J. Bottomley, Martin K. Petersen, Mike Bi, Avri Altman,
Thomas Weißschuh
Cc: Luca Porzio, linux-scsi, linux-kernel, NXP S32 Linux Team,
linux-arm-kernel, Frank Li, Larisa Grigore,
Enric Balletbo i Serra
ufshcd_update_rtc() uses ufshcd_query_attr() directly to write the
bSecondsPassed attribute, making it the only query attribute caller in
the UFS core that does not use the retry variant. All other callers use
ufshcd_query_attr_retry(), which retries up to three times on transient
failures before escalating to dev_err.
This causes spurious error messages during boot on some platforms when
the write-attribute command hits a transient OCS_INVALID_COMMAND_STATUS
error:
ufs-s32n7 4ac80000.ufs: ufshcd_query_attr: opcode 0x04 for idn 15 failed, index 0, err = 15
ufs-s32n7 4ac80000.ufs: ufshcd_update_rtc: Failed to update rtc 15
Switch to ufshcd_query_attr_retry() to handle transient failures
gracefully, consistent with every other attribute query in the driver.
Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
---
drivers/ufs/core/ufshcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 3c28bc67c65f..1cd32b7cc967 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8821,8 +8821,8 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
if (ufshcd_rpm_get_if_active(hba) <= 0)
return;
- err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
- 0, 0, &val);
+ err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
+ QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, &val);
ufshcd_rpm_put(hba);
if (err)
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261116-ufs-rtc-query-retry-3f27084f878f
Best regards,
--
Enric Balletbo i Serra <eballetb@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
2026-11-16 13:39 [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update Enric Balletbo i Serra
@ 2026-11-16 14:38 ` Larisa Ileana Grigore
2026-11-16 22:27 ` Bean Huo
1 sibling, 0 replies; 3+ messages in thread
From: Larisa Ileana Grigore @ 2026-11-16 14:38 UTC (permalink / raw)
To: Enric Balletbo i Serra, Alim Akhtar, Bart Van Assche, Bean Huo,
Stanley Jhu, James E.J. Bottomley, Martin K. Petersen, Mike Bi,
Avri Altman, Thomas Weißschuh
Cc: Luca Porzio, linux-scsi, linux-kernel, NXP S32 Linux Team,
linux-arm-kernel, Frank Li
On 11/16/2026 3:39 PM, Enric Balletbo i Serra wrote:
> ufshcd_update_rtc() uses ufshcd_query_attr() directly to write the
> bSecondsPassed attribute, making it the only query attribute caller in
> the UFS core that does not use the retry variant. All other callers use
> ufshcd_query_attr_retry(), which retries up to three times on transient
> failures before escalating to dev_err.
>
> This causes spurious error messages during boot on some platforms when
> the write-attribute command hits a transient OCS_INVALID_COMMAND_STATUS
> error:
>
> ufs-s32n7 4ac80000.ufs: ufshcd_query_attr: opcode 0x04 for idn 15 failed, index 0, err = 15
> ufs-s32n7 4ac80000.ufs: ufshcd_update_rtc: Failed to update rtc 15
>
> Switch to ufshcd_query_attr_retry() to handle transient failures
> gracefully, consistent with every other attribute query in the driver.
>
> Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
> Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
> ---
> drivers/ufs/core/ufshcd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 3c28bc67c65f..1cd32b7cc967 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8821,8 +8821,8 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
> if (ufshcd_rpm_get_if_active(hba) <= 0)
> return;
>
> - err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
> - 0, 0, &val);
> + err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
> + QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, &val);
> ufshcd_rpm_put(hba);
>
> if (err)
>
> ---
> base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
> change-id: 20261116-ufs-rtc-query-retry-3f27084f878f
>
> Best regards,
Hello Enric,
Regarding the OCS_INVALID_COMMAND_STATUS seen on S32N79RDB, this
behavior is related to known errata that will be documented in the
future. I plan to submit a separate patch series to address these errata.
For this issue, OCS values 0xf and 0x3 are expected.
Best regards,
Larisa
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
2026-11-16 13:39 [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update Enric Balletbo i Serra
2026-11-16 14:38 ` Larisa Ileana Grigore
@ 2026-11-16 22:27 ` Bean Huo
1 sibling, 0 replies; 3+ messages in thread
From: Bean Huo @ 2026-11-16 22:27 UTC (permalink / raw)
To: Enric Balletbo i Serra, Alim Akhtar, Bart Van Assche, Bean Huo,
Stanley Jhu, James E.J. Bottomley, Martin K. Petersen, Mike Bi,
Avri Altman, Thomas Weißschuh
Cc: Luca Porzio, linux-scsi, linux-kernel, NXP S32 Linux Team,
linux-arm-kernel, Frank Li, Larisa Grigore
Thanks for the patch. A few comments:
On Mon, 2026-11-16 at 14:39 +0100, Enric Balletbo i Serra wrote:
> ufshcd_update_rtc() uses ufshcd_query_attr() directly to write the
> bSecondsPassed attribute, making it the only query attribute caller in
> the UFS core that does not use the retry variant. All other callers use
> ufshcd_query_attr_retry(), which retries up to three times on transient
> failures before escalating to dev_err.
>
> This causes spurious error messages during boot on some platforms when
> the write-attribute command hits a transient OCS_INVALID_COMMAND_STATUS
> error:
>
> ufs-s32n7 4ac80000.ufs: ufshcd_query_attr: opcode 0x04 for idn 15 failed,
> index 0, err = 15
this is printed by ufshcd_query_attr() itself at dev_err level, so it will still
show up with this patch. Could you share the log with the patch applied?
and err = 15 is OCS_INVALID_COMMAND_STATUS, the value the driver puts in the
UTRD before sending. So the request was completed but the host controller did
not update OCS. This looks like a host side problem? not a transient device
failure, and a retry here would only hide it. Is this SDB or MCQ? Does it only
happen on the first RTC update after probe?
> ufs-s32n7 4ac80000.ufs: ufshcd_update_rtc: Failed to update rtc 15
> Switch to ufshcd_query_attr_retry() to handle transient failures
> gracefully, consistent with every other attribute query in the driver.
>
ufshcd_update_rtc() is not the only caller without retry. ufs-sysfs.c, ufs-
hwmon.c and ufs-txeq.c also call ufshcd_query_attr() directly, so the commit
message is wrong.
> Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
> Signed-off-by: Enric Balletbo i Serra <eballetb@redhat.com>
I would like to understand the root cause first.
Kind regards,
Bean
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 22:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 13:39 [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update Enric Balletbo i Serra
2026-11-16 14:38 ` Larisa Ileana Grigore
2026-11-16 22:27 ` Bean Huo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®