• Home
  • Raw
  • Download

Lines Matching +full:out +full:- +full:of +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2012,2013 - ARM Ltd
6 * Derived from arch/arm/kvm/reset.c
7 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
37 * ARMv8 Reset Values
65 * Don't even try to make use of vector lengths that in kvm_arm_init_sve()
79 return -EINVAL; in kvm_vcpu_enable_sve()
81 vcpu->arch.sve_max_vl = kvm_sve_max_vl; in kvm_vcpu_enable_sve()
95 * vcpu->arch.sve_state as necessary.
104 vl = vcpu->arch.sve_max_vl; in kvm_vcpu_finalize_sve()
109 * set_sve_vls(). Double-check here just to be sure: in kvm_vcpu_finalize_sve()
113 return -EIO; in kvm_vcpu_finalize_sve()
118 return -ENOMEM; in kvm_vcpu_finalize_sve()
126 vcpu->arch.sve_state = buf; in kvm_vcpu_finalize_sve()
136 return -EINVAL; in kvm_arm_vcpu_finalize()
139 return -EPERM; in kvm_arm_vcpu_finalize()
144 return -EINVAL; in kvm_arm_vcpu_finalize()
157 void *sve_state = vcpu->arch.sve_state; in kvm_arm_vcpu_destroy()
164 kfree(vcpu->arch.ccsidr); in kvm_arm_vcpu_destroy()
170 memset(vcpu->arch.sve_state, 0, vcpu_sve_state_size(vcpu)); in kvm_vcpu_reset_sve()
180 if (!test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || in kvm_vcpu_enable_ptrauth()
181 !test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features) || in kvm_vcpu_enable_ptrauth()
183 return -EINVAL; in kvm_vcpu_enable_ptrauth()
190 * kvm_reset_vcpu - sets core registers and sys_regs to reset value
194 * architecturally defined reset values, except for registers whose reset is
198 * ioctl or as part of handling a request issued by another VCPU in the PSCI
201 * on the memory-backed values of system registers, we want to do a full put if
202 * we were loaded (handling a request) and load the values back at the end of
204 * disable preemption around the vcpu reset as we would otherwise race with
214 spin_lock(&vcpu->arch.mp_state_lock); in kvm_reset_vcpu()
215 reset_state = vcpu->arch.reset_state; in kvm_reset_vcpu()
216 vcpu->arch.reset_state.reset = false; in kvm_reset_vcpu()
217 spin_unlock(&vcpu->arch.mp_state_lock); in kvm_reset_vcpu()
219 /* Reset PMU outside of the non-preemptible section */ in kvm_reset_vcpu()
223 loaded = (vcpu->cpu != -1); in kvm_reset_vcpu()
229 ret = -EINVAL; in kvm_reset_vcpu()
230 goto out; in kvm_reset_vcpu()
234 if (test_bit(KVM_ARM_VCPU_SVE, vcpu->arch.features)) { in kvm_reset_vcpu()
237 goto out; in kvm_reset_vcpu()
243 if (test_bit(KVM_ARM_VCPU_PTRAUTH_ADDRESS, vcpu->arch.features) || in kvm_reset_vcpu()
244 test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, vcpu->arch.features)) { in kvm_reset_vcpu()
246 ret = -EINVAL; in kvm_reset_vcpu()
247 goto out; in kvm_reset_vcpu()
259 ret = -EINVAL; in kvm_reset_vcpu()
260 goto out; in kvm_reset_vcpu()
263 /* Reset core registers */ in kvm_reset_vcpu()
265 memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs)); in kvm_reset_vcpu()
266 vcpu->arch.ctxt.spsr_abt = 0; in kvm_reset_vcpu()
267 vcpu->arch.ctxt.spsr_und = 0; in kvm_reset_vcpu()
268 vcpu->arch.ctxt.spsr_irq = 0; in kvm_reset_vcpu()
269 vcpu->arch.ctxt.spsr_fiq = 0; in kvm_reset_vcpu()
270 vcpu_gp_regs(vcpu)->pstate = pstate; in kvm_reset_vcpu()
272 /* Reset system registers */ in kvm_reset_vcpu()
276 * Additional reset state handling that PSCI may have imposed on us. in kvm_reset_vcpu()
277 * Must be done after all the sys_reg reset. in kvm_reset_vcpu()
279 if (reset_state.reset) { in kvm_reset_vcpu()
296 /* Reset timer */ in kvm_reset_vcpu()
298 out: in kvm_reset_vcpu()
328 * Check with ARMv8.5-GTG that our PAGE_SIZE is supported at in kvm_set_ipa_limit()
329 * Stage-2. If not, things will stop very quickly. in kvm_set_ipa_limit()
333 kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n"); in kvm_set_ipa_limit()
334 return -EINVAL; in kvm_set_ipa_limit()
336 kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n"); in kvm_set_ipa_limit()
339 kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n"); in kvm_set_ipa_limit()
343 return -EINVAL; in kvm_set_ipa_limit()