diff options
| -rw-r--r-- | arch/x86/kernel/time_32.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/time_64.c | 38 |
2 files changed, 35 insertions, 11 deletions
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c index ec729cdcfa3d..186abc577b2b 100644 --- a/arch/x86/kernel/time_32.c +++ b/arch/x86/kernel/time_32.c | |||
| @@ -27,6 +27,10 @@ | |||
| 27 | int timer_ack; | 27 | int timer_ack; |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_X86_64 | ||
| 31 | volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; | ||
| 32 | #endif | ||
| 33 | |||
| 30 | unsigned long profile_pc(struct pt_regs *regs) | 34 | unsigned long profile_pc(struct pt_regs *regs) |
| 31 | { | 35 | { |
| 32 | unsigned long pc = instruction_pointer(regs); | 36 | unsigned long pc = instruction_pointer(regs); |
| @@ -53,9 +57,7 @@ unsigned long profile_pc(struct pt_regs *regs) | |||
| 53 | EXPORT_SYMBOL(profile_pc); | 57 | EXPORT_SYMBOL(profile_pc); |
| 54 | 58 | ||
| 55 | /* | 59 | /* |
| 56 | * This is the same as the above, except we _also_ save the current | 60 | * Default timer interrupt handler for PIT/HPET |
| 57 | * Time Stamp Counter value at the time of the timer interrupt, so that | ||
| 58 | * we later on can estimate the time of day more exactly. | ||
| 59 | */ | 61 | */ |
| 60 | static irqreturn_t timer_interrupt(int irq, void *dev_id) | 62 | static irqreturn_t timer_interrupt(int irq, void *dev_id) |
| 61 | { | 63 | { |
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c index 7db3912b8692..78cbdf5c006b 100644 --- a/arch/x86/kernel/time_64.c +++ b/arch/x86/kernel/time_64.c | |||
| @@ -23,7 +23,13 @@ | |||
| 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) | ||
| 27 | int timer_ack; | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #ifdef CONFIG_X86_64 | ||
| 26 | volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; | 31 | volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; |
| 32 | #endif | ||
| 27 | 33 | ||
| 28 | unsigned long profile_pc(struct pt_regs *regs) | 34 | unsigned long profile_pc(struct pt_regs *regs) |
| 29 | { | 35 | { |
| @@ -47,8 +53,12 @@ unsigned long profile_pc(struct pt_regs *regs) | |||
| 47 | } | 53 | } |
| 48 | EXPORT_SYMBOL(profile_pc); | 54 | EXPORT_SYMBOL(profile_pc); |
| 49 | 55 | ||
| 56 | /* | ||
| 57 | * Default timer interrupt handler for PIT/HPET | ||
| 58 | */ | ||
| 50 | static irqreturn_t timer_interrupt(int irq, void *dev_id) | 59 | static irqreturn_t timer_interrupt(int irq, void *dev_id) |
| 51 | { | 60 | { |
| 61 | /* Keep nmi watchdog up to date */ | ||
| 52 | inc_irq_stat(irq0_irqs); | 62 | inc_irq_stat(irq0_irqs); |
| 53 | 63 | ||
| 54 | /* Optimized out for !IO_APIC and x86_64 */ | 64 | /* Optimized out for !IO_APIC and x86_64 */ |
| @@ -74,8 +84,10 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) | |||
| 74 | return IRQ_HANDLED; | 84 | return IRQ_HANDLED; |
| 75 | } | 85 | } |
| 76 | 86 | ||
| 77 | /* calibrate_cpu is used on systems with fixed rate TSCs to determine | 87 | /* |
| 78 | * processor frequency */ | 88 | * calibrate_cpu is used on systems with fixed rate TSCs to determine |
| 89 | * processor frequency | ||
| 90 | */ | ||
| 79 | #define TICK_COUNT 100000000 | 91 | #define TICK_COUNT 100000000 |
| 80 | unsigned long __init calibrate_cpu(void) | 92 | unsigned long __init calibrate_cpu(void) |
| 81 | { | 93 | { |
| @@ -122,18 +134,24 @@ unsigned long __init calibrate_cpu(void) | |||
| 122 | return pmc_now * tsc_khz / (tsc_now - tsc_start); | 134 | return pmc_now * tsc_khz / (tsc_now - tsc_start); |
| 123 | } | 135 | } |
| 124 | 136 | ||
| 125 | static struct irqaction irq0 = { | 137 | static struct irqaction irq0 = { |
| 126 | .handler = timer_interrupt, | 138 | .handler = timer_interrupt, |
| 127 | .flags = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER, | 139 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, |
| 128 | .name = "timer" | 140 | .name = "timer" |
| 129 | }; | 141 | }; |
| 130 | 142 | ||
| 143 | void __init setup_default_timer_irq(void) | ||
| 144 | { | ||
| 145 | irq0.mask = cpumask_of_cpu(0); | ||
| 146 | setup_irq(0, &irq0); | ||
| 147 | } | ||
| 148 | |||
| 149 | /* Default timer init function */ | ||
| 131 | void __init hpet_time_init(void) | 150 | void __init hpet_time_init(void) |
| 132 | { | 151 | { |
| 133 | if (!hpet_enable()) | 152 | if (!hpet_enable()) |
| 134 | setup_pit_timer(); | 153 | setup_pit_timer(); |
| 135 | 154 | setup_default_timer_irq(); | |
| 136 | setup_irq(0, &irq0); | ||
| 137 | } | 155 | } |
| 138 | 156 | ||
| 139 | static void x86_late_time_init(void) | 157 | static void x86_late_time_init(void) |
| @@ -141,6 +159,10 @@ static void x86_late_time_init(void) | |||
| 141 | x86_init.timers.timer_init(); | 159 | x86_init.timers.timer_init(); |
| 142 | } | 160 | } |
| 143 | 161 | ||
| 162 | /* | ||
| 163 | * Initialize TSC and delay the periodic timer init to | ||
| 164 | * late x86_late_time_init() so ioremap works. | ||
| 165 | */ | ||
| 144 | void __init time_init(void) | 166 | void __init time_init(void) |
| 145 | { | 167 | { |
| 146 | tsc_init(); | 168 | tsc_init(); |
