Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, ioapic: Consolidate gsi routing info into 'struct ioapic'

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: daniel.blueman@gmail.com
Link: http://lkml.kernel.org/r/20110518233157.994002011@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Suresh Siddha and committed by
Ingo Molnar
c040aaeb d5371430

+29 -14
+1
arch/x86/include/asm/io_apic.h
··· 108 108 109 109 extern int mpc_ioapic_id(int ioapic); 110 110 extern unsigned int mpc_ioapic_addr(int ioapic); 111 + extern struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic); 111 112 112 113 #define MP_MAX_IOAPIC_PIN 127 113 114
+25 -13
arch/x86/kernel/apic/io_apic.c
··· 87 87 struct IO_APIC_route_entry *saved_registers; 88 88 /* I/O APIC config */ 89 89 struct mpc_ioapic mp_config; 90 + /* IO APIC gsi routing info */ 91 + struct mp_ioapic_gsi gsi_config; 90 92 } ioapics[MAX_IO_APICS]; 91 93 92 94 #define mpc_ioapic_ver(id) ioapics[id].mp_config.apicver ··· 103 101 return ioapics[id].mp_config.apicaddr; 104 102 } 105 103 106 - int nr_ioapics; 104 + struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int id) 105 + { 106 + return &ioapics[id].gsi_config; 107 + } 107 108 108 - /* IO APIC gsi routing info */ 109 - struct mp_ioapic_gsi mp_gsi_routing[MAX_IO_APICS]; 109 + int nr_ioapics; 110 110 111 111 /* The one past the highest gsi number used */ 112 112 u32 gsi_top; ··· 928 924 { 929 925 int irq; 930 926 int bus = mp_irqs[idx].srcbus; 927 + struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(apic); 931 928 932 929 /* 933 930 * Debugging check, we are in big trouble if this message pops up! ··· 939 934 if (test_bit(bus, mp_bus_not_pci)) { 940 935 irq = mp_irqs[idx].srcbusirq; 941 936 } else { 942 - u32 gsi = mp_gsi_routing[apic].gsi_base + pin; 937 + u32 gsi = gsi_cfg->gsi_base + pin; 943 938 944 939 if (gsi >= NR_IRQS_LEGACY) 945 940 irq = gsi; ··· 3903 3898 3904 3899 /* Find the IOAPIC that manages this GSI. */ 3905 3900 for (i = 0; i < nr_ioapics; i++) { 3906 - if ((gsi >= mp_gsi_routing[i].gsi_base) 3907 - && (gsi <= mp_gsi_routing[i].gsi_end)) 3901 + struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(i); 3902 + if ((gsi >= gsi_cfg->gsi_base) 3903 + && (gsi <= gsi_cfg->gsi_end)) 3908 3904 return i; 3909 3905 } 3910 3906 ··· 3915 3909 3916 3910 int mp_find_ioapic_pin(int ioapic, u32 gsi) 3917 3911 { 3912 + struct mp_ioapic_gsi *gsi_cfg; 3913 + 3918 3914 if (WARN_ON(ioapic == -1)) 3919 3915 return -1; 3920 - if (WARN_ON(gsi > mp_gsi_routing[ioapic].gsi_end)) 3916 + 3917 + gsi_cfg = mp_ioapic_gsi_routing(ioapic); 3918 + if (WARN_ON(gsi > gsi_cfg->gsi_end)) 3921 3919 return -1; 3922 3920 3923 - return gsi - mp_gsi_routing[ioapic].gsi_base; 3921 + return gsi - gsi_cfg->gsi_base; 3924 3922 } 3925 3923 3926 3924 static __init int bad_ioapic(unsigned long address) ··· 3946 3936 { 3947 3937 int idx = 0; 3948 3938 int entries; 3939 + struct mp_ioapic_gsi *gsi_cfg; 3949 3940 3950 3941 if (bad_ioapic(address)) 3951 3942 return; ··· 3966 3955 * and to prevent reprogramming of IOAPIC pins (PCI GSIs). 3967 3956 */ 3968 3957 entries = io_apic_get_redir_entries(idx); 3969 - mp_gsi_routing[idx].gsi_base = gsi_base; 3970 - mp_gsi_routing[idx].gsi_end = gsi_base + entries - 1; 3958 + gsi_cfg = mp_ioapic_gsi_routing(idx); 3959 + gsi_cfg->gsi_base = gsi_base; 3960 + gsi_cfg->gsi_end = gsi_base + entries - 1; 3971 3961 3972 3962 /* 3973 3963 * The number of IO-APIC IRQ registers (== #pins): 3974 3964 */ 3975 3965 ioapics[idx].nr_registers = entries; 3976 3966 3977 - if (mp_gsi_routing[idx].gsi_end >= gsi_top) 3978 - gsi_top = mp_gsi_routing[idx].gsi_end + 1; 3967 + if (gsi_cfg->gsi_end >= gsi_top) 3968 + gsi_top = gsi_cfg->gsi_end + 1; 3979 3969 3980 3970 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 3981 3971 "GSI %d-%d\n", idx, mpc_ioapic_id(idx), 3982 3972 mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), 3983 - mp_gsi_routing[idx].gsi_base, mp_gsi_routing[idx].gsi_end); 3973 + gsi_cfg->gsi_base, gsi_cfg->gsi_end); 3984 3974 3985 3975 nr_ioapics++; 3986 3976 }
+3 -1
arch/x86/kernel/devicetree.c
··· 369 369 static int ioapic_xlate(struct irq_domain *id, const u32 *intspec, u32 intsize, 370 370 u32 *out_hwirq, u32 *out_type) 371 371 { 372 + struct mp_ioapic_gsi *gsi_cfg; 372 373 struct io_apic_irq_attr attr; 373 374 struct of_ioapic_type *it; 374 375 u32 line, idx, type; ··· 379 378 380 379 line = *intspec; 381 380 idx = (u32) id->priv; 382 - *out_hwirq = line + mp_gsi_routing[idx].gsi_base; 381 + gsi_cfg = mp_ioapic_gsi_routing(idx); 382 + *out_hwirq = line + gsi_cfg->gsi_base; 383 383 384 384 intspec++; 385 385 type = *intspec;