aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/acpi
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-11-02 01:04:29 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-12-16 08:08:15 -0500
commit5da2fd26193433006255d534b3a01eae37e58428 (patch)
treefcdb10ab31f9290cd53e61d081a829ded689df12 /arch/x86/kernel/acpi
parent35ef9c941c93f72bb49fe01396fc963ab80105bd (diff)
x86, irq, ACPI: Introduce a mutex to protect IOAPIC operations from hotplug
We are going to support ACPI based IOAPIC hotplug, so introduce a mutex to protect IOAPIC data structures from IOAPIC hotplug. We choose to serialize in ACPI instead of in the IOAPIC core because: 1) currently we only plan to support ACPI based IOAPIC hotplug 2) it's much more cleaner and easier 3) It does't affect IOAPIC discovered by devicetree, SFI and mpparse. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> 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: Pavel Machek <pavel@ucw.cz> Link: http://lkml.kernel.org/r/1414908273-7552-15-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/acpi')
-rw-r--r--arch/x86/kernel/acpi/boot.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6ddeba31bd98..2d76f022adc2 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -76,6 +76,19 @@ int acpi_fix_pin2_polarity __initdata;
76static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; 76static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
77#endif 77#endif
78 78
79/*
80 * Locks related to IOAPIC hotplug
81 * Hotplug side:
82 * ->device_hotplug_lock
83 * ->acpi_ioapic_lock
84 * ->ioapic_lock
85 * Interrupt mapping side:
86 * ->acpi_ioapic_lock
87 * ->ioapic_mutex
88 * ->ioapic_lock
89 */
90static DEFINE_MUTEX(acpi_ioapic_lock);
91
79/* -------------------------------------------------------------------------- 92/* --------------------------------------------------------------------------
80 Boot-time Configuration 93 Boot-time Configuration
81 -------------------------------------------------------------------------- */ 94 -------------------------------------------------------------------------- */
@@ -609,8 +622,10 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
609 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 622 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
610 *irqp = gsi; 623 *irqp = gsi;
611 } else { 624 } else {
625 mutex_lock(&acpi_ioapic_lock);
612 irq = mp_map_gsi_to_irq(gsi, 626 irq = mp_map_gsi_to_irq(gsi,
613 IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); 627 IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK);
628 mutex_unlock(&acpi_ioapic_lock);
614 if (irq < 0) 629 if (irq < 0)
615 return -1; 630 return -1;
616 *irqp = irq; 631 *irqp = irq;
@@ -650,7 +665,9 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
650 int irq = gsi; 665 int irq = gsi;
651 666
652#ifdef CONFIG_X86_IO_APIC 667#ifdef CONFIG_X86_IO_APIC
668 mutex_lock(&acpi_ioapic_lock);
653 irq = mp_register_gsi(dev, gsi, trigger, polarity); 669 irq = mp_register_gsi(dev, gsi, trigger, polarity);
670 mutex_unlock(&acpi_ioapic_lock);
654#endif 671#endif
655 672
656 return irq; 673 return irq;
@@ -659,7 +676,9 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
659static void acpi_unregister_gsi_ioapic(u32 gsi) 676static void acpi_unregister_gsi_ioapic(u32 gsi)
660{ 677{
661#ifdef CONFIG_X86_IO_APIC 678#ifdef CONFIG_X86_IO_APIC
679 mutex_lock(&acpi_ioapic_lock);
662 mp_unregister_gsi(gsi); 680 mp_unregister_gsi(gsi);
681 mutex_unlock(&acpi_ioapic_lock);
663#endif 682#endif
664} 683}
665 684
@@ -1187,7 +1206,9 @@ static void __init acpi_process_madt(void)
1187 /* 1206 /*
1188 * Parse MADT IO-APIC entries 1207 * Parse MADT IO-APIC entries
1189 */ 1208 */
1209 mutex_lock(&acpi_ioapic_lock);
1190 error = acpi_parse_madt_ioapic_entries(); 1210 error = acpi_parse_madt_ioapic_entries();
1211 mutex_unlock(&acpi_ioapic_lock);
1191 if (!error) { 1212 if (!error) {
1192 acpi_set_irq_model_ioapic(); 1213 acpi_set_irq_model_ioapic();
1193 1214