Provide a paravirtualized way to get the CPU clock frequency; this allows much of the code in tsc.c to be shared between all paravirt implementations.
Subject: Add a CPU KHZ calibration function to paravirt-ops Signed-off-by: Zachary Amsden <[EMAIL PROTECTED]> diff -r a08f195aa92a arch/i386/kernel/vmi.c --- a/arch/i386/kernel/vmi.c Fri Feb 02 16:30:59 2007 -0800 +++ b/arch/i386/kernel/vmi.c Fri Feb 02 16:31:45 2007 -0800 @@ -881,6 +881,7 @@ static int __init activate_vmi(void) paravirt_ops.setup_secondary_clock = vmi_timer_setup_secondary_alarm; #endif paravirt_ops.get_scheduled_cycles = vmi_get_sched_cycles; + paravirt_ops.get_cpu_khz = vmi_cpu_khz; } /* diff -r a08f195aa92a arch/i386/kernel/vmitime.c --- a/arch/i386/kernel/vmitime.c Fri Feb 02 16:30:59 2007 -0800 +++ b/arch/i386/kernel/vmitime.c Fri Feb 02 16:30:59 2007 -0800 @@ -175,6 +175,15 @@ unsigned long long vmi_get_sched_cycles( return read_available_cycles(); } +unsigned long vmi_cpu_khz(void) +{ + unsigned long long khz; + + khz = vmi_timer_ops.get_cycle_frequency(); + (void)do_div(khz, 1000); + return khz; +} + void __init vmi_time_init(void) { unsigned long long cycles_per_sec, cycles_per_msec; @@ -204,7 +213,6 @@ void __init vmi_time_init(void) (void)do_div(cycles_per_alarm, alarm_hz); cycles_per_msec = cycles_per_sec; (void)do_div(cycles_per_msec, 1000); - cpu_khz = cycles_per_msec; printk(KERN_WARNING "VMI timer cycles/sec = %llu ; cycles/jiffy = %llu ;" "cycles/alarm = %llu\n", cycles_per_sec, cycles_per_jiffy, diff -r a08f195aa92a include/asm-i386/vmi_time.h --- a/include/asm-i386/vmi_time.h Fri Feb 02 16:30:59 2007 -0800 +++ b/include/asm-i386/vmi_time.h Fri Feb 02 16:31:24 2007 -0800 @@ -50,6 +50,7 @@ extern unsigned long vmi_get_wallclock(v extern unsigned long vmi_get_wallclock(void); extern int vmi_set_wallclock(unsigned long now); extern unsigned long long vmi_get_sched_cycles(void); +extern unsigned long vmi_cpu_khz(void); #ifdef CONFIG_X86_LOCAL_APIC extern void __init vmi_timer_setup_boot_alarm(void); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/