Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234293 > unrolled thread

[PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware

Started byMarc Zyngier <marc.zyngier@arm.com>
First post2015-09-28 18:50 +0200
Last post2015-09-29 19:20 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware Marc Zyngier <marc.zyngier@arm.com> - 2015-09-28 18:50 +0200
    [PATCH v4 2/9] genirq/irqdomain: Add irq_create_acpi_mapping Marc Zyngier <marc.zyngier@arm.com> - 2015-09-28 18:50 +0200
    [PATCH v4 7/9] irqchip/GIC: Get rid of gic_init_bases() Marc Zyngier <marc.zyngier@arm.com> - 2015-09-28 18:50 +0200
    [PATCH v4 5/9] acpi/gsi: Add acpi_set_irq_model to initialize the GSI layer Marc Zyngier <marc.zyngier@arm.com> - 2015-09-28 18:50 +0200
    Re: [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware Marc Zyngier <marc.zyngier@arm.com> - 2015-09-29 19:20 +0200
    Re: [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware Rob Herring <robherring2@gmail.com> - 2015-09-29 19:20 +0200

#1234293 — [PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-09-28 18:50 +0200
Subject[PATCH v4 0/9] Making the generic ACPI GSI layer irqdomain aware
Message-ID<qdJMJ-54p-3@gated-at.bofh.it>
The irqdomain code is not entierely ACPI friendly, as it has some
built-in knowledge of the device-tree. Nothing too harmful, but enough
to scare the ARM ACPI developpers which end up with their own version
of the square wheel.

This small patch series adapts the irqdomain code to remove the
hurdles that prevent the full blown irqdomain subsystem to be used on
ACPI, creates an interface between the GSI layer and the irqdomain,
and as an example, convert the ARM GIC ACPI support to use irqdomains
as originally intended.

Overall, this gives us a way to use irqdomains on both DT and ACPI
enabled platforms, having very little changes made to the actual
drivers (other than the probing infrastructure). Because we keep the
flow of information between the various layers identical between ACPI
and DT, we immediately benefit from the existing infrastructure. The
"convert the GSI information to be DT friendly" is admitedly not very
pretty, but I see it as a stepping stone towards unifying the two
structures.

This has been test-booted on Juno, is based on 4.3-rc3, and available at:

git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git irq/gsi-irq-domain-v4

* From v3:
   - Got rid of the whole "void *" malarchy, and introduce a DT-based
     fwnode_handle allocator. Much smaller patch, better type checking,
     and a path forward to introduce fwnode_handle as the irqdomain
     identifier.
   - Small rework of the GIC stuff (cleanup, mostly).

* From v2:
   - Rebased on vanilla 4.3-rc1
   - Added the IDR infrastructure to irqdomain.c so that drivers don't
     have to come up with their own way of allocating identifiers
   - Changed the acpi_set_irq_model() signature to directly take a
     void *domain_token

* From v1:
  - Improved my Coccinelle foo and hopefully caught all the
    irq_domain.of_node users this time
  - Decoupled acpi_irq_model from domain_token. These are now two
    separate values that can be set independently
  - Moved the duty of populating acpi_gsi_descriptor to the interrupt
    controller, as it keeps the knowledge of the mapping with
    of_phandle_args in a single location
  - Generic accessor to set acpi_irq_model, domain_token and the
    populate function all in one go from the interrupt controller
  - General cleanup

Marc Zyngier (9):
  drivers/of: Introduce of_node_alloc
  genirq/irqdomain: Add irq_create_acpi_mapping
  genirq/irqdomain: Add a fwnode_handle allocator
  acpi/gsi: Always perform an irq domain lookup
  acpi/gsi: Add acpi_set_irq_model to initialize the GSI layer
  acpi/gsi: Select OF_DYNAMIC when ACPI_GENERIC_GSI is selected
  irqchip/GIC: Get rid of gic_init_bases()
  irqchip/GIC: Switch ACPI support to stacked domains
  acpi/gsi: Cleanup acpi_register_gsi

 drivers/acpi/Kconfig            |  1 +
 drivers/acpi/gsi.c              | 61 ++++++++++++++++++++++++-------------
 drivers/irqchip/irq-gic.c       | 66 ++++++++++++++++++++++++++++++-----------
 drivers/of/dynamic.c            | 22 ++++++++++++++
 include/linux/acpi.h            | 14 +++++++++
 include/linux/irqchip/arm-gic.h |  9 ++----
 include/linux/irqdomain.h       |  2 ++
 include/linux/of.h              |  5 ++++
 kernel/irq/irqdomain.c          | 48 ++++++++++++++++++++++++++++++
 9 files changed, 183 insertions(+), 45 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1234294 — [PATCH v4 2/9] genirq/irqdomain: Add irq_create_acpi_mapping

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-09-28 18:50 +0200
Subject[PATCH v4 2/9] genirq/irqdomain: Add irq_create_acpi_mapping
Message-ID<qdJML-54p-31@gated-at.bofh.it>
In reply to#1234293
In order to help ACPI on arm64 to make use of most of the irqdomain
goodies, add a new entry point (irq_create_acpi_mapping) which
mimics irq_create_of_mapping, except that it takes a new
struct acpi_gsi_descriptor, which is the pendent of of_phandle_args
in the OF world.

We assume that the way the acpi_gsi_descriptor is populated matches
that of of_phandle_args, as the latter is still the building block
for interrupt descriptor in the whole kernel.

Eventually, these two representations should be merged in a single
structure, but that's probably for another day.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 include/linux/acpi.h   |  9 +++++++++
 kernel/irq/irqdomain.c | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7235c48..4db2f01 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -201,6 +201,15 @@ int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
 
+#define MAX_GSI_DESC_PARAMS 16
+struct acpi_gsi_descriptor {
+	int param_count;
+	u32 param[MAX_GSI_DESC_PARAMS];
+};
+
+unsigned int irq_create_acpi_mapping(struct irq_domain *d,
+				     struct acpi_gsi_descriptor *irq_data);
+
 #ifdef CONFIG_X86_IO_APIC
 extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
 #else
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index dc9d27c..e5c1e4c 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1,5 +1,6 @@
 #define pr_fmt(fmt)  "irq: " fmt
 
+#include <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/hardirq.h>
 #include <linux/interrupt.h>
@@ -522,6 +523,23 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
 }
 EXPORT_SYMBOL_GPL(irq_create_of_mapping);
 
+#ifdef CONFIG_ACPI
+unsigned int irq_create_acpi_mapping(struct irq_domain *d,
+				     struct acpi_gsi_descriptor *irq_data)
+{
+	struct of_phandle_args args;
+	int i;
+
+	for (i = 0; i < min(irq_data->param_count, MAX_PHANDLE_ARGS); i++)
+		args.args[i] = irq_data->param[i];
+
+	args.np = d->of_node;
+	args.args_count = i;
+
+	return irq_create_of_mapping(&args);
+}
+#endif
+
 /**
  * irq_dispose_mapping() - Unmap an interrupt
  * @virq: linux irq number of the interrupt to unmap
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234297 — [PATCH v4 7/9] irqchip/GIC: Get rid of gic_init_bases()

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-09-28 18:50 +0200
Subject[PATCH v4 7/9] irqchip/GIC: Get rid of gic_init_bases()
Message-ID<qdJMM-54p-39@gated-at.bofh.it>
In reply to#1234293
Since nobody is using gic_init_bases anymore outside of the GIC
driver itself, let's do a bit of housekeeping and remove the now
useless entry point.

Only gic_init() is now exposed to the rest of the kernel for the
benefit of non DT/ACPI system.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic.c       | 8 +++-----
 include/linux/irqchip/arm-gic.h | 9 ++-------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 982c09c..0e4142d 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -1087,17 +1087,15 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
 	gic_pm_init(gic);
 }
 
-void __init gic_init_bases(unsigned int gic_nr, int irq_start,
-			   void __iomem *dist_base, void __iomem *cpu_base,
-			   u32 percpu_offset, struct device_node *node)
+void __init gic_init(unsigned int gic_nr, int irq_start,
+		     void __iomem *dist_base, void __iomem *cpu_base)
 {
 	/*
 	 * Non-DT/ACPI systems won't run a hypervisor, so let's not
 	 * bother with these...
 	 */
 	static_key_slow_dec(&supports_deactivate);
-	__gic_init_bases(gic_nr, irq_start, dist_base, cpu_base,
-			 percpu_offset, node);
+	__gic_init_bases(gic_nr, irq_start, dist_base, cpu_base, 0, NULL);
 }
 
 #ifdef CONFIG_OF
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index b8901df..bae69e5 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -100,16 +100,11 @@
 
 struct device_node;
 
-void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,
-		    u32 offset, struct device_node *);
 void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
 int gic_cpu_if_down(unsigned int gic_nr);
 
