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>
This commit is contained in:
parent
3fecb5aac2
commit
6adfe8d2f5
@ -177,7 +177,7 @@ static int plic_find_hart_id(struct device_node *node)
|
||||
static int __init plic_init(struct device_node *node,
|
||||
struct device_node *parent)
|
||||
{
|
||||
int error = 0, nr_handlers, nr_mapped = 0, i;
|
||||
int error = 0, nr_contexts, nr_handlers = 0, i;
|
||||
u32 nr_irqs;
|
||||
|
||||
if (plic_regs) {
|
||||
@ -194,10 +194,10 @@ static int __init plic_init(struct device_node *node,
|
||||
if (WARN_ON(!nr_irqs))
|
||||
goto out_iounmap;
|
||||
|
||||
nr_handlers = of_irq_count(node);
|
||||
if (WARN_ON(!nr_handlers))
|
||||
nr_contexts = of_irq_count(node);
|
||||
if (WARN_ON(!nr_contexts))
|
||||
goto out_iounmap;
|
||||
if (WARN_ON(nr_handlers < num_possible_cpus()))
|
||||
if (WARN_ON(nr_contexts < num_possible_cpus()))
|
||||
goto out_iounmap;
|
||||
|
||||
error = -ENOMEM;
|
||||
@ -206,7 +206,7 @@ static int __init plic_init(struct device_node *node,
|
||||
if (WARN_ON(!plic_irqdomain))
|
||||
goto out_iounmap;
|
||||
|
||||
for (i = 0; i < nr_handlers; i++) {
|
||||
for (i = 0; i < nr_contexts; i++) {
|
||||
struct of_phandle_args parent;
|
||||
struct plic_handler *handler;
|
||||
irq_hw_number_t hwirq;
|
||||
@ -250,11 +250,11 @@ static int __init plic_init(struct device_node *node,
|
||||
writel(0, handler->hart_base + CONTEXT_THRESHOLD);
|
||||
for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
|
||||
plic_toggle(handler, hwirq, 0);
|
||||
nr_mapped++;
|
||||
nr_handlers++;
|
||||
}
|
||||
|
||||
pr_info("mapped %d interrupts to %d (out of %d) handlers.\n",
|
||||
nr_irqs, nr_mapped, nr_handlers);
|
||||
pr_info("mapped %d interrupts with %d handlers for %d contexts.\n",
|
||||
nr_irqs, nr_handlers, nr_contexts);
|
||||
set_handle_irq(plic_handle_irq);
|
||||
return 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user