aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic/io_apic.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-06-09 04:19:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-06-21 17:05:41 -0400
commit79598505aee61bc943955de3653be054c2f7393f (patch)
tree5a389554cd87578589f73dd2cbbe98c5a9f19f35 /arch/x86/kernel/apic/io_apic.c
parent32f5ef5d8dd5ac3cc7ac12cdaf33023e2fbd33c1 (diff)
x86, irq: Reorganize IO_APIC_get_PCI_irq_vector() to prepare for irqdomain
Reorganize function IO_APIC_get_PCI_irq_vector() a bit to better support coming irqdomain. 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> Link: http://lkml.kernel.org/r/1402302011-23642-16-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.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 446a931d5f44..09e5c7b4df5a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -997,7 +997,7 @@ static int pin_2_irq(int idx, int apic, int pin)
997int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, 997int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
998 struct io_apic_irq_attr *irq_attr) 998 struct io_apic_irq_attr *irq_attr)
999{ 999{
1000 int ioapic_idx, i, best_guess = -1; 1000 int irq, i, best_guess = -1;
1001 1001
1002 apic_printk(APIC_DEBUG, 1002 apic_printk(APIC_DEBUG,
1003 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", 1003 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
@@ -1007,41 +1007,46 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
1007 "PCI BIOS passed nonexistent PCI bus %d!\n", bus); 1007 "PCI BIOS passed nonexistent PCI bus %d!\n", bus);
1008 return -1; 1008 return -1;
1009 } 1009 }
1010
1010 for (i = 0; i < mp_irq_entries; i++) { 1011 for (i = 0; i < mp_irq_entries; i++) {
1011 int lbus = mp_irqs[i].srcbus; 1012 int lbus = mp_irqs[i].srcbus;
1013 int ioapic_idx, found = 0;
1014
1015 if (bus != lbus || mp_irqs[i].irqtype != mp_INT ||
1016 slot != ((mp_irqs[i].srcbusirq >> 2) & 0x1f))
1017 continue;
1012 1018
1013 for_each_ioapic(ioapic_idx) 1019 for_each_ioapic(ioapic_idx)
1014 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic || 1020 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic ||
1015 mp_irqs[i].dstapic == MP_APIC_ALL) 1021 mp_irqs[i].dstapic == MP_APIC_ALL) {
1022 found = 1;
1016 break; 1023 break;
1024 }
1025 if (!found)
1026 continue;
1017 1027
1018 if (!test_bit(lbus, mp_bus_not_pci) && 1028 /* Skip ISA IRQs */
1019 mp_irqs[i].irqtype == mp_INT && 1029 irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1020 (bus == lbus) && 1030 if (ioapic_idx == 0 && !IO_APIC_IRQ(irq))
1021 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { 1031 continue;
1022 int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1023
1024 if (!(ioapic_idx || IO_APIC_IRQ(irq)))
1025 continue;
1026 1032
1027 if (pin == (mp_irqs[i].srcbusirq & 3)) { 1033 if (pin == (mp_irqs[i].srcbusirq & 3)) {
1028 set_io_apic_irq_attr(irq_attr, ioapic_idx, 1034 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1029 mp_irqs[i].dstirq, 1035 mp_irqs[i].dstirq,
1030 irq_trigger(i), 1036 irq_trigger(i),
1031 irq_polarity(i)); 1037 irq_polarity(i));
1032 return irq; 1038 return irq;
1033 } 1039 }
1034 /* 1040 /*
1035 * Use the first all-but-pin matching entry as a 1041 * Use the first all-but-pin matching entry as a
1036 * best-guess fuzzy result for broken mptables. 1042 * best-guess fuzzy result for broken mptables.
1037 */ 1043 */
1038 if (best_guess < 0) { 1044 if (best_guess < 0) {
1039 set_io_apic_irq_attr(irq_attr, ioapic_idx, 1045 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1040 mp_irqs[i].dstirq, 1046 mp_irqs[i].dstirq,
1041 irq_trigger(i), 1047 irq_trigger(i),
1042 irq_polarity(i)); 1048 irq_polarity(i));
1043 best_guess = irq; 1049 best_guess = irq;
1044 }
1045 } 1050 }
1046 } 1051 }
1047 return best_guess; 1052 return best_guess;