aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-08-20 09:54:21 -0400
committerThomas Gleixner <tglx@linutronix.de>2009-08-31 03:35:46 -0400
commit64fcbac1f38882d8ae82c44a1c2a676cfa5e79e1 (patch)
treeec1206322a8ca2a775db5ca552d5666b968be77c
parentdd3e6e8c6e7a2294f137c4dbccb3e73e7fa8ba15 (diff)
x86: Simplify timer_ack magic in time_32.c
Let the compiler optimize the timer_ack magic away in the 32bit timer interrupt and put the same code into time_64.c. It's optimized out for CONFIG_X86_IO_APIC on 32bit and for 64bit because timer_ack is const 0 in both cases. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/include/asm/timer.h6
-rw-r--r--arch/x86/kernel/time_32.c5
-rw-r--r--arch/x86/kernel/time_64.c14
3 files changed, 21 insertions, 4 deletions
diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h
index e854c7ab4169..65228ccc5f0d 100644
--- a/arch/x86/include/asm/timer.h
+++ b/arch/x86/include/asm/timer.h
@@ -9,11 +9,13 @@
9 9
10unsigned long long native_sched_clock(void); 10unsigned long long native_sched_clock(void);
11unsigned long native_calibrate_tsc(void); 11unsigned long native_calibrate_tsc(void);
12extern int recalibrate_cpu_khz(void);
12 13
13#ifdef CONFIG_X86_32 14#if defined(CONFIG_X86_32) && defined(CONFIG_X86_IO_APIC)
14extern int timer_ack; 15extern int timer_ack;
16#else
17# define timer_ack (0)
15#endif 18#endif
16extern int recalibrate_cpu_khz(void);
17 19
18extern int no_timer_check; 20extern int no_timer_check;
19 21
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index acbaefd61e8e..7a26bcf887f6 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -23,7 +23,9 @@
23#include <asm/time.h> 23#include <asm/time.h>
24#include <asm/nmi.h> 24#include <asm/nmi.h>
25 25
26#if defined(CONFIG_X86_32) && defined(CONFIG_X86_IO_APIC)
26int timer_ack; 27int timer_ack;
28#endif
27 29
28unsigned long profile_pc(struct pt_regs *regs) 30unsigned long profile_pc(struct pt_regs *regs)
29{ 31{
@@ -60,7 +62,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
60 /* Keep nmi watchdog up to date */ 62 /* Keep nmi watchdog up to date */
61 inc_irq_stat(irq0_irqs); 63 inc_irq_stat(irq0_irqs);
62 64
63#ifdef CONFIG_X86_IO_APIC 65 /* Optimized out for !IO_APIC and x86_64 */
64 if (timer_ack) { 66 if (timer_ack) {
65 /* 67 /*
66 * Subtle, when I/O APICs are used we have to ack timer IRQ 68 * Subtle, when I/O APICs are used we have to ack timer IRQ
@@ -73,7 +75,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
73 inb(PIC_MASTER_POLL); 75 inb(PIC_MASTER_POLL);
74 spin_unlock(&i8259A_lock); 76 spin_unlock(&i8259A_lock);
75 } 77 }
76#endif
77 78
78 global_clock_event->event_handler(global_clock_event); 79 global_clock_event->event_handler(global_clock_event);
79 80
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index 45914f8844a7..35e0a925da56 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -51,6 +51,20 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
51{ 51{
52 inc_irq_stat(irq0_irqs); 52 inc_irq_stat(irq0_irqs);
53 53
54 /* Optimized out for !IO_APIC and x86_64 */
55 if (timer_ack) {
56 /*
57 * Subtle, when I/O APICs are used we have to ack timer IRQ
58 * manually to deassert NMI lines for the watchdog if run
59 * on an 82489DX-based system.
60 */
61 spin_lock(&i8259A_lock);
62 outb(0x0c, PIC_MASTER_OCW3);
63 /* Ack the IRQ; AEOI will end it automatically. */
64 inb(PIC_MASTER_POLL);
65 spin_unlock(&i8259A_lock);
66 }
67
54 global_clock_event->event_handler(global_clock_event); 68 global_clock_event->event_handler(global_clock_event);
55 69
56#ifdef CONFIG_MCA 70#ifdef CONFIG_MCA