Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: sys/ufshci: increase poll's wait to 600ms
To:
Kirill A. Korinsky <kirill@korins.ky>
Cc:
mglocker@openbsd.org, kettenis@openbsd.org, tech@openbsd.org
Date:
Fri, 02 Oct 2026 22:39:52 +0200

Download raw body.

Thread
> 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.

> 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	30 Sep 2026 23:02:27 -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 = 60;
>  
>  	for (i = 0; i < retry; i++) {
>  		status = UFSHCI_READ_4(sc, UFSHCI_REG_IS);
> 
> 
> -- 
> wbr, Kirill
>