From b4b11955a20644deda26e36f00dbfbdf9e051c20 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 7 Jul 2022 15:52:11 +0100 Subject: [PATCH] Revert "FROMGIT: KVM: arm64: Restructure the point where has_run_once is advertised" This reverts commit f60ecc8f75283e8372bf750ec4c48ff45fba5127. Bug: 233587962 Signed-off-by: Will Deacon Change-Id: Ife37ffa0d41041ed3e5736d68ec91dcbec3f3bc8 --- arch/arm64/kvm/arm.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 4749b0e0e48f..0efb87949ef1 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -608,6 +608,8 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) if (!kvm_arm_vcpu_is_finalized(vcpu)) return -EPERM; + vcpu->arch.has_run_once = true; + kvm_arm_vcpu_init_debug(vcpu); if (likely(irqchip_in_kernel(kvm))) { @@ -618,17 +620,7 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) ret = kvm_vgic_map_resources(kvm); if (ret) return ret; - } - - ret = kvm_timer_enable(vcpu); - if (ret) - return ret; - - ret = kvm_arm_pmu_v3_enable(vcpu); - if (ret) - return ret; - - if (!irqchip_in_kernel(kvm)) { + } else { /* * Tell the rest of the code that there are userspace irqchip * VMs in the wild. @@ -636,7 +628,11 @@ static int kvm_vcpu_first_run_init(struct kvm_vcpu *vcpu) static_branch_inc(&userspace_irqchip_in_use); } - vcpu->arch.has_run_once = true; + ret = kvm_timer_enable(vcpu); + if (ret) + return ret; + + ret = kvm_arm_pmu_v3_enable(vcpu); /* * Initialize traps for protected VMs.