Re: [PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
From: Enric Balletbo i Serra
Date: Tue Nov 17 2026 - 02:49:33 EST
Hi,
On Mon, Nov 16, 2026 at 11:28 PM Bean Huo <beanhuo@xxxxxxxx> wrote:
>
> 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?
>
I assume I got confused because after applying the patch both messages
disappeared, but what you mention, and sashiko also pointed, is right,
from code I should have still see the ufshcd_query_attr: opcode 0x04
... message
The fact that I didn't see those messages after applying the patch
likely means it showed a case where the first attempt succeeded. I
didn't perform a lot of boots.
> 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?
>
Answering your last question, yes, it seems to happen on the first RTC
update after probe.
Larisa mentioned there is a known errata that will be documented in
the future that could be related. We should probably wait for that
errata to better understand the problem.
>
> > 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.
>
Right, I used the wrong wording here and made the mistake of only
looking at core/ufshcd.c, not the full core files.c not the full core
files.
>
> > Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
>
> > Signed-off-by: Enric Balletbo i Serra <eballetb@xxxxxxxxxx>
>
>
> I would like to understand the root cause first.
>
Agree, let's wait for Larisa patches.
Thanks,
Enric
> Kind regards,
> Bean
>
>
>
>