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))) {
                ret = kvm_vgic_map_resources(kvm);
                if (ret)
                        return ret;
-       } else {
-               /*
-                * Tell the rest of the code that there are userspace irqchip
-                * VMs in the wild.
-                */
-               static_branch_inc(&userspace_irqchip_in_use);
        }
 
        ret = kvm_timer_enable(vcpu);
                return ret;
 
        ret = kvm_arm_pmu_v3_enable(vcpu);
+       if (ret)
+               return ret;
+
+       if (!irqchip_in_kernel(kvm)) {
+               /*
+                * Tell the rest of the code that there are userspace irqchip
+                * VMs in the wild.
+                */
+               static_branch_inc(&userspace_irqchip_in_use);
+       }
+
+       vcpu->arch.has_run_once = true;
 
        /*
         * Initialize traps for protected VMs.