arm/arm64: KVM: arch_timer: Initialize cntvoff at kvm_init
authorChristoffer Dall <christoffer.dall@linaro.org>
Sat, 16 Nov 2013 18:51:25 +0000 (10:51 -0800)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:18:23 +0000 (17:18 +0200)
Initialize the cntvoff at kvm_init_vm time, not before running the VCPUs
at the first time because that will overwrite any potentially restored
values from user space.

Cc: Andre Przywara <andre.przywara@linaro.org>
Acked-by: Marc Zynger <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
(cherry picked from commit a1a64387adeeba7a34ce06f2774e81f496ee803b)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arch/arm/kvm/arm.c
virt/kvm/arm/vgic.c

index bb43b8cc1231a09a1244a223a8a9937f54c6cf46..71ad3a8706d9223c6d0222be40a54fb7f33750a8 100644 (file)
@@ -138,6 +138,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
        if (ret)
                goto out_free_stage2_pgd;
 
+       kvm_timer_init(kvm);
+
        /* Mark the initial VMID generation invalid */
        kvm->arch.vmid_gen = 0;
 
index 685fc72fc751fae3f898c9de4d194365521ea5a0..81e9481184a779234b85c9523a8293006ece9fcc 100644 (file)
@@ -1409,7 +1409,6 @@ int kvm_vgic_init(struct kvm *kvm)
        for (i = VGIC_NR_PRIVATE_IRQS; i < VGIC_NR_IRQS; i += 4)
                vgic_set_target_reg(kvm, 0, i);
 
-       kvm_timer_init(kvm);
        kvm->arch.vgic.ready = true;
 out:
        mutex_unlock(&kvm->lock);