Skip to content

Commit fd6db28

Browse files
legoatermpe
authored andcommitted
powerpc/xive: Modernize XIVE-IPI domain with an 'alloc' handler
Instead of calling irq_create_mapping() to map the IPI for a node, introduce an 'alloc' handler. This is usually an extension to support hierarchy irq_domains which is not exactly the case for XIVE-IPI domain. However, we can now use the irq_domain_alloc_irqs() routine which allocates the IRQ descriptor on the specified node, even better for cache performance on multi node machines. 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/20210331144514.892250-10-clg@kaod.org
1 parent 7dcc37b commit fd6db28

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

arch/powerpc/sysdev/xive/common.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,15 +1102,26 @@ static struct irq_chip xive_ipi_chip = {
11021102
* IPIs are marked per-cpu. We use separate HW interrupts under the
11031103
* hood but associated with the same "linux" interrupt
11041104
*/
1105-
static int xive_ipi_irq_domain_map(struct irq_domain *h, unsigned int virq,
1106-
irq_hw_number_t hw)
1105+
struct xive_ipi_alloc_info {
1106+
irq_hw_number_t hwirq;
1107+
};
1108+
1109+
static int xive_ipi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
1110+
unsigned int nr_irqs, void *arg)
11071111
{
1108-
irq_set_chip_and_handler(virq, &xive_ipi_chip, handle_percpu_irq);
1112+
struct xive_ipi_alloc_info *info = arg;
1113+
int i;
1114+
1115+
for (i = 0; i < nr_irqs; i++) {
1116+
irq_domain_set_info(domain, virq + i, info->hwirq + i, &xive_ipi_chip,
1117+
domain->host_data, handle_percpu_irq,
1118+
NULL, NULL);
1119+
}
11091120
return 0;
11101121
}
11111122

11121123
static const struct irq_domain_ops xive_ipi_irq_domain_ops = {
1113-
.map = xive_ipi_irq_domain_map,
1124+
.alloc = xive_ipi_irq_domain_alloc,
11141125
};
11151126

11161127
static int __init xive_request_ipi(void)
@@ -1135,7 +1146,7 @@ static int __init xive_request_ipi(void)
11351146

11361147
for_each_node(node) {
11371148
struct xive_ipi_desc *xid = &xive_ipis[node];
1138-
irq_hw_number_t ipi_hwirq = node;
1149+
struct xive_ipi_alloc_info info = { node };
11391150

11401151
/* Skip nodes without CPUs */
11411152
if (cpumask_empty(cpumask_of_node(node)))
@@ -1146,9 +1157,9 @@ static int __init xive_request_ipi(void)
11461157
* Since the HW interrupt number doesn't have any meaning,
11471158
* simply use the node number.
11481159
*/
1149-
xid->irq = irq_create_mapping(ipi_domain, ipi_hwirq);
1150-
if (!xid->irq) {
1151-
ret = -EINVAL;
1160+
xid->irq = irq_domain_alloc_irqs(ipi_domain, 1, node, &info);
1161+
if (xid->irq < 0) {
1162+
ret = xid->irq;
11521163
goto out_free_xive_ipis;
11531164
}
11541165

0 commit comments

Comments
 (0)