• Home
  • Raw
  • Download

Lines Matching refs:vcpu

72 static int kvm_vcpu_enable_sve(struct kvm_vcpu *vcpu)  in kvm_vcpu_enable_sve()  argument
77 vcpu->arch.sve_max_vl = kvm_sve_max_vl; in kvm_vcpu_enable_sve()
84 vcpu->arch.flags |= KVM_ARM64_GUEST_HAS_SVE; in kvm_vcpu_enable_sve()
93 static int kvm_vcpu_finalize_sve(struct kvm_vcpu *vcpu) in kvm_vcpu_finalize_sve() argument
98 vl = vcpu->arch.sve_max_vl; in kvm_vcpu_finalize_sve()
113 vcpu->arch.sve_state = buf; in kvm_vcpu_finalize_sve()
114 vcpu->arch.flags |= KVM_ARM64_VCPU_SVE_FINALIZED; in kvm_vcpu_finalize_sve()
118 int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature) in kvm_arm_vcpu_finalize() argument
122 if (!vcpu_has_sve(vcpu)) in kvm_arm_vcpu_finalize()
125 if (kvm_arm_vcpu_sve_finalized(vcpu)) in kvm_arm_vcpu_finalize()
128 return kvm_vcpu_finalize_sve(vcpu); in kvm_arm_vcpu_finalize()
134 bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu) in kvm_arm_vcpu_is_finalized() argument
136 if (vcpu_has_sve(vcpu) && !kvm_arm_vcpu_sve_finalized(vcpu)) in kvm_arm_vcpu_is_finalized()
142 void kvm_arm_vcpu_destroy(struct kvm_vcpu *vcpu) in kvm_arm_vcpu_destroy() argument
144 kfree(vcpu->arch.sve_state); in kvm_arm_vcpu_destroy()
147 static void kvm_vcpu_reset_sve(struct kvm_vcpu *vcpu) in kvm_vcpu_reset_sve() argument
149 if (vcpu_has_sve(vcpu)) in kvm_vcpu_reset_sve()
150 memset(vcpu->arch.sve_state, 0, vcpu_sve_state_size(vcpu)); in kvm_vcpu_reset_sve()
153 static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) in kvm_vcpu_enable_ptrauth() argument
160 if (!test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || in kvm_vcpu_enable_ptrauth()
161 !test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features) || in kvm_vcpu_enable_ptrauth()
165 vcpu->arch.flags |= KVM_ARM64_GUEST_HAS_PTRAUTH; in kvm_vcpu_enable_ptrauth()
169 static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu) in vcpu_allowed_register_width() argument
175 is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT); in vcpu_allowed_register_width()
180 kvm_for_each_vcpu(i, tmp, vcpu->kvm) { in vcpu_allowed_register_width()
207 int kvm_reset_vcpu(struct kvm_vcpu *vcpu) in kvm_reset_vcpu() argument
214 mutex_lock(&vcpu->kvm->lock); in kvm_reset_vcpu()
215 reset_state = vcpu->arch.reset_state; in kvm_reset_vcpu()
216 WRITE_ONCE(vcpu->arch.reset_state.reset, false); in kvm_reset_vcpu()
217 mutex_unlock(&vcpu->kvm->lock); in kvm_reset_vcpu()
220 kvm_pmu_vcpu_reset(vcpu); in kvm_reset_vcpu()
223 loaded = (vcpu->cpu != -1); in kvm_reset_vcpu()
225 kvm_arch_vcpu_put(vcpu); in kvm_reset_vcpu()
227 if (!kvm_arm_vcpu_sve_finalized(vcpu)) { in kvm_reset_vcpu()
228 if (test_bit(KVM_ARM_VCPU_SVE, vcpu->arch.features)) { in kvm_reset_vcpu()
229 ret = kvm_vcpu_enable_sve(vcpu); in kvm_reset_vcpu()
234 kvm_vcpu_reset_sve(vcpu); in kvm_reset_vcpu()
237 if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || in kvm_reset_vcpu()
238 test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) { in kvm_reset_vcpu()
239 if (kvm_vcpu_enable_ptrauth(vcpu)) { in kvm_reset_vcpu()
245 if (!vcpu_allowed_register_width(vcpu)) { in kvm_reset_vcpu()
250 switch (vcpu->arch.target) { in kvm_reset_vcpu()
252 if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { in kvm_reset_vcpu()
258 if (kvm_vcpu_has_pmu(vcpu) && !kvm_arm_support_pmu_v3()) { in kvm_reset_vcpu()
266 memset(vcpu_gp_regs(vcpu), 0, sizeof(*vcpu_gp_regs(vcpu))); in kvm_reset_vcpu()
267 memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs)); in kvm_reset_vcpu()
268 vcpu->arch.ctxt.spsr_abt = 0; in kvm_reset_vcpu()
269 vcpu->arch.ctxt.spsr_und = 0; in kvm_reset_vcpu()
270 vcpu->arch.ctxt.spsr_irq = 0; in kvm_reset_vcpu()
271 vcpu->arch.ctxt.spsr_fiq = 0; in kvm_reset_vcpu()
272 vcpu_gp_regs(vcpu)->pstate = pstate; in kvm_reset_vcpu()
275 kvm_reset_sys_regs(vcpu); in kvm_reset_vcpu()
285 if (vcpu_mode_is_32bit(vcpu) && (target_pc & 1)) { in kvm_reset_vcpu()
287 vcpu_set_thumb(vcpu); in kvm_reset_vcpu()
292 kvm_vcpu_set_be(vcpu); in kvm_reset_vcpu()
294 *vcpu_pc(vcpu) = target_pc; in kvm_reset_vcpu()
295 vcpu_set_reg(vcpu, 0, reset_state.r0); in kvm_reset_vcpu()
299 ret = kvm_timer_vcpu_reset(vcpu); in kvm_reset_vcpu()
302 kvm_arch_vcpu_load(vcpu, smp_processor_id()); in kvm_reset_vcpu()