aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:36 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:54 -0400
commitefa2559f65167989f1893cb065e3126d4f13ba60 (patch)
tree5682fd57b093f1514af837820a8210bc512bbeba
parent8ea5371baa82db452a8d93e9977b418d30944e32 (diff)
x86: order variables in io_apic_xx.c
move first_system_vector to apic_64.c. also add #ifdef CONFIG_INTR_REMAP to prepare 32 bit to use same file. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic_64.c5
-rw-r--r--arch/x86/kernel/io_apic_32.c79
-rw-r--r--arch/x86/kernel/io_apic_64.c160
3 files changed, 127 insertions, 117 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 94ddb69ae15e..4d7a188025b3 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -33,6 +33,7 @@
33#include <asm/smp.h> 33#include <asm/smp.h>
34#include <asm/mtrr.h> 34#include <asm/mtrr.h>
35#include <asm/mpspec.h> 35#include <asm/mpspec.h>
36#include <asm/desc.h>
36#include <asm/hpet.h> 37#include <asm/hpet.h>
37#include <asm/pgalloc.h> 38#include <asm/pgalloc.h>
38#include <asm/nmi.h> 39#include <asm/nmi.h>
@@ -59,6 +60,10 @@ int x2apic_preenabled;
59int local_apic_timer_c2_ok; 60int local_apic_timer_c2_ok;
60EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 61EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
61 62
63int first_system_vector = 0xfe;
64
65char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
66
62/* 67/*
63 * Debug level, exported for io_apic.c 68 * Debug level, exported for io_apic.c
64 */ 69 */
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 9531ef33362b..3010bdd3352d 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -54,25 +54,23 @@
54 54
55#define __apicdebuginit(type) static type __init 55#define __apicdebuginit(type) static type __init
56 56
57int (*ioapic_renumber_irq)(int ioapic, int irq);
58atomic_t irq_mis_count;
59
60/* Where if anywhere is the i8259 connect in external int mode */
61static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
62
63static DEFINE_SPINLOCK(ioapic_lock);
64static DEFINE_SPINLOCK(vector_lock);
65
66int timer_through_8259 __initdata;
67
68/* 57/*
69 * Is the SiS APIC rmw bug present ? 58 * Is the SiS APIC rmw bug present ?
70 * -1 = don't know, 0 = no, 1 = yes 59 * -1 = don't know, 0 = no, 1 = yes
71 */ 60 */
72int sis_apic_bug = -1; 61int sis_apic_bug = -1;
73 62
63static DEFINE_SPINLOCK(ioapic_lock);
64static DEFINE_SPINLOCK(vector_lock);
65
74int first_free_entry; 66int first_free_entry;
75/* 67/*
68 * Rough estimation of how many shared IRQs there are, can
69 * be changed anytime.
70 */
71int pin_map_size;
72
73/*
76 * # of IRQ routing registers 74 * # of IRQ routing registers
77 */ 75 */
78int nr_ioapic_registers[MAX_IO_APICS]; 76int nr_ioapic_registers[MAX_IO_APICS];
@@ -93,7 +91,15 @@ int mp_bus_id_to_type[MAX_MP_BUSSES];
93 91
94DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); 92DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
95 93
96static int disable_timer_pin_1 __initdata; 94int skip_ioapic_setup;
95
96static int __init parse_noapic(char *arg)
97{
98 /* disable IO-APIC */
99 disable_ioapic_setup();
100 return 0;
101}
102early_param("noapic", parse_noapic);
97 103
98struct irq_cfg; 104struct irq_cfg;
99struct irq_pin_list; 105struct irq_pin_list;
@@ -268,13 +274,6 @@ static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
268 return cfg; 274 return cfg;
269} 275}
270 276
271static int assign_irq_vector(int irq, cpumask_t mask);
272/*
273 * Rough estimation of how many shared IRQs there are, can
274 * be changed anytime.
275 */
276int pin_map_size;
277
278/* 277/*
279 * This is performance-critical, we want to do it O(1) 278 * This is performance-critical, we want to do it O(1)
280 * 279 *
@@ -465,6 +464,9 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
465 entry = entry->next; 464 entry = entry->next;
466 } 465 }
467} 466}
467
468static int assign_irq_vector(int irq, cpumask_t mask);
469
468static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) 470static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
469{ 471{
470 struct irq_cfg *cfg; 472 struct irq_cfg *cfg;
@@ -677,7 +679,6 @@ void send_IPI_self(int vector)
677#define MAX_PIRQS 8 679#define MAX_PIRQS 8
678static int pirq_entries [MAX_PIRQS]; 680static int pirq_entries [MAX_PIRQS];
679static int pirqs_enabled; 681static int pirqs_enabled;
680int skip_ioapic_setup;
681 682
682static int __init ioapic_pirq_setup(char *str) 683static int __init ioapic_pirq_setup(char *str)
683{ 684{
@@ -981,6 +982,7 @@ static inline int irq_trigger(int idx)
981 return MPBIOS_trigger(idx); 982 return MPBIOS_trigger(idx);
982} 983}
983 984
985int (*ioapic_renumber_irq)(int ioapic, int irq);
984static int pin_2_irq(int idx, int apic, int pin) 986static int pin_2_irq(int idx, int apic, int pin)
985{ 987{
986 int irq, i; 988 int irq, i;
@@ -1621,6 +1623,9 @@ __apicdebuginit(int) print_all_ICs(void)
1621fs_initcall(print_all_ICs); 1623fs_initcall(print_all_ICs);
1622 1624
1623 1625
1626/* Where if anywhere is the i8259 connect in external int mode */
1627static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
1628
1624static void __init enable_IO_APIC(void) 1629static void __init enable_IO_APIC(void)
1625{ 1630{
1626 union IO_APIC_reg_01 reg_01; 1631 union IO_APIC_reg_01 reg_01;
@@ -1998,6 +2003,7 @@ static void ack_apic_edge(unsigned int irq)
1998 ack_APIC_irq(); 2003 ack_APIC_irq();
1999} 2004}
2000 2005
2006atomic_t irq_mis_count;
2001static void ack_apic_level(unsigned int irq) 2007static void ack_apic_level(unsigned int irq)
2002{ 2008{
2003 unsigned long v; 2009 unsigned long v;
@@ -2208,6 +2214,17 @@ static inline void __init unlock_ExtINT_logic(void)
2208 ioapic_write_entry(apic, pin, entry0); 2214 ioapic_write_entry(apic, pin, entry0);
2209} 2215}
2210 2216
2217static int disable_timer_pin_1 __initdata;
2218
2219static int __init parse_disable_timer_pin_1(char *arg)
2220{
2221 disable_timer_pin_1 = 1;
2222 return 0;
2223}
2224early_param("disable_timer_pin_1", parse_disable_timer_pin_1);
2225
2226int timer_through_8259 __initdata;
2227
2211/* 2228/*
2212 * This code may look a bit paranoid, but it's supposed to cooperate with 2229 * This code may look a bit paranoid, but it's supposed to cooperate with
2213 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 2230 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -2983,28 +3000,6 @@ void __init setup_ioapic_dest(void)
2983} 3000}
2984#endif 3001#endif
2985 3002
2986static int __init parse_disable_timer_pin_1(char *arg)
2987{
2988 disable_timer_pin_1 = 1;
2989 return 0;
2990}
2991early_param("disable_timer_pin_1", parse_disable_timer_pin_1);
2992
2993static int __init parse_enable_timer_pin_1(char *arg)
2994{
2995 disable_timer_pin_1 = -1;
2996 return 0;
2997}
2998early_param("enable_timer_pin_1", parse_enable_timer_pin_1);
2999
3000static int __init parse_noapic(char *arg)
3001{
3002 /* disable IO-APIC */
3003 disable_ioapic_setup();
3004 return 0;
3005}
3006early_param("noapic", parse_noapic);
3007
3008void __init ioapic_init_mappings(void) 3003void __init ioapic_init_mappings(void)
3009{ 3004{
3010 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; 3005 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 07e1e45ee026..847aa7987645 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -57,6 +57,47 @@
57 57
58#define __apicdebuginit(type) static type __init 58#define __apicdebuginit(type) static type __init
59 59
60int ioapic_force;
61
62int sis_apic_bug; /* not actually supported, dummy for compile */
63
64static DEFINE_SPINLOCK(ioapic_lock);
65static DEFINE_SPINLOCK(vector_lock);
66
67int first_free_entry;
68/*
69 * Rough estimation of how many shared IRQs there are, can
70 * be changed anytime.
71 */
72int pin_map_size;
73
74/*
75 * # of IRQ routing registers
76 */
77int nr_ioapic_registers[MAX_IO_APICS];
78
79/* I/O APIC entries */
80struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
81int nr_ioapics;
82
83/* MP IRQ source entries */
84struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
85
86/* # of MP IRQ source entries */
87int mp_irq_entries;
88
89DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
90
91int skip_ioapic_setup;
92
93static int __init parse_noapic(char *str)
94{
95 disable_ioapic_setup();
96 return 0;
97}
98early_param("noapic", parse_noapic);
99
100
60struct irq_cfg; 101struct irq_cfg;
61struct irq_pin_list; 102struct irq_pin_list;
62struct irq_cfg { 103struct irq_cfg {
@@ -228,53 +269,6 @@ static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
228 return cfg; 269 return cfg;
229} 270}
230 271
231static int assign_irq_vector(int irq, cpumask_t mask);
232
233int first_system_vector = 0xfe;
234
235char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
236
237int sis_apic_bug; /* not actually supported, dummy for compile */
238
239static int no_timer_check;
240
241static int disable_timer_pin_1 __initdata;
242
243int timer_through_8259 __initdata;
244
245/* Where if anywhere is the i8259 connect in external int mode */
246static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
247
248static DEFINE_SPINLOCK(ioapic_lock);
249static DEFINE_SPINLOCK(vector_lock);
250
251/*
252 * # of IRQ routing registers
253 */
254int nr_ioapic_registers[MAX_IO_APICS];
255
256/* I/O APIC RTE contents at the OS boot up */
257struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS];
258
259/* I/O APIC entries */
260struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
261int nr_ioapics;
262
263/* MP IRQ source entries */
264struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
265
266/* # of MP IRQ source entries */
267int mp_irq_entries;
268
269DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
270
271/*
272 * Rough estimation of how many shared IRQs there are, can
273 * be changed anytime.
274 */
275
276int pin_map_size;
277
278/* 272/*
279 * This is performance-critical, we want to do it O(1) 273 * This is performance-critical, we want to do it O(1)
280 * 274 *
@@ -481,12 +475,16 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
481 475
482 apic = entry->apic; 476 apic = entry->apic;
483 pin = entry->pin; 477 pin = entry->pin;
478#ifdef CONFIG_INTR_REMAP
484 /* 479 /*
485 * With interrupt-remapping, destination information comes 480 * With interrupt-remapping, destination information comes
486 * from interrupt-remapping table entry. 481 * from interrupt-remapping table entry.
487 */ 482 */
488 if (!irq_remapped(irq)) 483 if (!irq_remapped(irq))
489 io_apic_write(apic, 0x11 + pin*2, dest); 484 io_apic_write(apic, 0x11 + pin*2, dest);
485#else
486 io_apic_write(apic, 0x11 + pin*2, dest);
487#endif
490 reg = io_apic_read(apic, 0x10 + pin*2); 488 reg = io_apic_read(apic, 0x10 + pin*2);
491 reg &= ~IO_APIC_REDIR_VECTOR_MASK; 489 reg &= ~IO_APIC_REDIR_VECTOR_MASK;
492 reg |= vector; 490 reg |= vector;
@@ -497,6 +495,8 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector)
497 } 495 }
498} 496}
499 497
498static int assign_irq_vector(int irq, cpumask_t mask);
499
500static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) 500static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
501{ 501{
502 struct irq_cfg *cfg = irq_cfg(irq); 502 struct irq_cfg *cfg = irq_cfg(irq);
@@ -533,7 +533,6 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
533 * shared ISA-space IRQs, so we have to support them. We are super 533 * shared ISA-space IRQs, so we have to support them. We are super
534 * fast in the common case, and fast for shared ISA-space IRQs. 534 * fast in the common case, and fast for shared ISA-space IRQs.
535 */ 535 */
536int first_free_entry;
537static void add_pin_to_irq(unsigned int irq, int apic, int pin) 536static void add_pin_to_irq(unsigned int irq, int apic, int pin)
538{ 537{
539 struct irq_cfg *cfg; 538 struct irq_cfg *cfg;
@@ -679,6 +678,10 @@ static void clear_IO_APIC (void)
679 clear_IO_APIC_pin(apic, pin); 678 clear_IO_APIC_pin(apic, pin);
680} 679}
681 680
681#ifdef CONFIG_INTR_REMAP
682/* I/O APIC RTE contents at the OS boot up */
683static struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS];
684
682/* 685/*
683 * Saves and masks all the unmasked IO-APIC RTE's 686 * Saves and masks all the unmasked IO-APIC RTE's
684 */ 687 */
@@ -741,25 +744,7 @@ void reinit_intr_remapped_IO_APIC(int intr_remapping)
741 */ 744 */
742 restore_IO_APIC_setup(); 745 restore_IO_APIC_setup();
743} 746}
744 747#endif
745int skip_ioapic_setup;
746int ioapic_force;
747
748static int __init parse_noapic(char *str)
749{
750 disable_ioapic_setup();
751 return 0;
752}
753early_param("noapic", parse_noapic);
754
755/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
756static int __init disable_timer_pin_setup(char *arg)
757{
758 disable_timer_pin_1 = 1;
759 return 1;
760}
761__setup("disable_timer_pin_1", disable_timer_pin_setup);
762
763 748
764/* 749/*
765 * Find the IRQ entry number of a certain pin. 750 * Find the IRQ entry number of a certain pin.
@@ -1327,8 +1312,10 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin,
1327{ 1312{
1328 struct IO_APIC_route_entry entry; 1313 struct IO_APIC_route_entry entry;
1329 1314
1315#ifdef CONFIG_INTR_REMAP
1330 if (intr_remapping_enabled) 1316 if (intr_remapping_enabled)
1331 return; 1317 return;
1318#endif
1332 1319
1333 memset(&entry, 0, sizeof(entry)); 1320 memset(&entry, 0, sizeof(entry));
1334 1321
@@ -1601,6 +1588,9 @@ __apicdebuginit(int) print_all_ICs(void)
1601fs_initcall(print_all_ICs); 1588fs_initcall(print_all_ICs);
1602 1589
1603 1590
1591/* Where if anywhere is the i8259 connect in external int mode */
1592static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
1593
1604void __init enable_IO_APIC(void) 1594void __init enable_IO_APIC(void)
1605{ 1595{
1606 union IO_APIC_reg_01 reg_01; 1596 union IO_APIC_reg_01 reg_01;
@@ -1695,6 +1685,15 @@ void disable_IO_APIC(void)
1695 disconnect_bsp_APIC(ioapic_i8259.pin != -1); 1685 disconnect_bsp_APIC(ioapic_i8259.pin != -1);
1696} 1686}
1697 1687
1688static int no_timer_check;
1689
1690static int __init notimercheck(char *s)
1691{
1692 no_timer_check = 1;
1693 return 1;
1694}
1695__setup("no_timer_check", notimercheck);
1696
1698/* 1697/*
1699 * There is a nasty bug in some older SMP boards, their mptable lies 1698 * There is a nasty bug in some older SMP boards, their mptable lies
1700 * about the timer IRQ. We do the following to work around the situation: 1699 * about the timer IRQ. We do the following to work around the situation:
@@ -1708,6 +1707,9 @@ static int __init timer_irq_works(void)
1708 unsigned long t1 = jiffies; 1707 unsigned long t1 = jiffies;
1709 unsigned long flags; 1708 unsigned long flags;
1710 1709
1710 if (no_timer_check)
1711 return 1;
1712
1711 local_save_flags(flags); 1713 local_save_flags(flags);
1712 local_irq_enable(); 1714 local_irq_enable();
1713 /* Let ten ticks pass... */ 1715 /* Let ten ticks pass... */
@@ -2239,6 +2241,17 @@ static inline void __init unlock_ExtINT_logic(void)
2239 ioapic_write_entry(apic, pin, entry0); 2241 ioapic_write_entry(apic, pin, entry0);
2240} 2242}
2241 2243
2244static int disable_timer_pin_1 __initdata;
2245/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
2246static int __init disable_timer_pin_setup(char *arg)
2247{
2248 disable_timer_pin_1 = 1;
2249 return 0;
2250}
2251early_param("disable_timer_pin_1", disable_timer_pin_setup);
2252
2253int timer_through_8259 __initdata;
2254
2242/* 2255/*
2243 * This code may look a bit paranoid, but it's supposed to cooperate with 2256 * This code may look a bit paranoid, but it's supposed to cooperate with
2244 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 2257 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -2286,8 +2299,10 @@ static inline void __init check_timer(void)
2286 * 8259A. 2299 * 8259A.
2287 */ 2300 */
2288 if (pin1 == -1) { 2301 if (pin1 == -1) {
2302#ifdef CONFIG_INTR_REMAP
2289 if (intr_remapping_enabled) 2303 if (intr_remapping_enabled)
2290 panic("BIOS bug: timer not connected to IO-APIC"); 2304 panic("BIOS bug: timer not connected to IO-APIC");
2305#endif
2291 pin1 = pin2; 2306 pin1 = pin2;
2292 apic1 = apic2; 2307 apic1 = apic2;
2293 no_pin1 = 1; 2308 no_pin1 = 1;
@@ -2305,7 +2320,7 @@ static inline void __init check_timer(void)
2305 setup_timer_IRQ0_pin(apic1, pin1, cfg->vector); 2320 setup_timer_IRQ0_pin(apic1, pin1, cfg->vector);
2306 } 2321 }
2307 unmask_IO_APIC_irq(0); 2322 unmask_IO_APIC_irq(0);
2308 if (!no_timer_check && timer_irq_works()) { 2323 if (timer_irq_works()) {
2309 if (nmi_watchdog == NMI_IO_APIC) { 2324 if (nmi_watchdog == NMI_IO_APIC) {
2310 setup_nmi(); 2325 setup_nmi();
2311 enable_8259A_irq(0); 2326 enable_8259A_irq(0);
@@ -2314,8 +2329,10 @@ static inline void __init check_timer(void)
2314 clear_IO_APIC_pin(0, pin1); 2329 clear_IO_APIC_pin(0, pin1);
2315 goto out; 2330 goto out;
2316 } 2331 }
2332#ifdef CONFIG_INTR_REMAP
2317 if (intr_remapping_enabled) 2333 if (intr_remapping_enabled)
2318 panic("timer doesn't work through Interrupt-remapped IO-APIC"); 2334 panic("timer doesn't work through Interrupt-remapped IO-APIC");
2335#endif
2319 clear_IO_APIC_pin(apic1, pin1); 2336 clear_IO_APIC_pin(apic1, pin1);
2320 if (!no_pin1) 2337 if (!no_pin1)
2321 apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " 2338 apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: "
@@ -2391,13 +2408,6 @@ out:
2391 local_irq_restore(flags); 2408 local_irq_restore(flags);
2392} 2409}
2393 2410
2394static int __init notimercheck(char *s)
2395{
2396 no_timer_check = 1;
2397 return 1;
2398}
2399__setup("no_timer_check", notimercheck);
2400
2401/* 2411/*
2402 * Traditionally ISA IRQ2 is the cascade IRQ, and is not available 2412 * Traditionally ISA IRQ2 is the cascade IRQ, and is not available
2403 * to devices. However there may be an I/O APIC pin available for 2413 * to devices. However there may be an I/O APIC pin available for