Message ID | 20181130080207.20505-5-anup@brainfault.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | IRQ affinity support in PLIC driver | expand |
On Fri, Nov 30, 2018 at 01:32:05PM +0530, Anup Patel wrote: > We have two enteries (one for M-mode and another for S-mode) in the > interrupts-extended DT property of PLIC DT node for each HART. It is > expected that firmware/bootloader will set M-mode HWIRQ line of each > HART to 0xffffffff (i.e. -1) in interrupts-extended DT property > because Linux runs in S-mode only. > > If firmware/bootloader is buggy then it will not correctly update > interrupts-extended DT property which might result in a plic_handler > configured twice. This patch adds a warning in plic_init() if a > plic_handler is already marked present. This warning provides us > a hint about incorrectly updated interrupts-extended DT property. > > Signed-off-by: Anup Patel <anup@brainfault.org> > --- > drivers/irqchip/irq-sifive-plic.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > index d4433399eb89..3d4f205f8abe 100644 > --- a/drivers/irqchip/irq-sifive-plic.c > +++ b/drivers/irqchip/irq-sifive-plic.c > @@ -234,6 +234,11 @@ static int __init plic_init(struct device_node *node, > > cpu = riscv_hartid_to_cpuid(hartid); > handler = per_cpu_ptr(&plic_handlers, cpu); > + if (handler->present) { > + pr_warn("handler not available for context %d.\n", i); > + continue; > + } Shouldn't this be something like "handler already present.." Otherwise this looks fine: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Mon, Dec 17, 2018 at 11:58 PM Christoph Hellwig <hch@infradead.org> wrote: > > On Fri, Nov 30, 2018 at 01:32:05PM +0530, Anup Patel wrote: > > We have two enteries (one for M-mode and another for S-mode) in the > > interrupts-extended DT property of PLIC DT node for each HART. It is > > expected that firmware/bootloader will set M-mode HWIRQ line of each > > HART to 0xffffffff (i.e. -1) in interrupts-extended DT property > > because Linux runs in S-mode only. > > > > If firmware/bootloader is buggy then it will not correctly update > > interrupts-extended DT property which might result in a plic_handler > > configured twice. This patch adds a warning in plic_init() if a > > plic_handler is already marked present. This warning provides us > > a hint about incorrectly updated interrupts-extended DT property. > > > > Signed-off-by: Anup Patel <anup@brainfault.org> > > --- > > drivers/irqchip/irq-sifive-plic.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c > > index d4433399eb89..3d4f205f8abe 100644 > > --- a/drivers/irqchip/irq-sifive-plic.c > > +++ b/drivers/irqchip/irq-sifive-plic.c > > @@ -234,6 +234,11 @@ static int __init plic_init(struct device_node *node, > > > > cpu = riscv_hartid_to_cpuid(hartid); > > handler = per_cpu_ptr(&plic_handlers, cpu); > > + if (handler->present) { > > + pr_warn("handler not available for context %d.\n", i); > > + continue; > > + } > > Shouldn't this be something like "handler already present.." OK, I will re-phrase it. > > Otherwise this looks fine: > > Reviewed-by: Christoph Hellwig <hch@lst.de> Regards, Anup
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c index d4433399eb89..3d4f205f8abe 100644 --- a/drivers/irqchip/irq-sifive-plic.c +++ b/drivers/irqchip/irq-sifive-plic.c @@ -234,6 +234,11 @@ static int __init plic_init(struct device_node *node, cpu = riscv_hartid_to_cpuid(hartid); handler = per_cpu_ptr(&plic_handlers, cpu); + if (handler->present) { + pr_warn("handler not available for context %d.\n", i); + continue; + } + handler->present = true; handler->hart_base = plic.regs + CONTEXT_BASE + i * CONTEXT_PER_HART;
We have two enteries (one for M-mode and another for S-mode) in the interrupts-extended DT property of PLIC DT node for each HART. It is expected that firmware/bootloader will set M-mode HWIRQ line of each HART to 0xffffffff (i.e. -1) in interrupts-extended DT property because Linux runs in S-mode only. If firmware/bootloader is buggy then it will not correctly update interrupts-extended DT property which might result in a plic_handler configured twice. This patch adds a warning in plic_init() if a plic_handler is already marked present. This warning provides us a hint about incorrectly updated interrupts-extended DT property. Signed-off-by: Anup Patel <anup@brainfault.org> --- drivers/irqchip/irq-sifive-plic.c | 5 +++++ 1 file changed, 5 insertions(+)