Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe1140cc authored by Jan Kiszka's avatar Jan Kiszka Committed by Gleb Natapov
Browse files

x86: kvmclock: Do not setup kvmclock vsyscall in the absence of that clock



This fixes boot lockups with "no-kvmclock", when the host is not
exposing this particular feature (QEMU: -cpu ...,-kvmclock) or when
the kvmclock initialization failed for whatever reason.

Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent bd31a7f5
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -160,8 +160,12 @@ int kvm_register_clock(char *txt)
{
	int cpu = smp_processor_id();
	int low, high, ret;
	struct pvclock_vcpu_time_info *src = &hv_clock[cpu].pvti;
	struct pvclock_vcpu_time_info *src;

	if (!hv_clock)
		return 0;

	src = &hv_clock[cpu].pvti;
	low = (int)__pa(src) | 1;
	high = ((u64)__pa(src) >> 32);
	ret = native_write_msr_safe(msr_kvm_system_time, low, high);
@@ -276,6 +280,9 @@ int __init kvm_setup_vsyscall_timeinfo(void)
	struct pvclock_vcpu_time_info *vcpu_time;
	unsigned int size;

	if (!hv_clock)
		return 0;

	size = PAGE_ALIGN(sizeof(struct pvclock_vsyscall_time_info)*NR_CPUS);

	preempt_disable();