-static inline void gic_init(unsigned int nr, int start,
-			    void __iomem *dist , void __iomem *cpu)
-{
-	gic_init_bases(nr, start, dist, cpu, 0, NULL);
-}
+void gic_init(unsigned int nr, int start,
+	      void __iomem *dist , void __iomem *cpu);
 
 int gicv2m_of_init(struct device_node *node, struct irq_domain *parent);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1234298 — [PATCH v4 5/9] acpi/gsi: Add acpi_set_irq_model to initialize the GSI layer

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-09-28 18:50 +0200
Subject[PATCH v4 5/9] acpi/gsi: Add acpi_set_irq_model to initialize the GSI layer
Message-ID<qdJMM-54p-49@gated-at.bofh.it>
In reply to#1234293
In order to start embrassing irqdomains at the GSI level, introduce
a new initializer:

void acpi_set_irq_model(enum acpi_irq_model_id model,
			struct fwnode_handle *fwnode,
			int (*populate)(struct acpi_gsi_descriptor *,
					u32, unsigned int));

where:
- model is the value assigned to acpi_irq_model
- fwnode is the identifier for the irqdomain mapping
  GSI interrupts
- populate is a function provided by the interrupt controller,
  populating a struct acpi_gsi_descriptor based on a GSI and
  the interrupt trigger information

