aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-10-27 01:21:47 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-12-16 08:08:15 -0500
commite89900c9ad75a1b80e1f1f46ce9c9bb0e7ea1d96 (patch)
tree34711ca047dd11efbf4dd06cb0cc995822dbe03f
parent15516a3b8633a32f03a82a2db23b87cf9600514c (diff)
x86, irq: Introduce helper to check whether an IOAPIC has been registered
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>
-rw-r--r--arch/x86/include/asm/io_apic.h1
-rw-r--r--arch/x86/kernel/acpi/boot.c22
-rw-r--r--arch/x86/kernel/apic/io_apic.c11
-rw-r--r--include/linux/acpi.h1
4 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index ce63cf34c93c..0db2b7037e4b 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -191,6 +191,7 @@ extern void mp_unmap_irq(int irq);
191extern int mp_register_ioapic(int id, u32 address, u32 gsi_base, 191extern int mp_register_ioapic(int id, u32 address, u32 gsi_base,
192 struct ioapic_domain_cfg *cfg); 192 struct ioapic_domain_cfg *cfg);
193extern int mp_unregister_ioapic(u32 gsi_base); 193extern int mp_unregister_ioapic(u32 gsi_base);
194extern int mp_ioapic_registered(u32 gsi_base);
194extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, 195extern int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
195 irq_hw_number_t hwirq); 196 irq_hw_number_t hwirq);
196extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq); 197extern void mp_irqdomain_unmap(struct irq_domain *domain, unsigned int virq);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 5427d9b70f75..ddddaed91872 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -826,6 +826,28 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
826} 826}
827EXPORT_SYMBOL(acpi_unregister_ioapic); 827EXPORT_SYMBOL(acpi_unregister_ioapic);
828 828
829/**
830 * acpi_ioapic_registered - Check whether IOAPIC assoicatied with @gsi_base
831 * has been registered
832 * @handle: ACPI handle of the IOAPIC deivce
833 * @gsi_base: GSI base associated with the IOAPIC
834 *
835 * Assume caller holds some type of lock to serialize acpi_ioapic_registered()
836 * with acpi_register_ioapic()/acpi_unregister_ioapic().
837 */
838int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)
839{
840 int ret = 0;
841
842#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
843 mutex_lock(&acpi_ioapic_lock);
844 ret = mp_ioapic_registered(gsi_base);
845 mutex_unlock(&acpi_ioapic_lock);
846#endif
847
848 return ret;
849}
850
829static int __init acpi_parse_sbf(struct acpi_table_header *table) 851static int __init acpi_parse_sbf(struct acpi_table_header *table)
830{ 852{
831 struct acpi_table_boot *sb; 853 struct acpi_table_boot *sb;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 06a0a6ce6750..1cedf410096e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -4026,6 +4026,17 @@ int mp_unregister_ioapic(u32 gsi_base)
4026 return 0; 4026 return 0;
4027} 4027}
4028 4028
4029int mp_ioapic_registered(u32 gsi_base)
4030{
4031 int ioapic;
4032
4033 for_each_ioapic(ioapic)
4034 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base)
4035 return 1;
4036
4037 return 0;
4038}
4039
4029int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq, 4040int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
4030 irq_hw_number_t hwirq) 4041 irq_hw_number_t hwirq)
4031{ 4042{
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 407a12f663eb..a81dd437a53c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -148,6 +148,7 @@ int acpi_unmap_lsapic(int cpu);
148 148
149int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); 149int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
150int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); 150int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
151int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);
151void acpi_irq_stats_init(void); 152void acpi_irq_stats_init(void);
152extern u32 acpi_irq_handled; 153extern u32 acpi_irq_handled;
153extern u32 acpi_irq_not_handled; 154extern u32 acpi_irq_not_handled;