Currently, when calling irq_domain_alloc_irqs, it uses struct of_phandle_args to pass IRQ information. However, this is not appropriate for ACPI since of_phandle_args is specific to DT.
Therefore, this patch introduces a new function pointer, irq_domain_ops.init_alloc_info, which can be used by irqchip to provide a way to initialize irqchip-specific data-structure for allocating IRQ.
Signed-off-by: Suravee Suthikulpanit Suravee.Suthikulpanit@amd.com --- include/linux/irqdomain.h | 2 ++ kernel/irq/irqdomain.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 744ac0e..39fbcd8 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -72,6 +72,8 @@ struct irq_domain_ops { /* extended V2 interfaces to support hierarchy irq_domains */ int (*alloc)(struct irq_domain *d, unsigned int virq, unsigned int nr_irqs, void *arg); + int (*init_alloc_info)(uint32_t *data, int nr, void *ref, + void **info); void (*free)(struct irq_domain *d, unsigned int virq, unsigned int nr_irqs); void (*activate)(struct irq_domain *d, struct irq_data *irq_data); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 8c3577f..cc4ef7c 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -470,6 +470,7 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) irq_hw_number_t hwirq; unsigned int type = IRQ_TYPE_NONE; int virq; + void *info;
domain = irq_data->np ? irq_find_host(irq_data->np) : irq_default_domain; if (!domain) { @@ -496,7 +497,14 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) if (virq) return virq;
- virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); + if (domain->ops->init_alloc_info) + if (domain->ops->init_alloc_info(irq_data->args, + irq_data->args_count, + irq_data->np, + &info)) + return 0; + + virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, info); if (virq <= 0) return 0; } else {