As nobody calls this code yet, the current code is left in place.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/acpi/gsi.c   | 32 ++++++++++++++++++++++++++++++++
 include/linux/acpi.h |  5 +++++
 2 files changed, 37 insertions(+)

diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
index 6232d55..7905840 100644
--- a/drivers/acpi/gsi.c
+++ b/drivers/acpi/gsi.c
@@ -17,6 +17,9 @@ enum acpi_irq_model_id acpi_irq_model;
 
 static struct device_node *acpi_gsi_domain_id;
 
+static int (*acpi_gsi_descriptor_populate)(struct acpi_gsi_descriptor *data,
+					   u32 gsi, unsigned int irq_type);
+
 static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity)
 {
 	switch (polarity) {
@@ -72,10 +75,20 @@ EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 int acpi_register_gsi(struct device *dev, u32 gsi, int trigger,
 		      int polarity)
 {
+	int err;
 	unsigned int irq;
 	unsigned int irq_type = acpi_gsi_get_irq_type(trigger, polarity);
 	struct irq_domain *d = irq_find_host(acpi_gsi_domain_id);
 
+	if (acpi_gsi_descriptor_populate) {
+		struct acpi_gsi_descriptor data;
+		err = acpi_gsi_descriptor_populate(&data, gsi, irq_type);
+		if (err)
+			return err;
+
+		return irq_create_acpi_mapping(d, &data);
+	}
+
 	irq = irq_create_mapping(d, gsi);
 	if (!irq)
 		return -EINVAL;
@@ -100,3 +113,22 @@ void acpi_unregister_gsi(u32 gsi)
 	irq_dispose_mapping(irq);
 }
 EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
+
+/**
+ * acpi_set_irq_model - Setup the GSI irqdomain information
+ * @model: the value assigned to acpi_irq_model
+ * @fwnode: the irq_domain identifier for mapping and looking up
+ *          GSI interrupts
+ * @populate: provided by the interrupt controller, populating a
+ *            struct acpi_gsi_descriptor based on a GSI and
+ *            the interrupt trigger information
+ */
+void __init acpi_set_irq_model(enum acpi_irq_model_id model,
+			       struct fwnode_handle *fwnode,
+			       int (*populate)(struct acpi_gsi_descriptor *,
+					       u32, unsigned int))
+{
+	acpi_irq_model = model;
+	acpi_gsi_domain_id = to_of_node(fwnode);
+	acpi_gsi_descriptor_populate = populate;
+}
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4db2f01..1423b21 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -210,6 +210,11 @@ struct acpi_gsi_descriptor {
 unsigned int irq_create_acpi_mapping(struct irq_domain *d,
 				     struct acpi_gsi_descriptor *irq_data);
 
+void acpi_set_irq_model(enum acpi_irq_model_id model,
+			struct fwnode_handle *fwnode,
+			int (*populate)(struct acpi_gsi_descriptor *,
+					u32, unsigned int));
+
 #ifdef CONFIG_X86_IO_APIC
 extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
 #else
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235415

FromMarc Zyngier <marc.zyngier@arm.com>
Date2015-09-29 19:20 +0200
Message-ID<qe6Jk-4tk-3@gated-at.bofh.it>
In reply to#1234293
On 29/09/15 18:11, Rob Herring wrote:
> On Mon, Sep 28, 2015 at 11:42 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
>> The irqdomain code is not entierely ACPI friendly, as it has some
>> built-in knowledge of the device-tree. Nothing too harmful, but enough
>> to scare the ARM ACPI developpers which end up with their own version
>> of the square wheel.
>>
>> This small patch series adapts the irqdomain code to remove the
>> hurdles that prevent the full blown irqdomain subsystem to be used on
>> ACPI, creates an interface between the GSI layer and the irqdomain,
>> and as an example, convert the ARM GIC ACPI support to use irqdomains
>> as originally intended.
>>
>> Overall, this gives us a way to use irqdomains on both DT and ACPI
>> enabled platforms, having very little changes made to the actual
>> drivers (other than the probing infrastructure). Because we keep the
>> flow of information between the various layers identical between ACPI
>> and DT, we immediately benefit from the existing infrastructure. The
>> "convert the GSI information to be DT friendly" is admitedly not very
>> pretty, but I see it as a stepping stone towards unifying the two
>> structures.
> 
> Did I miss v1-v3 or did the DT change just show up? I probably tuned
> out with ACPI in the subject.

No, that's new. It was far worse before.

> Needing fake DT nodes for ACPI is just wrong. There's got to be
> another, better way.

Well, the alternative is to rewrite the whole of irqdomain and
everything that gets called from there in terms of fwnode_handle. Which
will trickle in the whole of OF as well.

Note that the fake DT node doesn't represent an ACPI object at all. It
is an identifier for an irqdomain, and that's where it stops.

	M.
-- 
Jazz is not dead. It just smells funny...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1235416

FromRob Herring <robherring2@gmail.com>
Date2015-09-29 19:20 +0200
Message-ID<qe6Jk-4tk-5@gated-at.bofh.it>
In reply to#1234293
On Mon, Sep 28, 2015 at 11:42 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> The irqdomain code is not entierely ACPI friendly, as it has some
> built-in knowledge of the device-tree. Nothing too harmful, but enough
> to scare the ARM ACPI developpers which end up with their own version
> of the square wheel.
>
> This small patch series adapts the irqdomain code to remove the
> hurdles that prevent the full blown irqdomain subsystem to be used on
> ACPI, creates an interface between the GSI layer and the irqdomain,
> and as an example, convert the ARM GIC ACPI support to use irqdomains
> as originally intended.
>
> Overall, this gives us a way to use irqdomains on both DT and ACPI
> enabled platforms, having very little changes made to the actual
> drivers (other than the probing infrastructure). Because we keep the
> flow of information between the various layers identical between ACPI
> and DT, we immediately benefit from the existing infrastructure. The
> "convert the GSI information to be DT friendly" is admitedly not very
> pretty, but I see it as a stepping stone towards unifying the two
> structures.

Did I miss v1-v3 or did the DT change just show up? I probably tuned
out with ACPI in the subject.

Needing fake DT nodes for ACPI is just wrong. There's got to be
another, better way.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web