blob: 9cc809e5d8c0de1c27eb543543d332039384fd6f [file] [log] [blame]
From 092a5fa0245644315d986031a88aa98d4d15632d Mon Sep 17 00:00:00 2001
From: Alan Mikhak <>
Date: Thu, 24 Oct 2019 09:11:43 -0700
Subject: [PATCH] irqchip/sifive-plic: Skip contexts except supervisor in
commit 41860cc447045c811ce6d5a92f93a065a691fe8e upstream.
Modify plic_init() to skip .dts interrupt contexts other
than supervisor external interrupt.
The .dts entry for plic may specify multiple interrupt contexts.
For example, it may assign two entries IRQ_M_EXT and IRQ_S_EXT,
in that order, to the same interrupt controller. This patch
modifies plic_init() to skip the IRQ_M_EXT context since
IRQ_S_EXT is currently the only supported context.
If IRQ_M_EXT is not skipped, plic_init() will report "handler
already present for context" when it comes across the IRQ_S_EXT
context in the next iteration of its loop.
Without this patch, .dts would have to be edited to replace the
value of IRQ_M_EXT with -1 for it to be skipped.
Signed-off-by: Alan Mikhak <>
Signed-off-by: Marc Zyngier <>
Reviewed-by: Christoph Hellwig <>
Acked-by: Paul Walmsley <> # arch/riscv
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index daefc52b0ec5..7d0a12fe2714 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -252,8 +252,8 @@ static int __init plic_init(struct device_node *node,
- /* skip context holes */
- if (parent.args[0] == -1)
+ /* skip contexts other than supervisor external interrupt */
+ if (parent.args[0] != IRQ_S_EXT)
hartid = plic_find_hart_id(;