x86_64: Provide intermediate timer frequency API
PATCH 1/1 x86_64: Provide intermediate timer frequency API
This patch introduces the intermediate IPIPE_APIC_TIMER_FREQ API, that can be used by I-pipe users to obtain the accurate APIC timer frequency as Linux calibrated it. This API is scheduled to be removed with x86-ipipe for kernel 2.6.24. ipipe_request_tickdev is meant to be used then.
Note that a similar patch can be cooked up for 2.6.20-i386 if desired.
Jan
--- arch/x86_64/kernel/apic.c | 3 +++ arch/x86_64/kernel/ipipe.c | 1 + include/asm-x86_64/ipipe.h | 4 ++++ 3 files changed, 8 insertions(+)
arch/x86_64/kernel/apic.c +3 -0
@@ -872,6 +872,9 @@ static int __init calibrate_APIC_clock(vprintk (KERN_INFO "Detected %d.%03d MHz APIC timer.\n" , result /1000 /1000 , result /1000 %1000 ); +#ifdef CONFIG_IPIPE + __ipipe_apic_timer_freq = result; +#endif return result *APIC_DIVISOR /HZ ; }
arch/x86_64/kernel/ipipe.c +1 -0
@@ -47,6 +47,7 @@ asmlinkage void preempt_schedule_irq(void);int __ipipe_tick_irq;/* =0: 8254 */ +unsigned long __ipipe_apic_timer_freq; DEFINE_PER_CPU(struct pt_regs, __ipipe_tick_regs);
include/asm-x86_64/ipipe.h +4 -0
@@ -84,6 +84,10 @@ extern unsigned cpu_khz;#define ipipe_tsc2ns (t) (((t) * 1000UL) / (ipipe_cpu_freq() / 1000000UL))#define ipipe_tsc2us (t) ((t) / (ipipe_cpu_freq() / 1000000UL)) +/* Intermediat interface, will be removed in 2.6.24 in favour of ipipe_request_tickdev */ +extern unsigned long __ipipe_apic_timer_freq; +#define IPIPE_APIC_TIMER_FREQ __ipipe_apic_timer_freq +/* Private interface -- Internal use only */ #define __ipipe_check_platform () do { } while(0)