Skip to content

Commit 3fecb5a

Browse files
avpatelMarc Zyngier
authored andcommitted
irqchip/sifive-plic: Add warning in plic_init() if handler already present
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> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 86c7cbf commit 3fecb5a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/irqchip/irq-sifive-plic.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ static int __init plic_init(struct device_node *node,
234234
}
235235

236236
handler = per_cpu_ptr(&plic_handlers, cpu);
237+
if (handler->present) {
238+
pr_warn("handler already present for context %d.\n", i);
239+
continue;
240+
}
241+
237242
handler->present = true;
238243
handler->hart_base =
239244
plic_regs + CONTEXT_BASE + i * CONTEXT_PER_HART;

0 commit comments

Comments
 (0)