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

From: Thomas Gleixner
Date: Thu Feb 13 2020 - 06:02:12 EST


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.

> + struct plic_handler *handler = per_cpu_ptr(&plic_handlers, cpu);

this_cpu_ptr*&...)

The callback is guaranteed to run on the plugged in CPU.

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

Thanks,

tglx