diff options
Diffstat (limited to 'arch/x86/kernel/kvmclock.c')
-rw-r--r-- | arch/x86/kernel/kvmclock.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 0732f0089a3d..d2c381280e3c 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -160,8 +160,12 @@ int kvm_register_clock(char *txt) | |||
160 | { | 160 | { |
161 | int cpu = smp_processor_id(); | 161 | int cpu = smp_processor_id(); |
162 | int low, high, ret; | 162 | int low, high, ret; |
163 | struct pvclock_vcpu_time_info *src = &hv_clock[cpu].pvti; | 163 | struct pvclock_vcpu_time_info *src; |
164 | |||
165 | if (!hv_clock) | ||
166 | return 0; | ||
164 | 167 | ||
168 | src = &hv_clock[cpu].pvti; | ||
165 | low = (int)slow_virt_to_phys(src) | 1; | 169 | low = (int)slow_virt_to_phys(src) | 1; |
166 | high = ((u64)slow_virt_to_phys(src) >> 32); | 170 | high = ((u64)slow_virt_to_phys(src) >> 32); |
167 | ret = native_write_msr_safe(msr_kvm_system_time, low, high); | 171 | ret = native_write_msr_safe(msr_kvm_system_time, low, high); |
@@ -276,6 +280,9 @@ int __init kvm_setup_vsyscall_timeinfo(void) | |||
276 | struct pvclock_vcpu_time_info *vcpu_time; | 280 | struct pvclock_vcpu_time_info *vcpu_time; |
277 | unsigned int size; | 281 | unsigned int size; |
278 | 282 | ||
283 | if (!hv_clock) | ||
284 | return 0; | ||
285 | |||
279 | size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); | 286 | size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS); |
280 | 287 | ||
281 | preempt_disable(); | 288 | preempt_disable(); |