Lines Matching full:vcpu

20 static int __sigp_sense(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu,  in __sigp_sense()  argument
39 VCPU_EVENT(vcpu, 4, "sensed status of cpu %x rc %x", dst_vcpu->vcpu_id, in __sigp_sense()
44 static int __inject_sigp_emergency(struct kvm_vcpu *vcpu, in __inject_sigp_emergency() argument
49 .u.emerg.code = vcpu->vcpu_id, in __inject_sigp_emergency()
55 VCPU_EVENT(vcpu, 4, "sent sigp emerg to cpu %x", in __inject_sigp_emergency()
61 static int __sigp_emergency(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu) in __sigp_emergency() argument
63 return __inject_sigp_emergency(vcpu, dst_vcpu); in __sigp_emergency()
66 static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, in __sigp_conditional_emergency() argument
75 idle = is_vcpu_idle(vcpu); in __sigp_conditional_emergency()
81 if (!is_vcpu_stopped(vcpu) in __sigp_conditional_emergency()
85 return __inject_sigp_emergency(vcpu, dst_vcpu); in __sigp_conditional_emergency()
93 static int __sigp_external_call(struct kvm_vcpu *vcpu, in __sigp_external_call() argument
98 .u.extcall.code = vcpu->vcpu_id, in __sigp_external_call()
108 VCPU_EVENT(vcpu, 4, "sent sigp ext call to cpu %x", in __sigp_external_call()
115 static int __sigp_stop(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu) in __sigp_stop() argument
126 VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", in __sigp_stop()
132 static int __sigp_stop_and_store_status(struct kvm_vcpu *vcpu, in __sigp_stop_and_store_status() argument
145 VCPU_EVENT(vcpu, 4, "sent sigp stop and store status to cpu %x", in __sigp_stop_and_store_status()
151 static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter, in __sigp_set_arch() argument
161 static int __sigp_set_prefix(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, in __sigp_set_prefix() argument
175 if (!kvm_is_gpa_in_memslot(vcpu->kvm, irq.u.prefix.address)) { in __sigp_set_prefix()
191 static int __sigp_store_status_at_addr(struct kvm_vcpu *vcpu, in __sigp_store_status_at_addr() argument
213 static int __sigp_sense_running(struct kvm_vcpu *vcpu, in __sigp_sense_running() argument
218 if (!test_kvm_facility(vcpu->kvm, 9)) { in __sigp_sense_running()
234 VCPU_EVENT(vcpu, 4, "sensed running status of cpu %x rc %x", in __sigp_sense_running()
240 static int __prepare_sigp_re_start(struct kvm_vcpu *vcpu, in __prepare_sigp_re_start() argument
256 static int __prepare_sigp_cpu_reset(struct kvm_vcpu *vcpu, in __prepare_sigp_cpu_reset() argument
263 static int __prepare_sigp_unknown(struct kvm_vcpu *vcpu, in __prepare_sigp_unknown() argument
270 static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code, in handle_sigp_dst() argument
274 struct kvm_vcpu *dst_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); in handle_sigp_dst()
281 * are processed asynchronously. Until the affected VCPU finishes in handle_sigp_dst()
285 * This is important because a single VCPU could issue: in handle_sigp_dst()
290 * return an incorrect answer as to whether the VCPU is STOPPED in handle_sigp_dst()
309 vcpu->stat.instruction_sigp_sense++; in handle_sigp_dst()
310 rc = __sigp_sense(vcpu, dst_vcpu, status_reg); in handle_sigp_dst()
313 vcpu->stat.instruction_sigp_external_call++; in handle_sigp_dst()
314 rc = __sigp_external_call(vcpu, dst_vcpu, status_reg); in handle_sigp_dst()
317 vcpu->stat.instruction_sigp_emergency++; in handle_sigp_dst()
318 rc = __sigp_emergency(vcpu, dst_vcpu); in handle_sigp_dst()
321 vcpu->stat.instruction_sigp_stop++; in handle_sigp_dst()
322 rc = __sigp_stop(vcpu, dst_vcpu); in handle_sigp_dst()
325 vcpu->stat.instruction_sigp_stop_store_status++; in handle_sigp_dst()
326 rc = __sigp_stop_and_store_status(vcpu, dst_vcpu, status_reg); in handle_sigp_dst()
329 vcpu->stat.instruction_sigp_store_status++; in handle_sigp_dst()
330 rc = __sigp_store_status_at_addr(vcpu, dst_vcpu, parameter, in handle_sigp_dst()
334 vcpu->stat.instruction_sigp_prefix++; in handle_sigp_dst()
335 rc = __sigp_set_prefix(vcpu, dst_vcpu, parameter, status_reg); in handle_sigp_dst()
338 vcpu->stat.instruction_sigp_cond_emergency++; in handle_sigp_dst()
339 rc = __sigp_conditional_emergency(vcpu, dst_vcpu, parameter, in handle_sigp_dst()
343 vcpu->stat.instruction_sigp_sense_running++; in handle_sigp_dst()
344 rc = __sigp_sense_running(vcpu, dst_vcpu, status_reg); in handle_sigp_dst()
347 vcpu->stat.instruction_sigp_start++; in handle_sigp_dst()
348 rc = __prepare_sigp_re_start(vcpu, dst_vcpu, order_code); in handle_sigp_dst()
351 vcpu->stat.instruction_sigp_restart++; in handle_sigp_dst()
352 rc = __prepare_sigp_re_start(vcpu, dst_vcpu, order_code); in handle_sigp_dst()
355 vcpu->stat.instruction_sigp_init_cpu_reset++; in handle_sigp_dst()
356 rc = __prepare_sigp_cpu_reset(vcpu, dst_vcpu, order_code); in handle_sigp_dst()
359 vcpu->stat.instruction_sigp_cpu_reset++; in handle_sigp_dst()
360 rc = __prepare_sigp_cpu_reset(vcpu, dst_vcpu, order_code); in handle_sigp_dst()
363 vcpu->stat.instruction_sigp_unknown++; in handle_sigp_dst()
364 rc = __prepare_sigp_unknown(vcpu, dst_vcpu); in handle_sigp_dst()
368 VCPU_EVENT(vcpu, 4, in handle_sigp_dst()
375 static int handle_sigp_order_in_user_space(struct kvm_vcpu *vcpu, u8 order_code, in handle_sigp_order_in_user_space() argument
378 if (!vcpu->kvm->arch.user_sigp) in handle_sigp_order_in_user_space()
390 vcpu->stat.instruction_sigp_stop++; in handle_sigp_order_in_user_space()
393 vcpu->stat.instruction_sigp_stop_store_status++; in handle_sigp_order_in_user_space()
396 vcpu->stat.instruction_sigp_store_status++; in handle_sigp_order_in_user_space()
399 vcpu->stat.instruction_sigp_store_adtl_status++; in handle_sigp_order_in_user_space()
402 vcpu->stat.instruction_sigp_prefix++; in handle_sigp_order_in_user_space()
405 vcpu->stat.instruction_sigp_start++; in handle_sigp_order_in_user_space()
408 vcpu->stat.instruction_sigp_restart++; in handle_sigp_order_in_user_space()
411 vcpu->stat.instruction_sigp_init_cpu_reset++; in handle_sigp_order_in_user_space()
414 vcpu->stat.instruction_sigp_cpu_reset++; in handle_sigp_order_in_user_space()
417 vcpu->stat.instruction_sigp_unknown++; in handle_sigp_order_in_user_space()
419 VCPU_EVENT(vcpu, 3, "SIGP: order %u for CPU %d handled in userspace", in handle_sigp_order_in_user_space()
425 int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) in kvm_s390_handle_sigp() argument
427 int r1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; in kvm_s390_handle_sigp()
428 int r3 = vcpu->arch.sie_block->ipa & 0x000f; in kvm_s390_handle_sigp()
430 u16 cpu_addr = vcpu->run->s.regs.gprs[r3]; in kvm_s390_handle_sigp()
435 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in kvm_s390_handle_sigp()
436 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in kvm_s390_handle_sigp()
438 order_code = kvm_s390_get_base_disp_rs(vcpu, NULL); in kvm_s390_handle_sigp()
439 if (handle_sigp_order_in_user_space(vcpu, order_code, cpu_addr)) in kvm_s390_handle_sigp()
443 parameter = vcpu->run->s.regs.gprs[r1]; in kvm_s390_handle_sigp()
445 parameter = vcpu->run->s.regs.gprs[r1 + 1]; in kvm_s390_handle_sigp()
447 trace_kvm_s390_handle_sigp(vcpu, order_code, cpu_addr, parameter); in kvm_s390_handle_sigp()
450 vcpu->stat.instruction_sigp_arch++; in kvm_s390_handle_sigp()
451 rc = __sigp_set_arch(vcpu, parameter, in kvm_s390_handle_sigp()
452 &vcpu->run->s.regs.gprs[r1]); in kvm_s390_handle_sigp()
455 rc = handle_sigp_dst(vcpu, order_code, cpu_addr, in kvm_s390_handle_sigp()
457 &vcpu->run->s.regs.gprs[r1]); in kvm_s390_handle_sigp()
463 kvm_s390_set_psw_cc(vcpu, rc); in kvm_s390_handle_sigp()
476 int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu) in kvm_s390_handle_sigp_pei() argument
478 int r3 = vcpu->arch.sie_block->ipa & 0x000f; in kvm_s390_handle_sigp_pei()
479 u16 cpu_addr = vcpu->run->s.regs.gprs[r3]; in kvm_s390_handle_sigp_pei()
481 u8 order_code = kvm_s390_get_base_disp_rs(vcpu, NULL); in kvm_s390_handle_sigp_pei()
484 trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); in kvm_s390_handle_sigp_pei()
486 dest_vcpu = kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); in kvm_s390_handle_sigp_pei()
490 kvm_s390_set_psw_cc(vcpu, SIGP_CC_ORDER_CODE_ACCEPTED); in kvm_s390_handle_sigp_pei()