Download raw body.
sys/ufshci: increase poll's wait to 600ms
On Fri, Oct 02, 2026 at 10:57:05PM +0200, Kirill A. Korinsky wrote:
> On Fri, 02 Oct 2026 22:39:52 +0200,
> Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> >
> > > Date: Fri, 02 Oct 2026 22:12:26 +0200
> > > From: Kirill A. Korinsky <kirill@korins.ky>
> > >
> > > Marcus, Mark,
> > >
> > > we had already increased register status polling bus wait in v 1.47, and my
> > > Honor needs increase a bit as well.
> > >
> > > With 600ms maximal delay it survives suspend, at least it goes out from X11
> > > to console and I see that it detached USB and waits. It doesn't response on
> > > ping, but pressing any key reattach the USB, it goes back to X11 and
> > > responses to ping.
> > >
> > > I had played with different values and printed threshold when it doesn't
> > > survive. On my device it needs 59 or 60 retries usually to pass.
> > >
> > > I think it is safe to increase and ask to include to 8.0, and probably we
> > > can put here something larger than 60. For example 75.
> > >
> > > I read the code near by and that looks quite safe.
> > >
> > > Thoughts? Ok?
> >
> > So our driver seems to wait for 500us. But Linux uses a timeout of
> > 500ms as far as I can tell. U-Boot even uses a full second (1000ms).
> >
> > So I think we should raise retry to 50000.
And FreeBSD seems to use 500ms.
> Like that?
There is no defined wait time for UFSHCI_REG_UICCMD_CMDOP_DME_LINKSTARTUP
in the specs what I have checked. The change adapts with other drivers,
and has no harm to existing device behavior, so I am OK to increase it
to 500ms.
One small note for the future; currently ufshci_is_poll() is only used
for polling the UFSHCI_REG_IS_UCCS register status. If we should use
it in the future for polling other register status', we eventually
should pass the wait time as an argument to ufshci_is_poll(). But for
now it's fine to increase it globally.
> Index: sys/dev/ic/ufshci.c
> ===================================================================
> RCS file: /home/cvs/src/sys/dev/ic/ufshci.c,v
> diff -u -p -r1.49 ufshci.c
> --- sys/dev/ic/ufshci.c 6 Sep 2026 19:31:26 -0000 1.49
> +++ sys/dev/ic/ufshci.c 2 Oct 2026 20:56:18 -0000
> @@ -311,7 +311,7 @@ int
> ufshci_is_poll(struct ufshci_softc *sc, uint32_t type)
> {
> uint32_t status;
> - int i, retry = 50;
> + int i, retry = 50000;
>
> for (i = 0; i < retry; i++) {
> status = UFSHCI_READ_4(sc, UFSHCI_REG_IS);
>
>
> --
> wbr, Kirill
>
sys/ufshci: increase poll's wait to 600ms