]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86, irq: Introduce helper to check whether an IOAPIC has been registered
authorJiang Liu <jiang.liu@linux.intel.com>
Mon, 27 Oct 2014 05:21:47 +0000 (13:21 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 16 Dec 2014 13:08:15 +0000 (14:08 +0100)
Introduce acpi_ioapic_registered() to check whether an IOAPIC has already
been registered, it will be used when enabling IOAPIC hotplug.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Len Brown <len.brown@intel.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Link: http://lkml.kernel.org/r/1414387308-27148-18-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/asm/io_apic.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/apic/io_apic.c
include/linux/acpi.h

index ce63cf34c93c1f70e74e954e1656a3795f7b9fa5..0db2b7037e4b17b8d260820f28610c52f82d952d 100644 (file)
@@ -191,6 +191,7 @@ extern void mp_unmap_irq(int irq);
 extern int mp_register_ioapic(int id, u32 address, u32 gsi_base,
                              struct ioapic_domain_cfg *cfg);
 extern int mp_unregister_ioapic(u32 gsi_base);
+extern int mp_ioapic_registered(u32 gsi_base);
 extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
                            irq_hw_number_t hwirq);
 extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq);
index 5427d9b70f7511dd783a972d5b21032fd1165098..ddddaed91872599c9926c0af5d3f679dad63a12d 100644 (file)
@@ -826,6 +826,28 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
 }
 EXPORT_SYMBOL(acpi_unregister_ioapic);
 
+/**
+ * acpi_ioapic_registered - Check whether IOAPIC assoicatied with @gsi_base
+ *                         has been registered
+ * @handle:    ACPI handle of the IOAPIC deivce
+ * @gsi_base:  GSI base associated with the IOAPIC
+ *
+ * Assume caller holds some type of lock to serialize acpi_ioapic_registered()
+ * with acpi_register_ioapic()/acpi_unregister_ioapic().
+ */
+int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)
+{
+       int ret = 0;
+
+#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
+       mutex_lock(&acpi_ioapic_lock);
+       ret  = mp_ioapic_registered(gsi_base);
+       mutex_unlock(&acpi_ioapic_lock);
+#endif
+
+       return ret;
+}
+
 static int __init acpi_parse_sbf(struct acpi_table_header *table)
 {
        struct acpi_table_boot *sb;
index 06a0a6ce6750222af31f3617e238ab76f68f95e9..1cedf410096e4cf3da0cca881e8e70302a64bd85 100644 (file)
@@ -4026,6 +4026,17 @@ int mp_unregister_ioapic(u32 gsi_base)
        return 0;
 }
 
+int mp_ioapic_registered(u32 gsi_base)
+{
+       int ioapic;
+
+       for_each_ioapic(ioapic)
+               if (ioapics[ioapic].gsi_config.gsi_base == gsi_base)
+                       return 1;
+
+       return 0;
+}
+
 int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
                     irq_hw_number_t hwirq)
 {
index 407a12f663ebdd313c166dcc4f5c892da1453ecf..a81dd437a53c381bb512093794e3ca1abbc358c5 100644 (file)
@@ -148,6 +148,7 @@ int acpi_unmap_lsapic(int cpu);
 
 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
 int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
+int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);
 void acpi_irq_stats_init(void);
 extern u32 acpi_irq_handled;
 extern u32 acpi_irq_not_handled;