[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1JmbeSvt_vdbBA2kkGFRew0p3JWKHzwoE=b_4NOf-UyQ@mail.gmail.com>
Date: Mon, 8 Oct 2018 14:16:22 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Sunil Kovvuri <sunil.kovvuri@...il.com>
Cc: Networking <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>, linux-soc@...r.kernel.org,
sgoutham@...vell.com
Subject: Re: [PATCH v8 02/15] octeontx2-af: Reset all RVU blocks
On Sun, Oct 7, 2018 at 5:00 PM <sunil.kovvuri@...il.com> wrote:
>
> From: Sunil Goutham <sgoutham@...vell.com>
>
> Go through all BLKADDRs and check which ones are implemented
> on this silicon and do a HW reset of each implemented block.
> Also added all RVU AF and PF register offsets.
>
>
> +/* Poll a RVU block's register 'offset', for a 'zero'
> + * or 'nonzero' at bits specified by 'mask'
> + */
> +int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero)
> +{
> + void __iomem *reg;
> + int timeout = 100;
> + u64 reg_val;
> +
> + reg = rvu->afreg_base + ((block << 28) | offset);
> + while (timeout) {
> + reg_val = readq(reg);
> + if (zero && !(reg_val & mask))
> + return 0;
> + if (!zero && (reg_val & mask))
> + return 0;
> + udelay(1);
> + cpu_relax();
> + timeout--;
> + }
> + return -EBUSY;
> +}
This can be a fairly long wait of multiple milliseconds, given that
you call it nine times in a row, that each udelay() can take
multiple microseconds (plus the time for the readq()), and
you look 100 times.
It seems this is only called from probe(), which is not in atomic
context, and you don't hold any locks, so why not change the
udelay() to an msleep() or usleep_range() to let some other
process run?
Arnd
Powered by blists - more mailing lists