diff mbox

[RFCv2,1/8] irqdomain: Introduce irq_domain_ops.init_alloc_info

Message ID 1436778864-17645-2-git-send-email-Suravee.Suthikulpanit@amd.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Suravee Suthikulpanit July 13, 2015, 9:14 a.m. UTC
Currently, when calling irq_domain_alloc_irqs() on ARM64, 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 irqchips to provide
a way to initialize irqchip-specific data-structure for allocating IRQ.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
---
NOTE:
Similarly, x86 is currently using struct irq_alloc_info
(see arch/x86/include/asm/hw_irq.h) and each irq_domain has different
way of initializing this structure.

Patch 2 also has an example of how I am planning to use this new op.

Alternative would be to keep re-using of_phandle_args for ACPI as done
currently. Any suggestions / feedbacks here are appreciated.

Thanks,

Suravee

 include/linux/irqdomain.h |  2 ++
 kernel/irq/irqdomain.c    | 10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Thomas Gleixner July 20, 2015, 9:28 p.m. UTC | #1
On Mon, 13 Jul 2015, Suravee Suthikulpanit wrote:

> Currently, when calling irq_domain_alloc_irqs() on ARM64, 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 irqchips to provide
> a way to initialize irqchip-specific data-structure for allocating IRQ.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
> NOTE:
> Similarly, x86 is currently using struct irq_alloc_info
> (see arch/x86/include/asm/hw_irq.h) and each irq_domain has different
> way of initializing this structure.

And why don't you use the same mechanism on ARM and have a private
irq_alloc_info implementation which can carry either DT or ACPI
information?
 
Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Suravee Suthikulpanit July 23, 2015, 6:50 a.m. UTC | #2
On 7/21/15 04:28, Thomas Gleixner wrote:
> On Mon, 13 Jul 2015, Suravee Suthikulpanit wrote:
>
>> Currently, when calling irq_domain_alloc_irqs() on ARM64, 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 irqchips to provide
>> a way to initialize irqchip-specific data-structure for allocating IRQ.
>>
>> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>> ---
>> NOTE:
>> Similarly, x86 is currently using struct irq_alloc_info
>> (see arch/x86/include/asm/hw_irq.h) and each irq_domain has different
>> way of initializing this structure.
>
> And why don't you use the same mechanism on ARM and have a private
> irq_alloc_info implementation which can carry either DT or ACPI
> information?

Let me look further into this. I would like to take a similar approach here.

Suravee

> Thanks,
>
> 	tglx
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index b4a74f7..1e51369 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -86,6 +86,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 995d217..54434d2 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -478,6 +478,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) {
@@ -504,7 +505,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 {