irqchip / ACPI: Add probing infrastructure for ACPI-based irqchips
authorMarc Zyngier <Marc.Zyngier@arm.com>
Mon, 28 Sep 2015 14:49:13 +0000 (15:49 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 1 Oct 2015 00:18:38 +0000 (02:18 +0200)
DT enjoys a rather nice probing infrastructure for irqchips, while
ACPI is so far stuck into a very distant past.

This patch introduces a declarative API, allowing irqchips to be
self-contained and be called when a particular entry is matched
in the MADT table.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
arch/arm64/include/asm/irq.h
drivers/irqchip/irqchip.c
include/asm-generic/vmlinux.lds.h
include/linux/acpi_irq.h [deleted file]
include/linux/irqchip.h

index bbb251b14746cb7005d1be35d50fdfb453464870..1a1037a32f5c0ef0b7979a57c8bd8b3919190aa2 100644 (file)
@@ -10,15 +10,4 @@ struct pt_regs;
 extern void migrate_irqs(void);
 extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
 
-static inline void acpi_irq_init(void)
-{
-       /*
-        * Hardcode ACPI IRQ chip initialization to GICv2 for now.
-        * Proper irqchip infrastructure will be implemented along with
-        * incoming  GICv2m|GICv3|ITS bits.
-        */
-       acpi_gic_init();
-}
-#define acpi_irq_init acpi_irq_init
-
 #endif
index afd1af3dfe5a231692cd0904c5b5a18e5c3f8245..1ee773e98f5f91d55403da89beae1b8809da7ecd 100644 (file)
@@ -8,7 +8,7 @@
  * warranty of any kind, whether express or implied.
  */
 
-#include <linux/acpi_irq.h>
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/of_irq.h>
 #include <linux/irqchip.h>
@@ -27,6 +27,8 @@ extern struct of_device_id __irqchip_of_table[];
 void __init irqchip_init(void)
 {
        of_irq_init(__irqchip_of_table);
-
-       acpi_irq_init();
+#if defined(CONFIG_ARM64) && defined(CONFIG_ACPI)
+       acpi_gic_init();        /* Temporary hack */
+#endif
+       acpi_probe_device_table(irqchip);
 }
index efd7ed1eafae5e35e5c0ee9505d1986c30d9c8a7..cd836cd1ea2489eb489000fa9e66e1a3c2c82158 100644 (file)
        CPUIDLE_METHOD_OF_TABLES()                                      \
        KERNEL_DTB()                                                    \
        IRQCHIP_OF_MATCH_TABLE()                                        \
+       ACPI_PROBE_TABLE(irqchip)                                       \
        EARLYCON_TABLE()                                                \
        EARLYCON_OF_TABLES()
 
diff --git a/include/linux/acpi_irq.h b/include/linux/acpi_irq.h
deleted file mode 100644 (file)
index f10c872..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _LINUX_ACPI_IRQ_H
-#define _LINUX_ACPI_IRQ_H
-
-#include <linux/irq.h>
-
-#ifndef acpi_irq_init
-static inline void acpi_irq_init(void) { }
-#endif
-
-#endif /* _LINUX_ACPI_IRQ_H */
index 638887376e582c83531ea663269ddfc1ef625a42..89c34b20067122f732073df0b3234dfab2a7fa48 100644 (file)
@@ -11,6 +11,7 @@
 #ifndef _LINUX_IRQCHIP_H
 #define _LINUX_IRQCHIP_H
 
+#include <linux/acpi.h>
 #include <linux/of.h>
 
 /*
  */
 #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
 
+/*
+ * This macro must be used by the different irqchip drivers to declare
+ * the association between their version and their initialization function.
+ *
+ * @name: name that must be unique accross all IRQCHIP_ACPI_DECLARE of the
+ * same file.
+ * @subtable: Subtable to be identified in MADT
+ * @validate: Function to be called on that subtable to check its validity.
+ *            Can be NULL.
+ * @data: data to be checked by the validate function.
+ * @fn: initialization function
+ */
+#define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn)       \
+       ACPI_DECLARE_PROBE_ENTRY(irqchip, name, ACPI_SIG_MADT,          \
+                                subtable, validate, data, fn)
+
 #ifdef CONFIG_IRQCHIP
 void irqchip_init(void);
 #else