Skip to content

Commit 6adfe8d

Browse files
avpatelMarc Zyngier
authored andcommitted
irqchip/sifive-plic: Differentiate between PLIC handler and context
We explicitly differentiate between PLIC handler and context because PLIC context is for given mode of HART whereas PLIC handler is per-CPU software construct meant for handling interrupts from a particular PLIC context. To achieve this differentiation, we rename "nr_handlers" to "nr_contexts" and "nr_mapped" to "nr_handlers" in plic_init(). 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 3fecb5a commit 6adfe8d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/irqchip/irq-sifive-plic.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int plic_find_hart_id(struct device_node *node)
177177
static int __init plic_init(struct device_node *node,
178178
struct device_node *parent)
179179
{
180-
int error = 0, nr_handlers, nr_mapped = 0, i;
180+
int error = 0, nr_contexts, nr_handlers = 0, i;
181181
u32 nr_irqs;
182182

183183
if (plic_regs) {
@@ -194,10 +194,10 @@ static int __init plic_init(struct device_node *node,
194194
if (WARN_ON(!nr_irqs))
195195
goto out_iounmap;
196196

197-
nr_handlers = of_irq_count(node);
198-
if (WARN_ON(!nr_handlers))
197+
nr_contexts = of_irq_count(node);
198+
if (WARN_ON(!nr_contexts))
199199
goto out_iounmap;
200-
if (WARN_ON(nr_handlers < num_possible_cpus()))
200+
if (WARN_ON(nr_contexts < num_possible_cpus()))
201201
goto out_iounmap;
202202

203203
error = -ENOMEM;
@@ -206,7 +206,7 @@ static int __init plic_init(struct device_node *node,
206206
if (WARN_ON(!plic_irqdomain))
207207
goto out_iounmap;
208208

209-
for (i = 0; i < nr_handlers; i++) {
209+
for (i = 0; i < nr_contexts; i++) {
210210
struct of_phandle_args parent;
211211
struct plic_handler *handler;
212212
irq_hw_number_t hwirq;
@@ -250,11 +250,11 @@ static int __init plic_init(struct device_node *node,
250250
writel(0, handler->hart_base + CONTEXT_THRESHOLD);
251251
for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
252252
plic_toggle(handler, hwirq, 0);
253-
nr_mapped++;
253+
nr_handlers++;
254254
}
255255

256-
pr_info("mapped %d interrupts to %d (out of %d) handlers.\n",
257-
nr_irqs, nr_mapped, nr_handlers);
256+
pr_info("mapped %d interrupts with %d handlers for %d contexts.\n",
257+
nr_irqs, nr_handlers, nr_contexts);
258258
set_handle_irq(plic_handle_irq);
259259
return 0;
260260

0 commit comments

Comments
 (0)