[Patch V3 21/37] x86, ACPI, irq: provide basic irqdomain support

From: Jiang Liu
Date: Tue May 27 2014 - 04:09:57 EST


Enhance ACPI driver to provide basic irqdomain support for IOAPIC.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/acpi/boot.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 9525498e41d5..0632622a3798 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -31,6 +31,7 @@
#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/irq.h>
+#include <linux/irqdomain.h>
#include <linux/slab.h>
#include <linux/bootmem.h>
#include <linux/ioport.h>
@@ -324,6 +325,23 @@ static void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
static int mp_register_gsi(struct device *dev, u32 gsi, int trigger,
int polarity);

+static struct irq_domain_ops acpi_irqdomain_ops;
+
+static struct irq_domain *acpi_create_irqdomain(int idx, void *arg)
+{
+ struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(idx);
+
+ /*
+ * Statically allocate IRQ number for legacy IRQs and all pins on the
+ * first IOAPIC.
+ */
+ if (gsi_cfg->gsi_base < NR_IRQS_LEGACY &&
+ ioapic_dynirq_base < gsi_cfg->gsi_end)
+ ioapic_dynirq_base = gsi_cfg->gsi_end + 1;
+
+ return mp_irqdomain_create(idx, NULL, &acpi_irqdomain_ops);
+}
+
static int __init
acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
{
@@ -338,7 +356,7 @@ acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)

mp_register_ioapic(ioapic->id,
ioapic->address, ioapic->global_irq_base,
- NULL, NULL);
+ acpi_create_irqdomain, NULL);

return 0;
}
--
1.7.10.4

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