@@ -157,12 +157,28 @@ int kvm_register_clock(char *txt)
{
int cpu = smp_processor_id();
int low, high, ret;
-
- low = (int)__pa(&per_cpu(hv_clock, cpu)) | 1;
- high = ((u64)__pa(&per_cpu(hv_clock, cpu)) >> 32);
- ret = native_write_msr_safe(msr_kvm_system_time, low, high);
- printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n",
- cpu, high, low, txt);
+ struct pvclock_vcpu_time_info *vcpu_time;
+ static int warned;
+
+ vcpu_time = &per_cpu(hv_clock, cpu);
+
+ ret = kvm_register_mem_area(__pa(vcpu_time), KVM_AREA_SYSTIME,
+ sizeof(*vcpu_time));
+ if (ret == 0) {
+ printk(KERN_INFO "kvm-clock: cpu %d, mem_area %lx %s\n",
+ cpu, __pa(vcpu_time), txt);
+ } else {
+ low = (int)__pa(vcpu_time) | 1;
+ high = ((u64)__pa(vcpu_time) >> 32);
+ ret = native_write_msr_safe(msr_kvm_system_time, low, high);
+
+ if (!warned++)
+ printk(KERN_INFO "kvm-clock: Using msrs %x and %x",
+ msr_kvm_system_time, msr_kvm_wall_clock);
+
+ printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n",
+ cpu, high, low, txt);
+ }
return ret;
}
@@ -216,9 +232,6 @@ void __init kvmclock_init(void)
} else if (!(kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE)))
return;
- printk(KERN_INFO "kvm-clock: Using msrs %x and %x",
- msr_kvm_system_time, msr_kvm_wall_clock);
-
if (kvm_register_clock("boot clock"))
return;
pv_time_ops.sched_clock = kvm_clock_read;