aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/kernel/apic.c73
1 files changed, 30 insertions, 43 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 4ba5a693c011..900ff38d68de 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -92,8 +92,9 @@ unsigned int safe_apic_wait_icr_idle(void)
92void enable_NMI_through_LVT0 (void * dummy) 92void enable_NMI_through_LVT0 (void * dummy)
93{ 93{
94 unsigned int v; 94 unsigned int v;
95 95
96 v = APIC_DM_NMI; /* unmask and set to NMI */ 96 /* unmask and set to NMI */
97 v = APIC_DM_NMI;
97 apic_write(APIC_LVT0, v); 98 apic_write(APIC_LVT0, v);
98} 99}
99 100
@@ -120,7 +121,7 @@ void ack_bad_irq(unsigned int irq)
120 * holds up an irq slot - in excessive cases (when multiple 121 * holds up an irq slot - in excessive cases (when multiple
121 * unexpected vectors occur) that might lock up the APIC 122 * unexpected vectors occur) that might lock up the APIC
122 * completely. 123 * completely.
123 * But don't ack when the APIC is disabled. -AK 124 * But don't ack when the APIC is disabled. -AK
124 */ 125 */
125 if (!disable_apic) 126 if (!disable_apic)
126 ack_APIC_irq(); 127 ack_APIC_irq();
@@ -616,7 +617,7 @@ early_param("apic", apic_set_verbosity);
616 * Detect and enable local APICs on non-SMP boards. 617 * Detect and enable local APICs on non-SMP boards.
617 * Original code written by Keir Fraser. 618 * Original code written by Keir Fraser.
618 * On AMD64 we trust the BIOS - if it says no APIC it is likely 619 * On AMD64 we trust the BIOS - if it says no APIC it is likely
619 * not correctly set up (usually the APIC timer won't work etc.) 620 * not correctly set up (usually the APIC timer won't work etc.)
620 */ 621 */
621 622
622static int __init detect_init_APIC (void) 623static int __init detect_init_APIC (void)
@@ -789,13 +790,13 @@ static void setup_APIC_timer(unsigned int clocks)
789 local_irq_save(flags); 790 local_irq_save(flags);
790 791
791 /* wait for irq slice */ 792 /* wait for irq slice */
792 if (hpet_address && hpet_use_timer) { 793 if (hpet_address && hpet_use_timer) {
793 int trigger = hpet_readl(HPET_T0_CMP); 794 int trigger = hpet_readl(HPET_T0_CMP);
794 while (hpet_readl(HPET_COUNTER) >= trigger) 795 while (hpet_readl(HPET_COUNTER) >= trigger)
795 /* do nothing */ ; 796 /* do nothing */ ;
796 while (hpet_readl(HPET_COUNTER) < trigger) 797 while (hpet_readl(HPET_COUNTER) < trigger)
797 /* do nothing */ ; 798 /* do nothing */ ;
798 } else { 799 } else {
799 int c1, c2; 800 int c1, c2;
800 outb_p(0x00, 0x43); 801 outb_p(0x00, 0x43);
801 c2 = inb_p(0x40); 802 c2 = inb_p(0x40);
@@ -881,10 +882,10 @@ static unsigned int calibration_result;
881 882
882void __init setup_boot_APIC_clock (void) 883void __init setup_boot_APIC_clock (void)
883{ 884{
884 if (disable_apic_timer) { 885 if (disable_apic_timer) {
885 printk(KERN_INFO "Disabling APIC timer\n"); 886 printk(KERN_INFO "Disabling APIC timer\n");
886 return; 887 return;
887 } 888 }
888 889
889 printk(KERN_INFO "Using local APIC timer interrupts.\n"); 890 printk(KERN_INFO "Using local APIC timer interrupts.\n");
890 using_apic_timer = 1; 891 using_apic_timer = 1;
@@ -1128,20 +1129,6 @@ asmlinkage void smp_spurious_interrupt(void)
1128 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) 1129 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
1129 ack_APIC_irq(); 1130 ack_APIC_irq();
1130 1131
1131#if 0
1132 static unsigned long last_warning;
1133 static unsigned long skipped;
1134
1135 /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1136 if (time_before(last_warning+30*HZ,jiffies)) {
1137 printk(KERN_INFO "spurious APIC interrupt on CPU#%d, %ld skipped.\n",
1138 smp_processor_id(), skipped);
1139 last_warning = jiffies;
1140 skipped = 0;
1141 } else {
1142 skipped++;
1143 }
1144#endif
1145 irq_exit(); 1132 irq_exit();
1146} 1133}
1147 1134
@@ -1173,11 +1160,11 @@ asmlinkage void smp_error_interrupt(void)
1173 7: Illegal register address 1160 7: Illegal register address
1174 */ 1161 */
1175 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", 1162 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
1176 smp_processor_id(), v , v1); 1163 smp_processor_id(), v , v1);
1177 irq_exit(); 1164 irq_exit();
1178} 1165}
1179 1166
1180int disable_apic; 1167int disable_apic;
1181 1168
1182/* 1169/*
1183 * This initializes the IO-APIC and APIC hardware if this is 1170 * This initializes the IO-APIC and APIC hardware if this is
@@ -1185,11 +1172,11 @@ int disable_apic;
1185 */ 1172 */
1186int __init APIC_init_uniprocessor (void) 1173int __init APIC_init_uniprocessor (void)
1187{ 1174{
1188 if (disable_apic) { 1175 if (disable_apic) {
1189 printk(KERN_INFO "Apic disabled\n"); 1176 printk(KERN_INFO "Apic disabled\n");
1190 return -1; 1177 return -1;
1191 } 1178 }
1192 if (!cpu_has_apic) { 1179 if (!cpu_has_apic) {
1193 disable_apic = 1; 1180 disable_apic = 1;
1194 printk(KERN_INFO "Apic disabled by BIOS\n"); 1181 printk(KERN_INFO "Apic disabled by BIOS\n");
1195 return -1; 1182 return -1;
@@ -1211,8 +1198,8 @@ int __init APIC_init_uniprocessor (void)
1211 return 0; 1198 return 0;
1212} 1199}
1213 1200
1214static __init int setup_disableapic(char *str) 1201static __init int setup_disableapic(char *str)
1215{ 1202{
1216 disable_apic = 1; 1203 disable_apic = 1;
1217 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 1204 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
1218 return 0; 1205 return 0;
@@ -1220,10 +1207,10 @@ static __init int setup_disableapic(char *str)
1220early_param("disableapic", setup_disableapic); 1207early_param("disableapic", setup_disableapic);
1221 1208
1222/* same as disableapic, for compatibility */ 1209/* same as disableapic, for compatibility */
1223static __init int setup_nolapic(char *str) 1210static __init int setup_nolapic(char *str)
1224{ 1211{
1225 return setup_disableapic(str); 1212 return setup_disableapic(str);
1226} 1213}
1227early_param("nolapic", setup_nolapic); 1214early_param("nolapic", setup_nolapic);
1228 1215
1229static int __init parse_lapic_timer_c2_ok(char *arg) 1216static int __init parse_lapic_timer_c2_ok(char *arg)
@@ -1233,13 +1220,13 @@ static int __init parse_lapic_timer_c2_ok(char *arg)
1233} 1220}
1234early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); 1221early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1235 1222
1236static __init int setup_noapictimer(char *str) 1223static __init int setup_noapictimer(char *str)
1237{ 1224{
1238 if (str[0] != ' ' && str[0] != 0) 1225 if (str[0] != ' ' && str[0] != 0)
1239 return 0; 1226 return 0;
1240 disable_apic_timer = 1; 1227 disable_apic_timer = 1;
1241 return 1; 1228 return 1;
1242} 1229}
1243 1230
1244static __init int setup_apicmaintimer(char *str) 1231static __init int setup_apicmaintimer(char *str)
1245{ 1232{
@@ -1264,5 +1251,5 @@ static __init int setup_apicpmtimer(char *s)
1264} 1251}
1265__setup("apicpmtimer", setup_apicpmtimer); 1252__setup("apicpmtimer", setup_apicpmtimer);
1266 1253
1267__setup("noapictimer", setup_noapictimer); 1254__setup("noapictimer", setup_noapictimer);
1268 1255