Lines Matching refs:vcpu
32 static int handle_ri(struct kvm_vcpu *vcpu) in handle_ri() argument
34 vcpu->stat.instruction_ri++; in handle_ri()
36 if (test_kvm_facility(vcpu->kvm, 64)) { in handle_ri()
37 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: RI (lazy)"); in handle_ri()
38 vcpu->arch.sie_block->ecb3 |= ECB3_RI; in handle_ri()
39 kvm_s390_retry_instr(vcpu); in handle_ri()
42 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_ri()
45 int kvm_s390_handle_aa(struct kvm_vcpu *vcpu) in kvm_s390_handle_aa() argument
47 if ((vcpu->arch.sie_block->ipa & 0xf) <= 4) in kvm_s390_handle_aa()
48 return handle_ri(vcpu); in kvm_s390_handle_aa()
53 static int handle_gs(struct kvm_vcpu *vcpu) in handle_gs() argument
55 vcpu->stat.instruction_gs++; in handle_gs()
57 if (test_kvm_facility(vcpu->kvm, 133)) { in handle_gs()
58 VCPU_EVENT(vcpu, 3, "%s", "ENABLE: GS (lazy)"); in handle_gs()
61 current->thread.gs_cb = (struct gs_cb *)&vcpu->run->s.regs.gscb; in handle_gs()
64 vcpu->arch.sie_block->ecb |= ECB_GS; in handle_gs()
65 vcpu->arch.sie_block->ecd |= ECD_HOSTREGMGMT; in handle_gs()
66 vcpu->arch.gs_enabled = 1; in handle_gs()
67 kvm_s390_retry_instr(vcpu); in handle_gs()
70 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_gs()
73 int kvm_s390_handle_e3(struct kvm_vcpu *vcpu) in kvm_s390_handle_e3() argument
75 int code = vcpu->arch.sie_block->ipb & 0xff; in kvm_s390_handle_e3()
78 return handle_gs(vcpu); in kvm_s390_handle_e3()
83 static int handle_set_clock(struct kvm_vcpu *vcpu) in handle_set_clock() argument
90 vcpu->stat.instruction_sck++; in handle_set_clock()
92 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_set_clock()
93 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_set_clock()
95 op2 = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_set_clock()
97 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_set_clock()
98 rc = read_guest(vcpu, op2, ar, >od.tod, sizeof(gtod.tod)); in handle_set_clock()
100 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_set_clock()
102 VCPU_EVENT(vcpu, 3, "SCK: setting guest TOD to 0x%llx", gtod.tod); in handle_set_clock()
113 if (!kvm_s390_try_set_tod_clock(vcpu->kvm, >od)) { in handle_set_clock()
114 kvm_s390_retry_instr(vcpu); in handle_set_clock()
118 kvm_s390_set_psw_cc(vcpu, 0); in handle_set_clock()
122 static int handle_set_prefix(struct kvm_vcpu *vcpu) in handle_set_prefix() argument
129 vcpu->stat.instruction_spx++; in handle_set_prefix()
131 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_set_prefix()
132 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_set_prefix()
134 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_set_prefix()
138 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_set_prefix()
141 rc = read_guest(vcpu, operand2, ar, &address, sizeof(address)); in handle_set_prefix()
143 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_set_prefix()
152 if (kvm_is_error_gpa(vcpu->kvm, address)) in handle_set_prefix()
153 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_set_prefix()
155 kvm_s390_set_prefix(vcpu, address); in handle_set_prefix()
156 trace_kvm_s390_handle_prefix(vcpu, 1, address); in handle_set_prefix()
160 static int handle_store_prefix(struct kvm_vcpu *vcpu) in handle_store_prefix() argument
167 vcpu->stat.instruction_stpx++; in handle_store_prefix()
169 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_store_prefix()
170 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_store_prefix()
172 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_store_prefix()
176 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_store_prefix()
178 address = kvm_s390_get_prefix(vcpu); in handle_store_prefix()
181 rc = write_guest(vcpu, operand2, ar, &address, sizeof(address)); in handle_store_prefix()
183 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_store_prefix()
185 VCPU_EVENT(vcpu, 3, "STPX: storing prefix 0x%x into 0x%llx", address, operand2); in handle_store_prefix()
186 trace_kvm_s390_handle_prefix(vcpu, 0, address); in handle_store_prefix()
190 static int handle_store_cpu_address(struct kvm_vcpu *vcpu) in handle_store_cpu_address() argument
192 u16 vcpu_id = vcpu->vcpu_id; in handle_store_cpu_address()
197 vcpu->stat.instruction_stap++; in handle_store_cpu_address()
199 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_store_cpu_address()
200 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_store_cpu_address()
202 ga = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_store_cpu_address()
205 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_store_cpu_address()
207 rc = write_guest(vcpu, ga, ar, &vcpu_id, sizeof(vcpu_id)); in handle_store_cpu_address()
209 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_store_cpu_address()
211 VCPU_EVENT(vcpu, 3, "STAP: storing cpu address (%u) to 0x%llx", vcpu_id, ga); in handle_store_cpu_address()
212 trace_kvm_s390_handle_stap(vcpu, ga); in handle_store_cpu_address()
216 int kvm_s390_skey_check_enable(struct kvm_vcpu *vcpu) in kvm_s390_skey_check_enable() argument
220 trace_kvm_s390_skey_related_inst(vcpu); in kvm_s390_skey_check_enable()
222 if (vcpu->arch.skey_enabled) in kvm_s390_skey_check_enable()
226 VCPU_EVENT(vcpu, 3, "enabling storage keys for guest: %d", rc); in kvm_s390_skey_check_enable()
230 if (kvm_s390_test_cpuflags(vcpu, CPUSTAT_KSS)) in kvm_s390_skey_check_enable()
231 kvm_s390_clear_cpuflags(vcpu, CPUSTAT_KSS); in kvm_s390_skey_check_enable()
232 if (!vcpu->kvm->arch.use_skf) in kvm_s390_skey_check_enable()
233 vcpu->arch.sie_block->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE; in kvm_s390_skey_check_enable()
235 vcpu->arch.sie_block->ictl &= ~(ICTL_ISKE | ICTL_SSKE | ICTL_RRBE); in kvm_s390_skey_check_enable()
236 vcpu->arch.skey_enabled = true; in kvm_s390_skey_check_enable()
240 static int try_handle_skey(struct kvm_vcpu *vcpu) in try_handle_skey() argument
244 rc = kvm_s390_skey_check_enable(vcpu); in try_handle_skey()
247 if (vcpu->kvm->arch.use_skf) { in try_handle_skey()
249 kvm_s390_retry_instr(vcpu); in try_handle_skey()
250 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); in try_handle_skey()
256 static int handle_iske(struct kvm_vcpu *vcpu) in handle_iske() argument
264 vcpu->stat.instruction_iske++; in handle_iske()
266 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_iske()
267 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_iske()
269 rc = try_handle_skey(vcpu); in handle_iske()
273 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_iske()
275 gaddr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK; in handle_iske()
276 gaddr = kvm_s390_logical_to_effective(vcpu, gaddr); in handle_iske()
277 gaddr = kvm_s390_real_to_abs(vcpu, gaddr); in handle_iske()
278 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(gaddr)); in handle_iske()
280 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_iske()
296 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_iske()
299 vcpu->run->s.regs.gprs[reg1] &= ~0xff; in handle_iske()
300 vcpu->run->s.regs.gprs[reg1] |= key; in handle_iske()
304 static int handle_rrbe(struct kvm_vcpu *vcpu) in handle_rrbe() argument
311 vcpu->stat.instruction_rrbe++; in handle_rrbe()
313 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_rrbe()
314 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_rrbe()
316 rc = try_handle_skey(vcpu); in handle_rrbe()
320 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_rrbe()
322 gaddr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK; in handle_rrbe()
323 gaddr = kvm_s390_logical_to_effective(vcpu, gaddr); in handle_rrbe()
324 gaddr = kvm_s390_real_to_abs(vcpu, gaddr); in handle_rrbe()
325 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(gaddr)); in handle_rrbe()
327 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_rrbe()
342 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_rrbe()
345 kvm_s390_set_psw_cc(vcpu, rc); in handle_rrbe()
353 static int handle_sske(struct kvm_vcpu *vcpu) in handle_sske() argument
355 unsigned char m3 = vcpu->arch.sie_block->ipb >> 28; in handle_sske()
362 vcpu->stat.instruction_sske++; in handle_sske()
364 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_sske()
365 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_sske()
367 rc = try_handle_skey(vcpu); in handle_sske()
371 if (!test_kvm_facility(vcpu->kvm, 8)) in handle_sske()
373 if (!test_kvm_facility(vcpu->kvm, 10)) in handle_sske()
375 if (!test_kvm_facility(vcpu->kvm, 14)) in handle_sske()
378 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_sske()
380 key = vcpu->run->s.regs.gprs[reg1] & 0xfe; in handle_sske()
381 start = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK; in handle_sske()
382 start = kvm_s390_logical_to_effective(vcpu, start); in handle_sske()
387 start = kvm_s390_real_to_abs(vcpu, start); in handle_sske()
392 unsigned long vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(start)); in handle_sske()
396 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_sske()
410 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_sske()
421 kvm_s390_set_psw_cc(vcpu, 3); in handle_sske()
423 kvm_s390_set_psw_cc(vcpu, rc); in handle_sske()
424 vcpu->run->s.regs.gprs[reg1] &= ~0xff00UL; in handle_sske()
425 vcpu->run->s.regs.gprs[reg1] |= (u64) oldkey << 8; in handle_sske()
429 if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) in handle_sske()
430 vcpu->run->s.regs.gprs[reg2] &= ~PAGE_MASK; in handle_sske()
432 vcpu->run->s.regs.gprs[reg2] &= ~0xfffff000UL; in handle_sske()
433 end = kvm_s390_logical_to_effective(vcpu, end); in handle_sske()
434 vcpu->run->s.regs.gprs[reg2] |= end; in handle_sske()
439 static int handle_ipte_interlock(struct kvm_vcpu *vcpu) in handle_ipte_interlock() argument
441 vcpu->stat.instruction_ipte_interlock++; in handle_ipte_interlock()
442 if (psw_bits(vcpu->arch.sie_block->gpsw).pstate) in handle_ipte_interlock()
443 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_ipte_interlock()
444 wait_event(vcpu->kvm->arch.ipte_wq, !ipte_lock_held(vcpu->kvm)); in handle_ipte_interlock()
445 kvm_s390_retry_instr(vcpu); in handle_ipte_interlock()
446 VCPU_EVENT(vcpu, 4, "%s", "retrying ipte interlock operation"); in handle_ipte_interlock()
450 static int handle_test_block(struct kvm_vcpu *vcpu) in handle_test_block() argument
455 vcpu->stat.instruction_tb++; in handle_test_block()
457 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_test_block()
458 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_test_block()
460 kvm_s390_get_regs_rre(vcpu, NULL, ®2); in handle_test_block()
461 addr = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK; in handle_test_block()
462 addr = kvm_s390_logical_to_effective(vcpu, addr); in handle_test_block()
463 if (kvm_s390_check_low_addr_prot_real(vcpu, addr)) in handle_test_block()
464 return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm); in handle_test_block()
465 addr = kvm_s390_real_to_abs(vcpu, addr); in handle_test_block()
467 if (kvm_is_error_gpa(vcpu->kvm, addr)) in handle_test_block()
468 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_test_block()
473 if (kvm_clear_guest(vcpu->kvm, addr, PAGE_SIZE)) in handle_test_block()
475 kvm_s390_set_psw_cc(vcpu, 0); in handle_test_block()
476 vcpu->run->s.regs.gprs[0] = 0; in handle_test_block()
480 static int handle_tpi(struct kvm_vcpu *vcpu) in handle_tpi() argument
489 vcpu->stat.instruction_tpi++; in handle_tpi()
491 addr = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_tpi()
493 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_tpi()
495 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->arch.sie_block->gcr[6], 0); in handle_tpi()
497 kvm_s390_set_psw_cc(vcpu, 0); in handle_tpi()
510 rc = write_guest(vcpu, addr, ar, &tpi_data, len); in handle_tpi()
512 rc = kvm_s390_inject_prog_cond(vcpu, rc); in handle_tpi()
521 if (write_guest_lc(vcpu, __LC_SUBCHANNEL_ID, &tpi_data, len)) { in handle_tpi()
530 kvm_s390_set_psw_cc(vcpu, 1); in handle_tpi()
538 if (kvm_s390_reinject_io_int(vcpu->kvm, inti)) { in handle_tpi()
546 static int handle_tsch(struct kvm_vcpu *vcpu) in handle_tsch() argument
551 vcpu->stat.instruction_tsch++; in handle_tsch()
554 if (vcpu->run->s.regs.gprs[1]) in handle_tsch()
555 inti = kvm_s390_get_io_int(vcpu->kvm, isc_mask, in handle_tsch()
556 vcpu->run->s.regs.gprs[1]); in handle_tsch()
566 vcpu->run->exit_reason = KVM_EXIT_S390_TSCH; in handle_tsch()
567 vcpu->run->s390_tsch.dequeued = !!inti; in handle_tsch()
569 vcpu->run->s390_tsch.subchannel_id = inti->io.subchannel_id; in handle_tsch()
570 vcpu->run->s390_tsch.subchannel_nr = inti->io.subchannel_nr; in handle_tsch()
571 vcpu->run->s390_tsch.io_int_parm = inti->io.io_int_parm; in handle_tsch()
572 vcpu->run->s390_tsch.io_int_word = inti->io.io_int_word; in handle_tsch()
574 vcpu->run->s390_tsch.ipb = vcpu->arch.sie_block->ipb; in handle_tsch()
579 static int handle_io_inst(struct kvm_vcpu *vcpu) in handle_io_inst() argument
581 VCPU_EVENT(vcpu, 4, "%s", "I/O instruction"); in handle_io_inst()
583 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_io_inst()
584 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_io_inst()
586 if (vcpu->kvm->arch.css_support) { in handle_io_inst()
591 if (vcpu->arch.sie_block->ipa == 0xb236) in handle_io_inst()
592 return handle_tpi(vcpu); in handle_io_inst()
593 if (vcpu->arch.sie_block->ipa == 0xb235) in handle_io_inst()
594 return handle_tsch(vcpu); in handle_io_inst()
596 vcpu->stat.instruction_io_other++; in handle_io_inst()
603 kvm_s390_set_psw_cc(vcpu, 3); in handle_io_inst()
623 static int handle_pqap(struct kvm_vcpu *vcpu) in handle_pqap() argument
635 if (!(vcpu->arch.sie_block->eca & ECA_APIE)) in handle_pqap()
645 reg0 = vcpu->run->s.regs.gprs[0]; in handle_pqap()
651 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_pqap()
652 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_pqap()
657 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pqap()
659 if (!test_kvm_facility(vcpu->kvm, 15) && (reg0 & 0x00800000UL)) in handle_pqap()
660 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pqap()
662 if (!(vcpu->kvm->arch.crypto.crycbd & 0x02) && (reg0 & 0x0000c0f0UL)) in handle_pqap()
663 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pqap()
667 if (!test_kvm_facility(vcpu->kvm, 65)) in handle_pqap()
668 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pqap()
675 down_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem); in handle_pqap()
676 if (vcpu->kvm->arch.crypto.pqap_hook) { in handle_pqap()
677 pqap_hook = *vcpu->kvm->arch.crypto.pqap_hook; in handle_pqap()
678 ret = pqap_hook(vcpu); in handle_pqap()
679 if (!ret && vcpu->run->s.regs.gprs[1] & 0x00ff0000) in handle_pqap()
680 kvm_s390_set_psw_cc(vcpu, 3); in handle_pqap()
681 up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem); in handle_pqap()
684 up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem); in handle_pqap()
691 memcpy(&vcpu->run->s.regs.gprs[1], &status, sizeof(status)); in handle_pqap()
692 kvm_s390_set_psw_cc(vcpu, 3); in handle_pqap()
696 static int handle_stfl(struct kvm_vcpu *vcpu) in handle_stfl() argument
701 vcpu->stat.instruction_stfl++; in handle_stfl()
703 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_stfl()
704 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_stfl()
710 fac = *vcpu->kvm->arch.model.fac_list >> 32; in handle_stfl()
711 rc = write_guest_lc(vcpu, offsetof(struct lowcore, stfl_fac_list), in handle_stfl()
715 VCPU_EVENT(vcpu, 3, "STFL: store facility list 0x%x", fac); in handle_stfl()
716 trace_kvm_s390_handle_stfl(vcpu, fac); in handle_stfl()
742 int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu) in kvm_s390_handle_lpsw() argument
744 psw_t *gpsw = &vcpu->arch.sie_block->gpsw; in kvm_s390_handle_lpsw()
750 vcpu->stat.instruction_lpsw++; in kvm_s390_handle_lpsw()
753 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in kvm_s390_handle_lpsw()
755 addr = kvm_s390_get_base_disp_s(vcpu, &ar); in kvm_s390_handle_lpsw()
757 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in kvm_s390_handle_lpsw()
759 rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw)); in kvm_s390_handle_lpsw()
761 return kvm_s390_inject_prog_cond(vcpu, rc); in kvm_s390_handle_lpsw()
763 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in kvm_s390_handle_lpsw()
768 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in kvm_s390_handle_lpsw()
772 static int handle_lpswe(struct kvm_vcpu *vcpu) in handle_lpswe() argument
779 vcpu->stat.instruction_lpswe++; in handle_lpswe()
781 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_lpswe()
782 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_lpswe()
784 addr = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_lpswe()
786 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_lpswe()
787 rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw)); in handle_lpswe()
789 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_lpswe()
790 vcpu->arch.sie_block->gpsw = new_psw; in handle_lpswe()
791 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) in handle_lpswe()
792 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_lpswe()
796 static int handle_lpswey(struct kvm_vcpu *vcpu) in handle_lpswey() argument
803 vcpu->stat.instruction_lpswey++; in handle_lpswey()
805 if (!test_kvm_facility(vcpu->kvm, 193)) in handle_lpswey()
806 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_lpswey()
808 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_lpswey()
809 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_lpswey()
811 addr = kvm_s390_get_base_disp_siy(vcpu, &ar); in handle_lpswey()
813 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_lpswey()
815 rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw)); in handle_lpswey()
817 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_lpswey()
819 vcpu->arch.sie_block->gpsw = new_psw; in handle_lpswey()
820 if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) in handle_lpswey()
821 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_lpswey()
826 static int handle_stidp(struct kvm_vcpu *vcpu) in handle_stidp() argument
828 u64 stidp_data = vcpu->kvm->arch.model.cpuid; in handle_stidp()
833 vcpu->stat.instruction_stidp++; in handle_stidp()
835 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_stidp()
836 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_stidp()
838 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_stidp()
841 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_stidp()
843 rc = write_guest(vcpu, operand2, ar, &stidp_data, sizeof(stidp_data)); in handle_stidp()
845 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_stidp()
847 VCPU_EVENT(vcpu, 3, "STIDP: store cpu id 0x%llx", stidp_data); in handle_stidp()
851 static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem) in handle_stsi_3_2_2() argument
856 cpus = atomic_read(&vcpu->kvm->online_vcpus); in handle_stsi_3_2_2()
878 static void insert_stsi_usr_data(struct kvm_vcpu *vcpu, u64 addr, u8 ar, in insert_stsi_usr_data() argument
881 vcpu->run->exit_reason = KVM_EXIT_S390_STSI; in insert_stsi_usr_data()
882 vcpu->run->s390_stsi.addr = addr; in insert_stsi_usr_data()
883 vcpu->run->s390_stsi.ar = ar; in insert_stsi_usr_data()
884 vcpu->run->s390_stsi.fc = fc; in insert_stsi_usr_data()
885 vcpu->run->s390_stsi.sel1 = sel1; in insert_stsi_usr_data()
886 vcpu->run->s390_stsi.sel2 = sel2; in insert_stsi_usr_data()
889 static int handle_stsi(struct kvm_vcpu *vcpu) in handle_stsi() argument
891 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28; in handle_stsi()
892 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff; in handle_stsi()
893 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff; in handle_stsi()
899 vcpu->stat.instruction_stsi++; in handle_stsi()
900 VCPU_EVENT(vcpu, 3, "STSI: fc: %u sel1: %u sel2: %u", fc, sel1, sel2); in handle_stsi()
902 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_stsi()
903 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_stsi()
914 if (fc == 15 && (!test_kvm_facility(vcpu->kvm, 11) || in handle_stsi()
915 !vcpu->kvm->arch.user_stsi)) in handle_stsi()
918 if (vcpu->run->s.regs.gprs[0] & 0x0fffff00 in handle_stsi()
919 || vcpu->run->s.regs.gprs[1] & 0xffff0000) in handle_stsi()
920 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_stsi()
923 vcpu->run->s.regs.gprs[0] = 3 << 28; in handle_stsi()
924 kvm_s390_set_psw_cc(vcpu, 0); in handle_stsi()
928 operand2 = kvm_s390_get_base_disp_s(vcpu, &ar); in handle_stsi()
930 if (!kvm_s390_pv_cpu_is_protected(vcpu) && (operand2 & 0xfff)) in handle_stsi()
931 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_stsi()
948 handle_stsi_3_2_2(vcpu, (void *) mem); in handle_stsi()
951 insert_stsi_usr_data(vcpu, operand2, ar, fc, sel1, sel2); in handle_stsi()
952 trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); in handle_stsi()
955 if (kvm_s390_pv_cpu_is_protected(vcpu)) { in handle_stsi()
956 memcpy(sida_addr(vcpu->arch.sie_block), (void *)mem, PAGE_SIZE); in handle_stsi()
959 rc = write_guest(vcpu, operand2, ar, (void *)mem, PAGE_SIZE); in handle_stsi()
962 rc = kvm_s390_inject_prog_cond(vcpu, rc); in handle_stsi()
965 if (vcpu->kvm->arch.user_stsi) { in handle_stsi()
966 insert_stsi_usr_data(vcpu, operand2, ar, fc, sel1, sel2); in handle_stsi()
969 trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); in handle_stsi()
971 kvm_s390_set_psw_cc(vcpu, 0); in handle_stsi()
972 vcpu->run->s.regs.gprs[0] = 0; in handle_stsi()
975 kvm_s390_set_psw_cc(vcpu, 3); in handle_stsi()
981 int kvm_s390_handle_b2(struct kvm_vcpu *vcpu) in kvm_s390_handle_b2() argument
983 switch (vcpu->arch.sie_block->ipa & 0x00ff) { in kvm_s390_handle_b2()
985 return handle_stidp(vcpu); in kvm_s390_handle_b2()
987 return handle_set_clock(vcpu); in kvm_s390_handle_b2()
989 return handle_set_prefix(vcpu); in kvm_s390_handle_b2()
991 return handle_store_prefix(vcpu); in kvm_s390_handle_b2()
993 return handle_store_cpu_address(vcpu); in kvm_s390_handle_b2()
995 return kvm_s390_handle_vsie(vcpu); in kvm_s390_handle_b2()
998 return handle_ipte_interlock(vcpu); in kvm_s390_handle_b2()
1000 return handle_iske(vcpu); in kvm_s390_handle_b2()
1002 return handle_rrbe(vcpu); in kvm_s390_handle_b2()
1004 return handle_sske(vcpu); in kvm_s390_handle_b2()
1006 return handle_test_block(vcpu); in kvm_s390_handle_b2()
1023 return handle_io_inst(vcpu); in kvm_s390_handle_b2()
1025 return handle_sthyi(vcpu); in kvm_s390_handle_b2()
1027 return handle_stsi(vcpu); in kvm_s390_handle_b2()
1029 return handle_pqap(vcpu); in kvm_s390_handle_b2()
1031 return handle_stfl(vcpu); in kvm_s390_handle_b2()
1033 return handle_lpswe(vcpu); in kvm_s390_handle_b2()
1039 static int handle_epsw(struct kvm_vcpu *vcpu) in handle_epsw() argument
1043 vcpu->stat.instruction_epsw++; in handle_epsw()
1045 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_epsw()
1048 vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000UL; in handle_epsw()
1049 vcpu->run->s.regs.gprs[reg1] |= vcpu->arch.sie_block->gpsw.mask >> 32; in handle_epsw()
1051 vcpu->run->s.regs.gprs[reg2] &= 0xffffffff00000000UL; in handle_epsw()
1052 vcpu->run->s.regs.gprs[reg2] |= in handle_epsw()
1053 vcpu->arch.sie_block->gpsw.mask & 0x00000000ffffffffUL; in handle_epsw()
1068 static int handle_pfmf(struct kvm_vcpu *vcpu) in handle_pfmf() argument
1075 vcpu->stat.instruction_pfmf++; in handle_pfmf()
1077 kvm_s390_get_regs_rre(vcpu, ®1, ®2); in handle_pfmf()
1079 if (!test_kvm_facility(vcpu->kvm, 8)) in handle_pfmf()
1080 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_pfmf()
1082 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_pfmf()
1083 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_pfmf()
1085 if (vcpu->run->s.regs.gprs[reg1] & PFMF_RESERVED) in handle_pfmf()
1086 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pfmf()
1089 if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ && in handle_pfmf()
1090 !test_kvm_facility(vcpu->kvm, 14)) in handle_pfmf()
1091 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pfmf()
1094 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK && in handle_pfmf()
1095 test_kvm_facility(vcpu->kvm, 10)) { in handle_pfmf()
1096 mr = vcpu->run->s.regs.gprs[reg1] & PFMF_MR; in handle_pfmf()
1097 mc = vcpu->run->s.regs.gprs[reg1] & PFMF_MC; in handle_pfmf()
1100 nq = vcpu->run->s.regs.gprs[reg1] & PFMF_NQ; in handle_pfmf()
1101 key = vcpu->run->s.regs.gprs[reg1] & PFMF_KEY; in handle_pfmf()
1102 start = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK; in handle_pfmf()
1103 start = kvm_s390_logical_to_effective(vcpu, start); in handle_pfmf()
1105 if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) { in handle_pfmf()
1106 if (kvm_s390_check_low_addr_prot_real(vcpu, start)) in handle_pfmf()
1107 return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm); in handle_pfmf()
1110 switch (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) { in handle_pfmf()
1113 start = kvm_s390_real_to_abs(vcpu, start); in handle_pfmf()
1122 if (!test_kvm_facility(vcpu->kvm, 78) || in handle_pfmf()
1123 psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_24BIT) in handle_pfmf()
1124 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pfmf()
1128 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_pfmf()
1136 vmaddr = gfn_to_hva(vcpu->kvm, gpa_to_gfn(start)); in handle_pfmf()
1138 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_pfmf()
1140 if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) { in handle_pfmf()
1141 if (kvm_clear_guest(vcpu->kvm, start, PAGE_SIZE)) in handle_pfmf()
1142 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_pfmf()
1145 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK) { in handle_pfmf()
1146 int rc = kvm_s390_skey_check_enable(vcpu); in handle_pfmf()
1160 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in handle_pfmf()
1168 if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) { in handle_pfmf()
1169 if (psw_bits(vcpu->arch.sie_block->gpsw).eaba == PSW_BITS_AMODE_64BIT) { in handle_pfmf()
1170 vcpu->run->s.regs.gprs[reg2] = end; in handle_pfmf()
1172 vcpu->run->s.regs.gprs[reg2] &= ~0xffffffffUL; in handle_pfmf()
1173 end = kvm_s390_logical_to_effective(vcpu, end); in handle_pfmf()
1174 vcpu->run->s.regs.gprs[reg2] |= end; in handle_pfmf()
1183 static inline int __do_essa(struct kvm_vcpu *vcpu, const int orc) in __do_essa() argument
1194 kvm_s390_get_regs_rre(vcpu, &r1, &r2); in __do_essa()
1195 gfn = vcpu->run->s.regs.gprs[r2] >> PAGE_SHIFT; in __do_essa()
1196 hva = gfn_to_hva(vcpu->kvm, gfn); in __do_essa()
1197 entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3; in __do_essa()
1200 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); in __do_essa()
1202 nappended = pgste_perform_essa(vcpu->kvm->mm, hva, orc, &ptev, &pgstev); in __do_essa()
1205 vcpu->run->s.regs.gprs[r1] = res; /* Exception Indication */ in __do_essa()
1222 vcpu->run->s.regs.gprs[r1] = res; in __do_essa()
1230 cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo & PAGE_MASK); in __do_essa()
1235 struct kvm_memory_slot *ms = gfn_to_memslot(vcpu->kvm, gfn); in __do_essa()
1239 atomic64_inc(&vcpu->kvm->arch.cmma_dirty_pages); in __do_essa()
1245 static int handle_essa(struct kvm_vcpu *vcpu) in handle_essa() argument
1248 int entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3; in handle_essa()
1253 VCPU_EVENT(vcpu, 4, "ESSA: release %d pages", entries); in handle_essa()
1254 gmap = vcpu->arch.gmap; in handle_essa()
1255 vcpu->stat.instruction_essa++; in handle_essa()
1256 if (!vcpu->kvm->arch.use_cmma) in handle_essa()
1257 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); in handle_essa()
1259 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_essa()
1260 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_essa()
1262 orc = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; in handle_essa()
1264 if (orc > (test_kvm_facility(vcpu->kvm, 147) ? ESSA_SET_STABLE_NODAT in handle_essa()
1266 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_essa()
1268 if (!vcpu->kvm->arch.migration_mode) { in handle_essa()
1278 if (vcpu->kvm->mm->context.uses_cmm == 0) { in handle_essa()
1279 mmap_write_lock(vcpu->kvm->mm); in handle_essa()
1280 vcpu->kvm->mm->context.uses_cmm = 1; in handle_essa()
1281 mmap_write_unlock(vcpu->kvm->mm); in handle_essa()
1292 vcpu->arch.sie_block->ecb2 |= ECB2_CMMA; in handle_essa()
1294 kvm_s390_retry_instr(vcpu); in handle_essa()
1298 mmap_read_lock(vcpu->kvm->mm); in handle_essa()
1299 srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); in handle_essa()
1300 i = __do_essa(vcpu, orc); in handle_essa()
1301 srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx); in handle_essa()
1302 mmap_read_unlock(vcpu->kvm->mm); in handle_essa()
1308 vcpu->arch.sie_block->cbrlo &= PAGE_MASK; /* reset nceo */ in handle_essa()
1309 cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo); in handle_essa()
1317 int kvm_s390_handle_b9(struct kvm_vcpu *vcpu) in kvm_s390_handle_b9() argument
1319 switch (vcpu->arch.sie_block->ipa & 0x00ff) { in kvm_s390_handle_b9()
1323 return handle_ipte_interlock(vcpu); in kvm_s390_handle_b9()
1325 return handle_epsw(vcpu); in kvm_s390_handle_b9()
1327 return handle_essa(vcpu); in kvm_s390_handle_b9()
1329 return handle_pfmf(vcpu); in kvm_s390_handle_b9()
1335 int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu) in kvm_s390_handle_lctl() argument
1337 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; in kvm_s390_handle_lctl()
1338 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; in kvm_s390_handle_lctl()
1344 vcpu->stat.instruction_lctl++; in kvm_s390_handle_lctl()
1346 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in kvm_s390_handle_lctl()
1347 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in kvm_s390_handle_lctl()
1349 ga = kvm_s390_get_base_disp_rs(vcpu, &ar); in kvm_s390_handle_lctl()
1352 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in kvm_s390_handle_lctl()
1354 VCPU_EVENT(vcpu, 4, "LCTL: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); in kvm_s390_handle_lctl()
1355 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, ga); in kvm_s390_handle_lctl()
1358 rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); in kvm_s390_handle_lctl()
1360 return kvm_s390_inject_prog_cond(vcpu, rc); in kvm_s390_handle_lctl()
1364 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul; in kvm_s390_handle_lctl()
1365 vcpu->arch.sie_block->gcr[reg] |= ctl_array[nr_regs++]; in kvm_s390_handle_lctl()
1370 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); in kvm_s390_handle_lctl()
1374 int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu) in kvm_s390_handle_stctl() argument
1376 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; in kvm_s390_handle_stctl()
1377 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; in kvm_s390_handle_stctl()
1383 vcpu->stat.instruction_stctl++; in kvm_s390_handle_stctl()
1385 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in kvm_s390_handle_stctl()
1386 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in kvm_s390_handle_stctl()
1388 ga = kvm_s390_get_base_disp_rs(vcpu, &ar); in kvm_s390_handle_stctl()
1391 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in kvm_s390_handle_stctl()
1393 VCPU_EVENT(vcpu, 4, "STCTL r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); in kvm_s390_handle_stctl()
1394 trace_kvm_s390_handle_stctl(vcpu, 0, reg1, reg3, ga); in kvm_s390_handle_stctl()
1399 ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg]; in kvm_s390_handle_stctl()
1404 rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u32)); in kvm_s390_handle_stctl()
1405 return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0; in kvm_s390_handle_stctl()
1408 static int handle_lctlg(struct kvm_vcpu *vcpu) in handle_lctlg() argument
1410 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; in handle_lctlg()
1411 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; in handle_lctlg()
1417 vcpu->stat.instruction_lctlg++; in handle_lctlg()
1419 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_lctlg()
1420 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_lctlg()
1422 ga = kvm_s390_get_base_disp_rsy(vcpu, &ar); in handle_lctlg()
1425 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_lctlg()
1427 VCPU_EVENT(vcpu, 4, "LCTLG: r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); in handle_lctlg()
1428 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, ga); in handle_lctlg()
1431 rc = read_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64)); in handle_lctlg()
1433 return kvm_s390_inject_prog_cond(vcpu, rc); in handle_lctlg()
1437 vcpu->arch.sie_block->gcr[reg] = ctl_array[nr_regs++]; in handle_lctlg()
1442 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); in handle_lctlg()
1446 static int handle_stctg(struct kvm_vcpu *vcpu) in handle_stctg() argument
1448 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; in handle_stctg()
1449 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; in handle_stctg()
1455 vcpu->stat.instruction_stctg++; in handle_stctg()
1457 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_stctg()
1458 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_stctg()
1460 ga = kvm_s390_get_base_disp_rsy(vcpu, &ar); in handle_stctg()
1463 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); in handle_stctg()
1465 VCPU_EVENT(vcpu, 4, "STCTG r1:%d, r3:%d, addr: 0x%llx", reg1, reg3, ga); in handle_stctg()
1466 trace_kvm_s390_handle_stctl(vcpu, 1, reg1, reg3, ga); in handle_stctg()
1471 ctl_array[nr_regs++] = vcpu->arch.sie_block->gcr[reg]; in handle_stctg()
1476 rc = write_guest(vcpu, ga, ar, ctl_array, nr_regs * sizeof(u64)); in handle_stctg()
1477 return rc ? kvm_s390_inject_prog_cond(vcpu, rc) : 0; in handle_stctg()
1480 int kvm_s390_handle_eb(struct kvm_vcpu *vcpu) in kvm_s390_handle_eb() argument
1482 switch (vcpu->arch.sie_block->ipb & 0x000000ff) { in kvm_s390_handle_eb()
1484 return handle_stctg(vcpu); in kvm_s390_handle_eb()
1486 return handle_lctlg(vcpu); in kvm_s390_handle_eb()
1490 return handle_ri(vcpu); in kvm_s390_handle_eb()
1492 return handle_lpswey(vcpu); in kvm_s390_handle_eb()
1498 static int handle_tprot(struct kvm_vcpu *vcpu) in handle_tprot() argument
1507 vcpu->stat.instruction_tprot++; in handle_tprot()
1509 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_tprot()
1510 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_tprot()
1512 kvm_s390_get_base_disp_sse(vcpu, &address, &operand2, &ar, NULL); in handle_tprot()
1515 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT) in handle_tprot()
1516 ipte_lock(vcpu->kvm); in handle_tprot()
1518 ret = guest_translate_address_with_key(vcpu, address, ar, &gpa, in handle_tprot()
1521 gfn_to_hva_prot(vcpu->kvm, gpa_to_gfn(gpa), &writable); in handle_tprot()
1525 ret = guest_translate_address_with_key(vcpu, address, ar, &gpa, in handle_tprot()
1545 kvm_s390_set_psw_cc(vcpu, cc); in handle_tprot()
1548 ret = kvm_s390_inject_program_int(vcpu, ret); in handle_tprot()
1552 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT) in handle_tprot()
1553 ipte_unlock(vcpu->kvm); in handle_tprot()
1557 int kvm_s390_handle_e5(struct kvm_vcpu *vcpu) in kvm_s390_handle_e5() argument
1559 switch (vcpu->arch.sie_block->ipa & 0x00ff) { in kvm_s390_handle_e5()
1561 return handle_tprot(vcpu); in kvm_s390_handle_e5()
1567 static int handle_sckpf(struct kvm_vcpu *vcpu) in handle_sckpf() argument
1571 vcpu->stat.instruction_sckpf++; in handle_sckpf()
1573 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) in handle_sckpf()
1574 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); in handle_sckpf()
1576 if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000) in handle_sckpf()
1577 return kvm_s390_inject_program_int(vcpu, in handle_sckpf()
1580 value = vcpu->run->s.regs.gprs[0] & 0x000000000000ffff; in handle_sckpf()
1581 vcpu->arch.sie_block->todpr = value; in handle_sckpf()
1586 static int handle_ptff(struct kvm_vcpu *vcpu) in handle_ptff() argument
1588 vcpu->stat.instruction_ptff++; in handle_ptff()
1591 kvm_s390_set_psw_cc(vcpu, 3); in handle_ptff()
1595 int kvm_s390_handle_01(struct kvm_vcpu *vcpu) in kvm_s390_handle_01() argument
1597 switch (vcpu->arch.sie_block->ipa & 0x00ff) { in kvm_s390_handle_01()
1599 return handle_ptff(vcpu); in kvm_s390_handle_01()
1601 return handle_sckpf(vcpu); in kvm_s390_handle_01()