Re: [PATCH v8 10/11] irqchip/sifive-plic: Initialize the plic handler when cpu comes online

From: Atish Patra
Date: Thu Feb 13 2020 - 14:01:53 EST


On Thu, Feb 13, 2020 at 3:02 AM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> Atish Patra <atish.patra@xxxxxxx> writes:
>
> > +static void plic_handler_init(struct plic_handler *handler, u32 threshold)
> > +{
> > + irq_hw_number_t hwirq;
> > +
> > + /* priority must be > threshold to trigger an interrupt */
> > + writel(threshold, handler->hart_base + CONTEXT_THRESHOLD);
> > + for (hwirq = 1; hwirq < plic_irqdomain->hwirq_max; hwirq++)
> > + plic_toggle(handler, hwirq, 0);
> > +}
>
> > +
> > +static int plic_starting_cpu(unsigned int cpu)
> > +{
> > + u32 threshold = 0;
>
> Pointless variable. Also you use PLIC_DISABLE_THRESHOLD down below, so
> please add a proper define for enable as well.
>

Sure. Will do that.

> > + struct plic_handler *handler = per_cpu_ptr(&plic_handlers, cpu);
>
> this_cpu_ptr*&...)
>
> The callback is guaranteed to run on the plugged in CPU.
>

Ah yes. I will change it to this_cpu_ptr. Thanks.

> > - threshold = 0xffffffff;
> > + plic_handler_init(handler, PLIC_DISABLE_THRESHOLD);
>
> Thanks,
>
> tglx
>


--
Regards,
Atish