]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/xics: Add support for IRQ domain hierarchy
authorCédric Le Goater <clg@kaod.org>
Thu, 1 Jul 2021 13:27:38 +0000 (15:27 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 10 Aug 2021 13:15:00 +0000 (23:15 +1000)
XICS doesn't have any state associated with the IRQ. The support is
straightforward and simpler than for XIVE.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701132750.1475580-21-clg@kaod.org
arch/powerpc/sysdev/xics/xics-common.c

index 18d3de2f22493736f5564cca390072272a76a4cb..febab57f060f73189c3dd009ea173def6616ab23 100644 (file)
@@ -406,7 +406,48 @@ int xics_retrigger(struct irq_data *data)
        return 0;
 }
 
+#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
+static int xics_host_domain_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
+                                     unsigned long *hwirq, unsigned int *type)
+{
+       return xics_host_xlate(d, to_of_node(fwspec->fwnode), fwspec->param,
+                              fwspec->param_count, hwirq, type);
+}
+
+static int xics_host_domain_alloc(struct irq_domain *domain, unsigned int virq,
+                                 unsigned int nr_irqs, void *arg)
+{
+       struct irq_fwspec *fwspec = arg;
+       irq_hw_number_t hwirq;
+       unsigned int type = IRQ_TYPE_NONE;
+       int i, rc;
+
+       rc = xics_host_domain_translate(domain, fwspec, &hwirq, &type);
+       if (rc)
+               return rc;
+
+       pr_debug("%s %d/%lx #%d\n", __func__, virq, hwirq, nr_irqs);
+
+       for (i = 0; i < nr_irqs; i++)
+               irq_domain_set_info(domain, virq + i, hwirq + i, xics_ics->chip,
+                                   xics_ics, handle_fasteoi_irq, NULL, NULL);
+
+       return 0;
+}
+
+static void xics_host_domain_free(struct irq_domain *domain,
+                                 unsigned int virq, unsigned int nr_irqs)
+{
+       pr_debug("%s %d #%d\n", __func__, virq, nr_irqs);
+}
+#endif
+
 static const struct irq_domain_ops xics_host_ops = {
+#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
+       .alloc  = xics_host_domain_alloc,
+       .free   = xics_host_domain_free,
+       .translate = xics_host_domain_translate,
+#endif
        .match = xics_host_match,
        .map = xics_host_map,
        .xlate = xics_host_xlate,