aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/io_apic.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-06-10 02:13:25 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-06-21 17:05:42 -0400
commit6b9fb7082409cd4a2c7caf43e3c023ad82dad0d4 (patch)
tree0e6fa36575e9b41bde22b2e8414ae0d157105051 /arch/x86/kernel/apic/io_apic.c
parent4b92b4f754939e4ac6bb53355abbe48a5054b573 (diff)
x86, ACPI, irq: Consolidate algorithm of mapping (ioapic, pin) to IRQ number
Currently ACPI and ioapic both implement algorithms to map (ioapic, pin) to IRQ number. So consolidate the common part into one place, which is also preparing for irqdomain support. It introduces mp_map_gsi_to_irq(), which will be used to allocate IRQ number IOAPIC pins when irqdomain is enabled. Also rename gsi_to_irq() to map_gsi_to_irq(), later we will introduce unmap_gsi_to_irq() when enabling IOAPIC hotplug. 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: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Grant Likely <grant.likely@linaro.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: Len Brown <len.brown@intel.com> Cc: Pavel Machek <pavel@ucw.cz> Link: http://lkml.kernel.org/r/1402380812-32446-1-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/apic/io_apic.c')
-rw-r--r--arch/x86/kernel/apic/io_apic.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e25e7e315d4f..7fd9f1befe0b 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -959,11 +959,19 @@ static int irq_trigger(int idx)
959 return trigger; 959 return trigger;
960} 960}
961 961
962int mp_map_gsi_to_irq(u32 gsi)
963{
964 /*
965 * Provide an identity mapping of gsi == irq except on truly weird
966 * platforms that have non isa irqs in the first 16 gsis.
967 */
968 return gsi >= nr_legacy_irqs() ? gsi : gsi_top + gsi;
969}
970
962static int pin_2_irq(int idx, int apic, int pin) 971static int pin_2_irq(int idx, int apic, int pin)
963{ 972{
964 int irq; 973 int irq;
965 int bus = mp_irqs[idx].srcbus; 974 int bus = mp_irqs[idx].srcbus;
966 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(apic);
967 975
968 /* 976 /*
969 * Debugging check, we are in big trouble if this message pops up! 977 * Debugging check, we are in big trouble if this message pops up!
@@ -971,17 +979,6 @@ static int pin_2_irq(int idx, int apic, int pin)
971 if (mp_irqs[idx].dstirq != pin) 979 if (mp_irqs[idx].dstirq != pin)
972 pr_err("broken BIOS or MPTABLE parser, ayiee!!\n"); 980 pr_err("broken BIOS or MPTABLE parser, ayiee!!\n");
973 981
974 if (test_bit(bus, mp_bus_not_pci)) {
975 irq = mp_irqs[idx].srcbusirq;
976 } else {
977 u32 gsi = gsi_cfg->gsi_base + pin;
978
979 if (gsi >= nr_legacy_irqs())
980 irq = gsi;
981 else
982 irq = gsi_top + gsi;
983 }
984
985#ifdef CONFIG_X86_32 982#ifdef CONFIG_X86_32
986 /* 983 /*
987 * PCI IRQ command line redirection. Yes, limits are hardcoded. 984 * PCI IRQ command line redirection. Yes, limits are hardcoded.
@@ -996,11 +993,17 @@ static int pin_2_irq(int idx, int apic, int pin)
996 apic_printk(APIC_VERBOSE, KERN_DEBUG 993 apic_printk(APIC_VERBOSE, KERN_DEBUG
997 "using PIRQ%d -> IRQ %d\n", 994 "using PIRQ%d -> IRQ %d\n",
998 pin-16, irq); 995 pin-16, irq);
996 return irq;
999 } 997 }
1000 } 998 }
1001 } 999 }
1002#endif 1000#endif
1003 1001
1002 if (test_bit(bus, mp_bus_not_pci))
1003 irq = mp_irqs[idx].srcbusirq;
1004 else
1005 irq = mp_map_gsi_to_irq(mp_pin_to_gsi(apic, pin));
1006
1004 return irq; 1007 return irq;
1005} 1008}
1006 1009