Lines Matching refs:vcpu
26 static u32 smccc_get_function(struct kvm_vcpu *vcpu) in smccc_get_function() argument
28 return vcpu_get_reg(vcpu, 0); in smccc_get_function()
31 static unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu) in smccc_get_arg1() argument
33 return vcpu_get_reg(vcpu, 1); in smccc_get_arg1()
36 static unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu) in smccc_get_arg2() argument
38 return vcpu_get_reg(vcpu, 2); in smccc_get_arg2()
41 static unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu) in smccc_get_arg3() argument
43 return vcpu_get_reg(vcpu, 3); in smccc_get_arg3()
46 static void smccc_set_retval(struct kvm_vcpu *vcpu, in smccc_set_retval() argument
52 vcpu_set_reg(vcpu, 0, a0); in smccc_set_retval()
53 vcpu_set_reg(vcpu, 1, a1); in smccc_set_retval()
54 vcpu_set_reg(vcpu, 2, a2); in smccc_set_retval()
55 vcpu_set_reg(vcpu, 3, a3); in smccc_set_retval()
66 static unsigned long kvm_psci_vcpu_suspend(struct kvm_vcpu *vcpu) in kvm_psci_vcpu_suspend() argument
81 kvm_vcpu_block(vcpu); in kvm_psci_vcpu_suspend()
82 kvm_clear_request(KVM_REQ_UNHALT, vcpu); in kvm_psci_vcpu_suspend()
87 static void kvm_psci_vcpu_off(struct kvm_vcpu *vcpu) in kvm_psci_vcpu_off() argument
89 vcpu->arch.power_off = true; in kvm_psci_vcpu_off()
90 kvm_make_request(KVM_REQ_SLEEP, vcpu); in kvm_psci_vcpu_off()
91 kvm_vcpu_kick(vcpu); in kvm_psci_vcpu_off()
98 struct kvm_vcpu *vcpu = NULL; in kvm_psci_vcpu_on() local
105 vcpu = kvm_mpidr_to_vcpu(kvm, cpu_id); in kvm_psci_vcpu_on()
111 if (!vcpu) in kvm_psci_vcpu_on()
113 if (!vcpu->arch.power_off) { in kvm_psci_vcpu_on()
120 reset_state = &vcpu->arch.reset_state; in kvm_psci_vcpu_on()
134 kvm_make_request(KVM_REQ_VCPU_RESET, vcpu); in kvm_psci_vcpu_on()
142 vcpu->arch.power_off = false; in kvm_psci_vcpu_on()
143 kvm_vcpu_wake_up(vcpu); in kvm_psci_vcpu_on()
148 static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) in kvm_psci_vcpu_affinity_info() argument
155 struct kvm *kvm = vcpu->kvm; in kvm_psci_vcpu_affinity_info()
158 target_affinity = smccc_get_arg1(vcpu); in kvm_psci_vcpu_affinity_info()
159 lowest_affinity_level = smccc_get_arg2(vcpu); in kvm_psci_vcpu_affinity_info()
188 static void kvm_prepare_system_event(struct kvm_vcpu *vcpu, u32 type) in kvm_prepare_system_event() argument
202 kvm_for_each_vcpu(i, tmp, vcpu->kvm) in kvm_prepare_system_event()
204 kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP); in kvm_prepare_system_event()
206 memset(&vcpu->run->system_event, 0, sizeof(vcpu->run->system_event)); in kvm_prepare_system_event()
207 vcpu->run->system_event.type = type; in kvm_prepare_system_event()
208 vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT; in kvm_prepare_system_event()
211 static void kvm_psci_system_off(struct kvm_vcpu *vcpu) in kvm_psci_system_off() argument
213 kvm_prepare_system_event(vcpu, KVM_SYSTEM_EVENT_SHUTDOWN); in kvm_psci_system_off()
216 static void kvm_psci_system_reset(struct kvm_vcpu *vcpu) in kvm_psci_system_reset() argument
218 kvm_prepare_system_event(vcpu, KVM_SYSTEM_EVENT_RESET); in kvm_psci_system_reset()
221 static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) in kvm_psci_0_2_call() argument
223 struct kvm *kvm = vcpu->kvm; in kvm_psci_0_2_call()
224 u32 psci_fn = smccc_get_function(vcpu); in kvm_psci_0_2_call()
238 val = kvm_psci_vcpu_suspend(vcpu); in kvm_psci_0_2_call()
241 kvm_psci_vcpu_off(vcpu); in kvm_psci_0_2_call()
247 val = kvm_psci_vcpu_on(vcpu); in kvm_psci_0_2_call()
252 val = kvm_psci_vcpu_affinity_info(vcpu); in kvm_psci_0_2_call()
263 kvm_psci_system_off(vcpu); in kvm_psci_0_2_call()
278 kvm_psci_system_reset(vcpu); in kvm_psci_0_2_call()
291 smccc_set_retval(vcpu, val, 0, 0, 0); in kvm_psci_0_2_call()
295 static int kvm_psci_1_0_call(struct kvm_vcpu *vcpu) in kvm_psci_1_0_call() argument
297 u32 psci_fn = smccc_get_function(vcpu); in kvm_psci_1_0_call()
307 feature = smccc_get_arg1(vcpu); in kvm_psci_1_0_call()
330 return kvm_psci_0_2_call(vcpu); in kvm_psci_1_0_call()
333 smccc_set_retval(vcpu, val, 0, 0, 0); in kvm_psci_1_0_call()
337 static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) in kvm_psci_0_1_call() argument
339 struct kvm *kvm = vcpu->kvm; in kvm_psci_0_1_call()
340 u32 psci_fn = smccc_get_function(vcpu); in kvm_psci_0_1_call()
345 kvm_psci_vcpu_off(vcpu); in kvm_psci_0_1_call()
350 val = kvm_psci_vcpu_on(vcpu); in kvm_psci_0_1_call()
358 smccc_set_retval(vcpu, val, 0, 0, 0); in kvm_psci_0_1_call()
376 static int kvm_psci_call(struct kvm_vcpu *vcpu) in kvm_psci_call() argument
378 switch (kvm_psci_version(vcpu, vcpu->kvm)) { in kvm_psci_call()
380 return kvm_psci_1_0_call(vcpu); in kvm_psci_call()
382 return kvm_psci_0_2_call(vcpu); in kvm_psci_call()
384 return kvm_psci_0_1_call(vcpu); in kvm_psci_call()
390 int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) in kvm_hvc_call_handler() argument
392 u32 func_id = smccc_get_function(vcpu); in kvm_hvc_call_handler()
401 feature = smccc_get_arg1(vcpu); in kvm_hvc_call_handler()
432 return kvm_psci_call(vcpu); in kvm_hvc_call_handler()
435 smccc_set_retval(vcpu, val, 0, 0, 0); in kvm_hvc_call_handler()
439 int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu) in kvm_arm_get_fw_num_regs() argument
444 int kvm_arm_copy_fw_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices) in kvm_arm_copy_fw_reg_indices() argument
496 int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) in kvm_arm_get_fw_reg() argument
503 val = kvm_psci_version(vcpu, vcpu->kvm); in kvm_arm_get_fw_reg()
512 kvm_arm_get_vcpu_workaround_2_flag(vcpu)) in kvm_arm_get_fw_reg()
525 int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) in kvm_arm_set_fw_reg() argument
539 wants_02 = test_bit(KVM_ARM_VCPU_PSCI_0_2, vcpu->arch.features); in kvm_arm_set_fw_reg()
545 vcpu->kvm->arch.psci_version = val; in kvm_arm_set_fw_reg()
551 vcpu->kvm->arch.psci_version = val; in kvm_arm_set_fw_reg()
591 kvm_arm_set_vcpu_workaround_2_flag(vcpu, in kvm_arm_set_fw_reg()
595 kvm_arm_set_vcpu_workaround_2_flag(vcpu, true); in kvm_arm_set_fw_reg()