Re: [PATCH v8 02/15] octeontx2-af: Reset all RVU blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 7, 2018 at 5:00 PM <sunil.kovvuri@xxxxxxxxx> wrote:
>
> From: Sunil Goutham <sgoutham@xxxxxxxxxxx>
>
> 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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux