18f2abe6aSChristian Borntraeger /* 2a53c8fabSHeiko Carstens * in-kernel handling for sie intercepts 38f2abe6aSChristian Borntraeger * 49a558ee3SThomas Huth * Copyright IBM Corp. 2008, 2014 58f2abe6aSChristian Borntraeger * 68f2abe6aSChristian Borntraeger * This program is free software; you can redistribute it and/or modify 78f2abe6aSChristian Borntraeger * it under the terms of the GNU General Public License (version 2 only) 88f2abe6aSChristian Borntraeger * as published by the Free Software Foundation. 98f2abe6aSChristian Borntraeger * 108f2abe6aSChristian Borntraeger * Author(s): Carsten Otte <cotte@de.ibm.com> 118f2abe6aSChristian Borntraeger * Christian Borntraeger <borntraeger@de.ibm.com> 128f2abe6aSChristian Borntraeger */ 138f2abe6aSChristian Borntraeger 148f2abe6aSChristian Borntraeger #include <linux/kvm_host.h> 158f2abe6aSChristian Borntraeger #include <linux/errno.h> 168f2abe6aSChristian Borntraeger #include <linux/pagemap.h> 178f2abe6aSChristian Borntraeger 188f2abe6aSChristian Borntraeger #include <asm/kvm_host.h> 19a86dcc24SMichael Mueller #include <asm/asm-offsets.h> 20f14d82e0SThomas Huth #include <asm/irq.h> 218f2abe6aSChristian Borntraeger 228f2abe6aSChristian Borntraeger #include "kvm-s390.h" 23ba5c1e9bSCarsten Otte #include "gaccess.h" 245786fffaSCornelia Huck #include "trace.h" 25ade38c31SCornelia Huck #include "trace-s390.h" 26ba5c1e9bSCarsten Otte 27f379aae5SCornelia Huck 2877975357SCornelia Huck static const intercept_handler_t instruction_handlers[256] = { 298c3f61e2SCornelia Huck [0x01] = kvm_s390_handle_01, 3048a3e950SCornelia Huck [0x82] = kvm_s390_handle_lpsw, 31e28acfeaSChristian Borntraeger [0x83] = kvm_s390_handle_diag, 325288fbf0SChristian Borntraeger [0xae] = kvm_s390_handle_sigp, 3370455a36SChristian Borntraeger [0xb2] = kvm_s390_handle_b2, 34aba07508SDavid Hildenbrand [0xb6] = kvm_s390_handle_stctl, 35953ed88dSThomas Huth [0xb7] = kvm_s390_handle_lctl, 3648a3e950SCornelia Huck [0xb9] = kvm_s390_handle_b9, 37bb25b9baSChristian Borntraeger [0xe5] = kvm_s390_handle_e5, 38953ed88dSThomas Huth [0xeb] = kvm_s390_handle_eb, 39ba5c1e9bSCarsten Otte }; 408f2abe6aSChristian Borntraeger 410e8bc06aSDavid Hildenbrand u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu) 4204b41acdSThomas Huth { 4304b41acdSThomas Huth struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block; 440e8bc06aSDavid Hildenbrand u8 ilen = 0; 4504b41acdSThomas Huth 460e8bc06aSDavid Hildenbrand switch (vcpu->arch.sie_block->icptcode) { 470e8bc06aSDavid Hildenbrand case ICPT_INST: 480e8bc06aSDavid Hildenbrand case ICPT_INSTPROGI: 490e8bc06aSDavid Hildenbrand case ICPT_OPEREXC: 500e8bc06aSDavid Hildenbrand case ICPT_PARTEXEC: 510e8bc06aSDavid Hildenbrand case ICPT_IOINST: 520e8bc06aSDavid Hildenbrand /* instruction only stored for these icptcodes */ 530e8bc06aSDavid Hildenbrand ilen = insn_length(vcpu->arch.sie_block->ipa >> 8); 5404b41acdSThomas Huth /* Use the length of the EXECUTE instruction if necessary */ 5504b41acdSThomas Huth if (sie_block->icptstatus & 1) { 560e8bc06aSDavid Hildenbrand ilen = (sie_block->icptstatus >> 4) & 0x6; 570e8bc06aSDavid Hildenbrand if (!ilen) 580e8bc06aSDavid Hildenbrand ilen = 4; 5904b41acdSThomas Huth } 600e8bc06aSDavid Hildenbrand break; 610e8bc06aSDavid Hildenbrand case ICPT_PROGI: 620e8bc06aSDavid Hildenbrand /* bit 1+2 of pgmilc are the ilc, so we directly get ilen */ 630e8bc06aSDavid Hildenbrand ilen = vcpu->arch.sie_block->pgmilc & 0x6; 640e8bc06aSDavid Hildenbrand break; 650e8bc06aSDavid Hildenbrand } 660e8bc06aSDavid Hildenbrand return ilen; 6704b41acdSThomas Huth } 6804b41acdSThomas Huth 698f2abe6aSChristian Borntraeger static int handle_noop(struct kvm_vcpu *vcpu) 708f2abe6aSChristian Borntraeger { 718f2abe6aSChristian Borntraeger switch (vcpu->arch.sie_block->icptcode) { 728f2abe6aSChristian Borntraeger case 0x10: 738f2abe6aSChristian Borntraeger vcpu->stat.exit_external_request++; 748f2abe6aSChristian Borntraeger break; 758f2abe6aSChristian Borntraeger default: 768f2abe6aSChristian Borntraeger break; /* nothing */ 778f2abe6aSChristian Borntraeger } 788f2abe6aSChristian Borntraeger return 0; 798f2abe6aSChristian Borntraeger } 808f2abe6aSChristian Borntraeger 818f2abe6aSChristian Borntraeger static int handle_stop(struct kvm_vcpu *vcpu) 828f2abe6aSChristian Borntraeger { 836cddd432SDavid Hildenbrand struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int; 849ace903dSChristian Ehrhardt int rc = 0; 856cddd432SDavid Hildenbrand uint8_t flags, stop_pending; 865288fbf0SChristian Borntraeger 878f2abe6aSChristian Borntraeger vcpu->stat.exit_stop_request++; 88ade38c31SCornelia Huck 899a022067SDavid Hildenbrand /* delay the stop if any non-stop irq is pending */ 909a022067SDavid Hildenbrand if (kvm_s390_vcpu_has_irq(vcpu, 1)) 919a022067SDavid Hildenbrand return 0; 929a022067SDavid Hildenbrand 936cddd432SDavid Hildenbrand /* avoid races with the injection/SIGP STOP code */ 946cddd432SDavid Hildenbrand spin_lock(&li->lock); 956cddd432SDavid Hildenbrand flags = li->irq.stop.flags; 966cddd432SDavid Hildenbrand stop_pending = kvm_s390_is_stop_irq_pending(vcpu); 976cddd432SDavid Hildenbrand spin_unlock(&li->lock); 989ace903dSChristian Ehrhardt 996cddd432SDavid Hildenbrand trace_kvm_s390_stop_request(stop_pending, flags); 1006cddd432SDavid Hildenbrand if (!stop_pending) 10132f5ff63SDavid Hildenbrand return 0; 10232f5ff63SDavid Hildenbrand 1036cddd432SDavid Hildenbrand if (flags & KVM_S390_STOP_FLAG_STORE_STATUS) { 1049e0d5473SJens Freimann rc = kvm_s390_vcpu_store_status(vcpu, 1059e0d5473SJens Freimann KVM_S390_STORE_STATUS_NOADDR); 10632f5ff63SDavid Hildenbrand if (rc) 1075288fbf0SChristian Borntraeger return rc; 1088f2abe6aSChristian Borntraeger } 1098f2abe6aSChristian Borntraeger 1106352e4d2SDavid Hildenbrand if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm)) 11132f5ff63SDavid Hildenbrand kvm_s390_vcpu_stop(vcpu); 11232f5ff63SDavid Hildenbrand return -EOPNOTSUPP; 11332f5ff63SDavid Hildenbrand } 11432f5ff63SDavid Hildenbrand 1158f2abe6aSChristian Borntraeger static int handle_validity(struct kvm_vcpu *vcpu) 1168f2abe6aSChristian Borntraeger { 1178f2abe6aSChristian Borntraeger int viwhy = vcpu->arch.sie_block->ipb >> 16; 1183edbcff9SCarsten Otte 1198f2abe6aSChristian Borntraeger vcpu->stat.exit_validity++; 1205786fffaSCornelia Huck trace_kvm_s390_intercept_validity(vcpu, viwhy); 1212c70fe44SChristian Borntraeger WARN_ONCE(true, "kvm: unhandled validity intercept 0x%x\n", viwhy); 1222c70fe44SChristian Borntraeger return -EOPNOTSUPP; 1238f2abe6aSChristian Borntraeger } 1248f2abe6aSChristian Borntraeger 125ba5c1e9bSCarsten Otte static int handle_instruction(struct kvm_vcpu *vcpu) 126ba5c1e9bSCarsten Otte { 127ba5c1e9bSCarsten Otte intercept_handler_t handler; 128ba5c1e9bSCarsten Otte 129ba5c1e9bSCarsten Otte vcpu->stat.exit_instruction++; 1305786fffaSCornelia Huck trace_kvm_s390_intercept_instruction(vcpu, 1315786fffaSCornelia Huck vcpu->arch.sie_block->ipa, 1325786fffaSCornelia Huck vcpu->arch.sie_block->ipb); 133ba5c1e9bSCarsten Otte handler = instruction_handlers[vcpu->arch.sie_block->ipa >> 8]; 134ba5c1e9bSCarsten Otte if (handler) 135ba5c1e9bSCarsten Otte return handler(vcpu); 136b8e660b8SHeiko Carstens return -EOPNOTSUPP; 137ba5c1e9bSCarsten Otte } 138ba5c1e9bSCarsten Otte 139439716a5SDavid Hildenbrand static void __extract_prog_irq(struct kvm_vcpu *vcpu, 140439716a5SDavid Hildenbrand struct kvm_s390_pgm_info *pgm_info) 141439716a5SDavid Hildenbrand { 142439716a5SDavid Hildenbrand memset(pgm_info, 0, sizeof(struct kvm_s390_pgm_info)); 143439716a5SDavid Hildenbrand pgm_info->code = vcpu->arch.sie_block->iprcc; 144439716a5SDavid Hildenbrand 145439716a5SDavid Hildenbrand switch (vcpu->arch.sie_block->iprcc & ~PGM_PER) { 146439716a5SDavid Hildenbrand case PGM_AFX_TRANSLATION: 147439716a5SDavid Hildenbrand case PGM_ASX_TRANSLATION: 148439716a5SDavid Hildenbrand case PGM_EX_TRANSLATION: 149439716a5SDavid Hildenbrand case PGM_LFX_TRANSLATION: 150439716a5SDavid Hildenbrand case PGM_LSTE_SEQUENCE: 151439716a5SDavid Hildenbrand case PGM_LSX_TRANSLATION: 152439716a5SDavid Hildenbrand case PGM_LX_TRANSLATION: 153439716a5SDavid Hildenbrand case PGM_PRIMARY_AUTHORITY: 154439716a5SDavid Hildenbrand case PGM_SECONDARY_AUTHORITY: 155439716a5SDavid Hildenbrand case PGM_SPACE_SWITCH: 156439716a5SDavid Hildenbrand pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc; 157439716a5SDavid Hildenbrand break; 158439716a5SDavid Hildenbrand case PGM_ALEN_TRANSLATION: 159439716a5SDavid Hildenbrand case PGM_ALE_SEQUENCE: 160439716a5SDavid Hildenbrand case PGM_ASTE_INSTANCE: 161439716a5SDavid Hildenbrand case PGM_ASTE_SEQUENCE: 162439716a5SDavid Hildenbrand case PGM_ASTE_VALIDITY: 163439716a5SDavid Hildenbrand case PGM_EXTENDED_AUTHORITY: 164439716a5SDavid Hildenbrand pgm_info->exc_access_id = vcpu->arch.sie_block->eai; 165439716a5SDavid Hildenbrand break; 166439716a5SDavid Hildenbrand case PGM_ASCE_TYPE: 167439716a5SDavid Hildenbrand case PGM_PAGE_TRANSLATION: 168439716a5SDavid Hildenbrand case PGM_REGION_FIRST_TRANS: 169439716a5SDavid Hildenbrand case PGM_REGION_SECOND_TRANS: 170439716a5SDavid Hildenbrand case PGM_REGION_THIRD_TRANS: 171439716a5SDavid Hildenbrand case PGM_SEGMENT_TRANSLATION: 172439716a5SDavid Hildenbrand pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc; 173439716a5SDavid Hildenbrand pgm_info->exc_access_id = vcpu->arch.sie_block->eai; 174439716a5SDavid Hildenbrand pgm_info->op_access_id = vcpu->arch.sie_block->oai; 175439716a5SDavid Hildenbrand break; 176439716a5SDavid Hildenbrand case PGM_MONITOR: 177439716a5SDavid Hildenbrand pgm_info->mon_class_nr = vcpu->arch.sie_block->mcn; 178439716a5SDavid Hildenbrand pgm_info->mon_code = vcpu->arch.sie_block->tecmc; 179439716a5SDavid Hildenbrand break; 180403c8648SEric Farman case PGM_VECTOR_PROCESSING: 181439716a5SDavid Hildenbrand case PGM_DATA: 182439716a5SDavid Hildenbrand pgm_info->data_exc_code = vcpu->arch.sie_block->dxc; 183439716a5SDavid Hildenbrand break; 184439716a5SDavid Hildenbrand case PGM_PROTECTION: 185439716a5SDavid Hildenbrand pgm_info->trans_exc_code = vcpu->arch.sie_block->tecmc; 186439716a5SDavid Hildenbrand pgm_info->exc_access_id = vcpu->arch.sie_block->eai; 187439716a5SDavid Hildenbrand break; 188439716a5SDavid Hildenbrand default: 189439716a5SDavid Hildenbrand break; 190439716a5SDavid Hildenbrand } 191439716a5SDavid Hildenbrand 192439716a5SDavid Hildenbrand if (vcpu->arch.sie_block->iprcc & PGM_PER) { 193439716a5SDavid Hildenbrand pgm_info->per_code = vcpu->arch.sie_block->perc; 194439716a5SDavid Hildenbrand pgm_info->per_atmid = vcpu->arch.sie_block->peratmid; 195439716a5SDavid Hildenbrand pgm_info->per_address = vcpu->arch.sie_block->peraddr; 196439716a5SDavid Hildenbrand pgm_info->per_access_id = vcpu->arch.sie_block->peraid; 197439716a5SDavid Hildenbrand } 198439716a5SDavid Hildenbrand } 199439716a5SDavid Hildenbrand 200e325fe69SMichael Mueller /* 201e325fe69SMichael Mueller * restore ITDB to program-interruption TDB in guest lowcore 202e325fe69SMichael Mueller * and set TX abort indication if required 203e325fe69SMichael Mueller */ 204e325fe69SMichael Mueller static int handle_itdb(struct kvm_vcpu *vcpu) 205e325fe69SMichael Mueller { 206e325fe69SMichael Mueller struct kvm_s390_itdb *itdb; 207e325fe69SMichael Mueller int rc; 208e325fe69SMichael Mueller 209e325fe69SMichael Mueller if (!IS_TE_ENABLED(vcpu) || !IS_ITDB_VALID(vcpu)) 210e325fe69SMichael Mueller return 0; 211e325fe69SMichael Mueller if (current->thread.per_flags & PER_FLAG_NO_TE) 212e325fe69SMichael Mueller return 0; 213e325fe69SMichael Mueller itdb = (struct kvm_s390_itdb *)vcpu->arch.sie_block->itdba; 214e325fe69SMichael Mueller rc = write_guest_lc(vcpu, __LC_PGM_TDB, itdb, sizeof(*itdb)); 215e325fe69SMichael Mueller if (rc) 216e325fe69SMichael Mueller return rc; 217e325fe69SMichael Mueller memset(itdb, 0, sizeof(*itdb)); 218e325fe69SMichael Mueller 219e325fe69SMichael Mueller return 0; 220e325fe69SMichael Mueller } 221e325fe69SMichael Mueller 22227291e21SDavid Hildenbrand #define per_event(vcpu) (vcpu->arch.sie_block->iprcc & PGM_PER) 22327291e21SDavid Hildenbrand 224ba5c1e9bSCarsten Otte static int handle_prog(struct kvm_vcpu *vcpu) 225ba5c1e9bSCarsten Otte { 226439716a5SDavid Hildenbrand struct kvm_s390_pgm_info pgm_info; 227684135e0SThomas Huth psw_t psw; 2280040e7d2SHeiko Carstens int rc; 2290040e7d2SHeiko Carstens 230ba5c1e9bSCarsten Otte vcpu->stat.exit_program_interruption++; 2317feb6bb8SMichael Mueller 23227291e21SDavid Hildenbrand if (guestdbg_enabled(vcpu) && per_event(vcpu)) { 23327291e21SDavid Hildenbrand kvm_s390_handle_per_event(vcpu); 23427291e21SDavid Hildenbrand /* the interrupt might have been filtered out completely */ 23527291e21SDavid Hildenbrand if (vcpu->arch.sie_block->iprcc == 0) 23627291e21SDavid Hildenbrand return 0; 23727291e21SDavid Hildenbrand } 23827291e21SDavid Hildenbrand 239e325fe69SMichael Mueller trace_kvm_s390_intercept_prog(vcpu, vcpu->arch.sie_block->iprcc); 240684135e0SThomas Huth if (vcpu->arch.sie_block->iprcc == PGM_SPECIFICATION) { 241684135e0SThomas Huth rc = read_guest_lc(vcpu, __LC_PGM_NEW_PSW, &psw, sizeof(psw_t)); 242684135e0SThomas Huth if (rc) 243684135e0SThomas Huth return rc; 244684135e0SThomas Huth /* Avoid endless loops of specification exceptions */ 245684135e0SThomas Huth if (!is_valid_psw(&psw)) 246684135e0SThomas Huth return -EOPNOTSUPP; 247684135e0SThomas Huth } 248e325fe69SMichael Mueller rc = handle_itdb(vcpu); 2490040e7d2SHeiko Carstens if (rc) 2500040e7d2SHeiko Carstens return rc; 251439716a5SDavid Hildenbrand 252e325fe69SMichael Mueller __extract_prog_irq(vcpu, &pgm_info); 253439716a5SDavid Hildenbrand return kvm_s390_inject_prog_irq(vcpu, &pgm_info); 254ba5c1e9bSCarsten Otte } 255ba5c1e9bSCarsten Otte 2569a558ee3SThomas Huth /** 257f14d82e0SThomas Huth * handle_external_interrupt - used for external interruption interceptions 258f14d82e0SThomas Huth * 259f14d82e0SThomas Huth * This interception only occurs if the CPUSTAT_EXT_INT bit was set, or if 260f14d82e0SThomas Huth * the new PSW does not have external interrupts disabled. In the first case, 261f14d82e0SThomas Huth * we've got to deliver the interrupt manually, and in the second case, we 262f14d82e0SThomas Huth * drop to userspace to handle the situation there. 263f14d82e0SThomas Huth */ 264f14d82e0SThomas Huth static int handle_external_interrupt(struct kvm_vcpu *vcpu) 265f14d82e0SThomas Huth { 266f14d82e0SThomas Huth u16 eic = vcpu->arch.sie_block->eic; 267383d0b05SJens Freimann struct kvm_s390_irq irq; 268f14d82e0SThomas Huth psw_t newpsw; 269f14d82e0SThomas Huth int rc; 270f14d82e0SThomas Huth 271f14d82e0SThomas Huth vcpu->stat.exit_external_interrupt++; 272f14d82e0SThomas Huth 273f14d82e0SThomas Huth rc = read_guest_lc(vcpu, __LC_EXT_NEW_PSW, &newpsw, sizeof(psw_t)); 274f14d82e0SThomas Huth if (rc) 275f14d82e0SThomas Huth return rc; 276f14d82e0SThomas Huth /* We can not handle clock comparator or timer interrupt with bad PSW */ 277f14d82e0SThomas Huth if ((eic == EXT_IRQ_CLK_COMP || eic == EXT_IRQ_CPU_TIMER) && 278f14d82e0SThomas Huth (newpsw.mask & PSW_MASK_EXT)) 279f14d82e0SThomas Huth return -EOPNOTSUPP; 280f14d82e0SThomas Huth 281f14d82e0SThomas Huth switch (eic) { 282f14d82e0SThomas Huth case EXT_IRQ_CLK_COMP: 283f14d82e0SThomas Huth irq.type = KVM_S390_INT_CLOCK_COMP; 284f14d82e0SThomas Huth break; 285f14d82e0SThomas Huth case EXT_IRQ_CPU_TIMER: 286f14d82e0SThomas Huth irq.type = KVM_S390_INT_CPU_TIMER; 287f14d82e0SThomas Huth break; 288f14d82e0SThomas Huth case EXT_IRQ_EXTERNAL_CALL: 289f14d82e0SThomas Huth irq.type = KVM_S390_INT_EXTERNAL_CALL; 290383d0b05SJens Freimann irq.u.extcall.code = vcpu->arch.sie_block->extcpuaddr; 291ea5f4969SDavid Hildenbrand rc = kvm_s390_inject_vcpu(vcpu, &irq); 292ea5f4969SDavid Hildenbrand /* ignore if another external call is already pending */ 293ea5f4969SDavid Hildenbrand if (rc == -EBUSY) 294ea5f4969SDavid Hildenbrand return 0; 295ea5f4969SDavid Hildenbrand return rc; 296f14d82e0SThomas Huth default: 297f14d82e0SThomas Huth return -EOPNOTSUPP; 298f14d82e0SThomas Huth } 299f14d82e0SThomas Huth 300f14d82e0SThomas Huth return kvm_s390_inject_vcpu(vcpu, &irq); 301f14d82e0SThomas Huth } 302f14d82e0SThomas Huth 303f14d82e0SThomas Huth /** 3049a558ee3SThomas Huth * Handle MOVE PAGE partial execution interception. 3059a558ee3SThomas Huth * 3069a558ee3SThomas Huth * This interception can only happen for guests with DAT disabled and 3079a558ee3SThomas Huth * addresses that are currently not mapped in the host. Thus we try to 3089a558ee3SThomas Huth * set up the mappings for the corresponding user pages here (or throw 3099a558ee3SThomas Huth * addressing exceptions in case of illegal guest addresses). 3109a558ee3SThomas Huth */ 3119a558ee3SThomas Huth static int handle_mvpg_pei(struct kvm_vcpu *vcpu) 3129a558ee3SThomas Huth { 313f22166dcSThomas Huth unsigned long srcaddr, dstaddr; 3149a558ee3SThomas Huth int reg1, reg2, rc; 3159a558ee3SThomas Huth 3169a558ee3SThomas Huth kvm_s390_get_regs_rre(vcpu, ®1, ®2); 3179a558ee3SThomas Huth 3189a558ee3SThomas Huth /* Make sure that the source is paged-in */ 3193cfad023SThomas Huth rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg2], 320*92c96321SDavid Hildenbrand reg2, &srcaddr, GACC_FETCH); 3213cfad023SThomas Huth if (rc) 3223cfad023SThomas Huth return kvm_s390_inject_prog_cond(vcpu, rc); 323f22166dcSThomas Huth rc = kvm_arch_fault_in_page(vcpu, srcaddr, 0); 324f22166dcSThomas Huth if (rc != 0) 3259a558ee3SThomas Huth return rc; 3269a558ee3SThomas Huth 3279a558ee3SThomas Huth /* Make sure that the destination is paged-in */ 3283cfad023SThomas Huth rc = guest_translate_address(vcpu, vcpu->run->s.regs.gprs[reg1], 329*92c96321SDavid Hildenbrand reg1, &dstaddr, GACC_STORE); 3303cfad023SThomas Huth if (rc) 3313cfad023SThomas Huth return kvm_s390_inject_prog_cond(vcpu, rc); 332f22166dcSThomas Huth rc = kvm_arch_fault_in_page(vcpu, dstaddr, 1); 333f22166dcSThomas Huth if (rc != 0) 3349a558ee3SThomas Huth return rc; 3359a558ee3SThomas Huth 3360e8bc06aSDavid Hildenbrand kvm_s390_retry_instr(vcpu); 3379a558ee3SThomas Huth 3389a558ee3SThomas Huth return 0; 3399a558ee3SThomas Huth } 3409a558ee3SThomas Huth 3419a558ee3SThomas Huth static int handle_partial_execution(struct kvm_vcpu *vcpu) 3429a558ee3SThomas Huth { 3439a558ee3SThomas Huth if (vcpu->arch.sie_block->ipa == 0xb254) /* MVPG */ 3449a558ee3SThomas Huth return handle_mvpg_pei(vcpu); 3454953919fSDavid Hildenbrand if (vcpu->arch.sie_block->ipa >> 8 == 0xae) /* SIGP */ 3464953919fSDavid Hildenbrand return kvm_s390_handle_sigp_pei(vcpu); 3479a558ee3SThomas Huth 3489a558ee3SThomas Huth return -EOPNOTSUPP; 3499a558ee3SThomas Huth } 3509a558ee3SThomas Huth 3518f2abe6aSChristian Borntraeger int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu) 3528f2abe6aSChristian Borntraeger { 35371f116bfSDavid Hildenbrand if (kvm_is_ucontrol(vcpu->kvm)) 35471f116bfSDavid Hildenbrand return -EOPNOTSUPP; 35571f116bfSDavid Hildenbrand 35646b708eaSChristian Borntraeger switch (vcpu->arch.sie_block->icptcode) { 35746b708eaSChristian Borntraeger case 0x10: 35846b708eaSChristian Borntraeger case 0x18: 35946b708eaSChristian Borntraeger return handle_noop(vcpu); 36046b708eaSChristian Borntraeger case 0x04: 36146b708eaSChristian Borntraeger return handle_instruction(vcpu); 36246b708eaSChristian Borntraeger case 0x08: 36346b708eaSChristian Borntraeger return handle_prog(vcpu); 36446b708eaSChristian Borntraeger case 0x14: 36546b708eaSChristian Borntraeger return handle_external_interrupt(vcpu); 36646b708eaSChristian Borntraeger case 0x1c: 36746b708eaSChristian Borntraeger return kvm_s390_handle_wait(vcpu); 36846b708eaSChristian Borntraeger case 0x20: 36946b708eaSChristian Borntraeger return handle_validity(vcpu); 37046b708eaSChristian Borntraeger case 0x28: 37146b708eaSChristian Borntraeger return handle_stop(vcpu); 37246b708eaSChristian Borntraeger case 0x38: 37346b708eaSChristian Borntraeger return handle_partial_execution(vcpu); 37446b708eaSChristian Borntraeger default: 375b8e660b8SHeiko Carstens return -EOPNOTSUPP; 37646b708eaSChristian Borntraeger } 3778f2abe6aSChristian Borntraeger } 378