Lines Matching refs:vcpu
25 u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu) in kvm_s390_get_ilen() argument
27 struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block; in kvm_s390_get_ilen()
30 switch (vcpu->arch.sie_block->icptcode) { in kvm_s390_get_ilen()
37 ilen = insn_length(vcpu->arch.sie_block->ipa >> 8); in kvm_s390_get_ilen()
47 ilen = vcpu->arch.sie_block->pgmilc & 0x6; in kvm_s390_get_ilen()
53 static int handle_stop(struct kvm_vcpu *vcpu) in handle_stop() argument
55 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; in handle_stop()
59 vcpu->stat.exit_stop_request++; in handle_stop()
62 if (kvm_s390_vcpu_has_irq(vcpu, 1)) in handle_stop()
68 stop_pending = kvm_s390_is_stop_irq_pending(vcpu); in handle_stop()
76 rc = kvm_s390_vcpu_store_status(vcpu, in handle_stop()
86 if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm)) in handle_stop()
87 kvm_s390_vcpu_stop(vcpu); in handle_stop()
91 static int handle_validity(struct kvm_vcpu *vcpu) in handle_validity() argument
93 int viwhy = vcpu->arch.sie_block->ipb >> 16; in handle_validity()
95 vcpu->stat.exit_validity++; in handle_validity()
96 trace_kvm_s390_intercept_validity(vcpu, viwhy); in handle_validity()
98 current->pid, vcpu->kvm); in handle_validity()
106 static int handle_instruction(struct kvm_vcpu *vcpu) in handle_instruction() argument
108 vcpu->stat.exit_instruction++; in handle_instruction()
109 trace_kvm_s390_intercept_instruction(vcpu, in handle_instruction()
110 vcpu->arch.sie_block->ipa, in handle_instruction()
111 vcpu->arch.sie_block->ipb); in handle_instruction()
113 switch (vcpu->arch.sie_block->ipa >> 8) { in handle_instruction()
115 return kvm_s390_handle_01(vcpu); in handle_instruction()
117 return kvm_s390_handle_lpsw(vcpu); in handle_instruction()
119 return kvm_s390_handle_diag(vcpu); in handle_instruction()
121 return kvm_s390_handle_aa(vcpu); in handle_instruction()
123 return kvm_s390_handle_sigp(vcpu); in handle_instruction()
125 return kvm_s390_handle_b2(vcpu); in handle_instruction()
127 return kvm_s390_handle_stctl(vcpu); in handle_instruction()
129 return kvm_s390_handle_lctl(vcpu); in handle_instruction()
131 return kvm_s390_handle_b9(vcpu); in handle_instruction()
133 return kvm_s390_handle_e3(vcpu); in handle_instruction()
135 return kvm_s390_handle_e5(vcpu); in handle_instruction()
137 return kvm_s390_handle_eb(vcpu); in handle_instruction()
143 static int inject_prog_on_prog_intercept(struct kvm_vcpu *vcpu) in inject_prog_on_prog_intercept() argument
146 .code = vcpu->arch.sie_block->iprcc, in inject_prog_on_prog_intercept()
151 switch (vcpu->arch.sie_block->iprcc & ~PGM_PER) { in inject_prog_on_prog_intercept()
162 pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc; in inject_prog_on_prog_intercept()
170 pgm_info.exc_access_id = vcpu->arch.sie_block->eai; in inject_prog_on_prog_intercept()
178 pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc; in inject_prog_on_prog_intercept()
179 pgm_info.exc_access_id = vcpu->arch.sie_block->eai; in inject_prog_on_prog_intercept()
180 pgm_info.op_access_id = vcpu->arch.sie_block->oai; in inject_prog_on_prog_intercept()
183 pgm_info.mon_class_nr = vcpu->arch.sie_block->mcn; in inject_prog_on_prog_intercept()
184 pgm_info.mon_code = vcpu->arch.sie_block->tecmc; in inject_prog_on_prog_intercept()
188 pgm_info.data_exc_code = vcpu->arch.sie_block->dxc; in inject_prog_on_prog_intercept()
191 pgm_info.trans_exc_code = vcpu->arch.sie_block->tecmc; in inject_prog_on_prog_intercept()
192 pgm_info.exc_access_id = vcpu->arch.sie_block->eai; in inject_prog_on_prog_intercept()
198 if (vcpu->arch.sie_block->iprcc & PGM_PER) { in inject_prog_on_prog_intercept()
199 pgm_info.per_code = vcpu->arch.sie_block->perc; in inject_prog_on_prog_intercept()
200 pgm_info.per_atmid = vcpu->arch.sie_block->peratmid; in inject_prog_on_prog_intercept()
201 pgm_info.per_address = vcpu->arch.sie_block->peraddr; in inject_prog_on_prog_intercept()
202 pgm_info.per_access_id = vcpu->arch.sie_block->peraid; in inject_prog_on_prog_intercept()
204 return kvm_s390_inject_prog_irq(vcpu, &pgm_info); in inject_prog_on_prog_intercept()
211 static int handle_itdb(struct kvm_vcpu *vcpu) in handle_itdb() argument
216 if (!IS_TE_ENABLED(vcpu) || !IS_ITDB_VALID(vcpu)) in handle_itdb()
220 itdb = (struct kvm_s390_itdb *)vcpu->arch.sie_block->itdba; in handle_itdb()
221 rc = write_guest_lc(vcpu, __LC_PGM_TDB, itdb, sizeof(*itdb)); in handle_itdb()
229 #define per_event(vcpu) (vcpu->arch.sie_block->iprcc & PGM_PER) argument
231 static int handle_prog(struct kvm_vcpu *vcpu) in handle_prog() argument
236 vcpu->stat.exit_program_interruption++; in handle_prog()
242 if (kvm_s390_pv_cpu_is_protected(vcpu)) in handle_prog()
245 if (guestdbg_enabled(vcpu) && per_event(vcpu)) { in handle_prog()
246 rc = kvm_s390_handle_per_event(vcpu); in handle_prog()
250 if (vcpu->arch.sie_block->iprcc == 0) in handle_prog()
254 trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc); in handle_prog()
255 if (vcpu->arch.sie_block->iprcc == PGM_SPECIFICATION) { in handle_prog()
256 rc = read_guest_lc(vcpu, __LC_PGM_NEW_PSW, &psw, sizeof(psw_t)); in handle_prog()
263 rc = handle_itdb(vcpu); in handle_prog()
267 return inject_prog_on_prog_intercept(vcpu); in handle_prog()
286 static int handle_external_interrupt(struct kvm_vcpu *vcpu) in handle_external_interrupt() argument
288 u16 eic = vcpu->arch.sie_block->eic; in handle_external_interrupt()
293 vcpu->stat.exit_external_interrupt++; in handle_external_interrupt()
295 if (kvm_s390_pv_cpu_is_protected(vcpu)) { in handle_external_interrupt()
296 newpsw = vcpu->arch.sie_block->gpsw; in handle_external_interrupt()
298 rc = read_guest_lc(vcpu, __LC_EXT_NEW_PSW, &newpsw, sizeof(psw_t)); in handle_external_interrupt()
320 irq.u.extcall.code = vcpu->arch.sie_block->extcpuaddr; in handle_external_interrupt()
321 rc = kvm_s390_inject_vcpu(vcpu, &irq); in handle_external_interrupt()
330 return kvm_s390_inject_vcpu(vcpu, &irq); in handle_external_interrupt()
341 static int handle_mvpg_pei(struct kvm_vcpu *vcpu) in handle_mvpg_pei() argument
346 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_mvpg_pei()
349 rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg2], in handle_mvpg_pei()
352 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_mvpg_pei()
353 rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0); in handle_mvpg_pei()
358 rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg1], in handle_mvpg_pei()
361 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_mvpg_pei()
362 rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1); in handle_mvpg_pei()
366 kvm_s390_retry_instr(vcpu); in handle_mvpg_pei()
371 static int handle_partial_execution(struct kvm_vcpu *vcpu) in handle_partial_execution() argument
373 vcpu->stat.exit_pei++; in handle_partial_execution()
375 if (vcpu->arch.sie_block->ipa == 0xb254) /* MVPG */ in handle_partial_execution()
376 return handle_mvpg_pei(vcpu); in handle_partial_execution()
377 if (vcpu->arch.sie_block->ipa >> 8 == 0xae) /* SIGP */ in handle_partial_execution()
378 return kvm_s390_handle_sigp_pei(vcpu); in handle_partial_execution()
388 int handle_sthyi(struct kvm_vcpu *vcpu) in handle_sthyi() argument
394 if (!test_kvm_facility(vcpu->kvm, 74)) in handle_sthyi()
395 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_sthyi()
397 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_sthyi()
398 code = vcpu->run->s.regs.gprs[reg1]; in handle_sthyi()
399 addr = vcpu->run->s.regs.gprs[reg2]; in handle_sthyi()
401 vcpu->stat.instruction_sthyi++; in handle_sthyi()
402 VCPU_EVENT(vcpu, 3, "STHYI: fc: %llu addr: 0x%016llx", code, addr); in handle_sthyi()
403 trace_kvm_s390_handle_sthyi(vcpu, code, addr); in handle_sthyi()
406 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_sthyi()
414 if (!kvm_s390_pv_cpu_is_protected(vcpu) && (addr & ~PAGE_MASK)) in handle_sthyi()
415 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_sthyi()
428 if (kvm_s390_pv_cpu_is_protected(vcpu)) { in handle_sthyi()
429 memcpy((void *)(sida_origin(vcpu->arch.sie_block)), in handle_sthyi()
432 r = write_guest(vcpu, addr, reg2, sctns, PAGE_SIZE); in handle_sthyi()
435 return kvm_s390_inject_prog_cond(vcpu, r); in handle_sthyi()
441 vcpu->run->s.regs.gprs[reg2 + 1] = rc; in handle_sthyi()
442 kvm_s390_set_psw_cc(vcpu, cc); in handle_sthyi()
446 static int handle_operexc(struct kvm_vcpu *vcpu) in handle_operexc() argument
451 vcpu->stat.exit_operation_exception++; in handle_operexc()
452 trace_kvm_s390_handle_operexc(vcpu, vcpu->arch.sie_block->ipa, in handle_operexc()
453 vcpu->arch.sie_block->ipb); in handle_operexc()
455 if (vcpu->arch.sie_block->ipa == 0xb256) in handle_operexc()
456 return handle_sthyi(vcpu); in handle_operexc()
458 if (vcpu->arch.sie_block->ipa == 0 && vcpu->kvm->arch.user_instr0) in handle_operexc()
460 rc = read_guest_lc(vcpu, __LC_PGM_NEW_PSW, &newpsw, sizeof(psw_t)); in handle_operexc()
471 oldpsw = vcpu->arch.sie_block->gpsw; in handle_operexc()
479 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_operexc()
482 static int handle_pv_spx(struct kvm_vcpu *vcpu) in handle_pv_spx() argument
484 u32 pref = *(u32 *)vcpu->arch.sie_block->sidad; in handle_pv_spx()
486 kvm_s390_set_prefix(vcpu, pref); in handle_pv_spx()
487 trace_kvm_s390_handle_prefix(vcpu, 1, pref); in handle_pv_spx()
491 static int handle_pv_sclp(struct kvm_vcpu *vcpu) in handle_pv_sclp() argument
493 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; in handle_pv_sclp()
515 static int handle_pv_uvc(struct kvm_vcpu *vcpu) in handle_pv_uvc() argument
517 struct uv_cb_share *guest_uvcb = (void *)vcpu->arch.sie_block->sidad; in handle_pv_uvc()
521 .guest_handle = kvm_s390_pv_get_handle(vcpu->kvm), in handle_pv_uvc()
531 rc = gmap_make_secure(vcpu->arch.gmap, uvcb.gaddr, &uvcb); in handle_pv_uvc()
541 static int handle_pv_notification(struct kvm_vcpu *vcpu) in handle_pv_notification() argument
545 if (vcpu->arch.sie_block->ipa == 0xb210) in handle_pv_notification()
546 return handle_pv_spx(vcpu); in handle_pv_notification()
547 if (vcpu->arch.sie_block->ipa == 0xb220) in handle_pv_notification()
548 return handle_pv_sclp(vcpu); in handle_pv_notification()
549 if (vcpu->arch.sie_block->ipa == 0xb9a4) in handle_pv_notification()
550 return handle_pv_uvc(vcpu); in handle_pv_notification()
551 if (vcpu->arch.sie_block->ipa >> 8 == 0xae) { in handle_pv_notification()
560 ret = kvm_s390_handle_sigp_pei(vcpu); in handle_pv_notification()
565 return handle_instruction(vcpu); in handle_pv_notification()
568 int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu) in kvm_handle_sie_intercept() argument
572 if (kvm_is_ucontrol(vcpu->kvm)) in kvm_handle_sie_intercept()
575 switch (vcpu->arch.sie_block->icptcode) { in kvm_handle_sie_intercept()
577 vcpu->stat.exit_external_request++; in kvm_handle_sie_intercept()
580 vcpu->stat.exit_io_request++; in kvm_handle_sie_intercept()
583 rc = handle_instruction(vcpu); in kvm_handle_sie_intercept()
586 return handle_prog(vcpu); in kvm_handle_sie_intercept()
588 return handle_external_interrupt(vcpu); in kvm_handle_sie_intercept()
590 return kvm_s390_handle_wait(vcpu); in kvm_handle_sie_intercept()
592 return handle_validity(vcpu); in kvm_handle_sie_intercept()
594 return handle_stop(vcpu); in kvm_handle_sie_intercept()
596 rc = handle_operexc(vcpu); in kvm_handle_sie_intercept()
599 rc = handle_partial_execution(vcpu); in kvm_handle_sie_intercept()
602 rc = kvm_s390_skey_check_enable(vcpu); in kvm_handle_sie_intercept()
614 rc = handle_instruction(vcpu); in kvm_handle_sie_intercept()
617 rc = handle_pv_notification(vcpu); in kvm_handle_sie_intercept()
621 gmap_convert_to_secure(vcpu->arch.gmap, in kvm_handle_sie_intercept()
622 kvm_s390_get_prefix(vcpu)); in kvm_handle_sie_intercept()
623 gmap_convert_to_secure(vcpu->arch.gmap, in kvm_handle_sie_intercept()
624 kvm_s390_get_prefix(vcpu) + PAGE_SIZE); in kvm_handle_sie_intercept()
631 if (vcpu->arch.sie_block->icptstatus & 0x02 && in kvm_handle_sie_intercept()
633 per_rc = kvm_s390_handle_per_ifetch_icpt(vcpu); in kvm_handle_sie_intercept()