KVM: s390: Handle sthyi also for instruction intercept
authorChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 27 Feb 2017 20:14:47 +0000 (21:14 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 16 Mar 2017 12:04:38 +0000 (13:04 +0100)
Right now we handle the STHYI only via the operation exception intercept
(illegal instruction). If hardware ever decides to provide an
instruction intercept for STHYI, we should handle that as well.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/intercept.c
arch/s390/kvm/priv.c
arch/s390/kvm/sthyi.c

index 59920f96ebc064c749a1a96a4cff7df84ea4a51b..0a176465515315fc0eb0f20baf1ab3cc7cc34260 100644 (file)
@@ -368,8 +368,7 @@ static int handle_operexc(struct kvm_vcpu *vcpu)
        trace_kvm_s390_handle_operexc(vcpu, vcpu->arch.sie_block->ipa,
                                      vcpu->arch.sie_block->ipb);
 
-       if (vcpu->arch.sie_block->ipa == 0xb256 &&
-           test_kvm_facility(vcpu->kvm, 74))
+       if (vcpu->arch.sie_block->ipa == 0xb256)
                return handle_sthyi(vcpu);
 
        if (vcpu->arch.sie_block->ipa == 0 && vcpu->kvm->arch.user_instr0)
index 93d6cde8c3eae04c7407aba070fa4e75013e17fd..26f30bab9c2f4ce3cb2cd085b80efad8ac2bf5ed 100644 (file)
@@ -760,6 +760,7 @@ static const intercept_handler_t b2_handlers[256] = {
        [0x3b] = handle_io_inst,
        [0x3c] = handle_io_inst,
        [0x50] = handle_ipte_interlock,
+       [0x56] = handle_sthyi,
        [0x5f] = handle_io_inst,
        [0x74] = handle_io_inst,
        [0x76] = handle_io_inst,
index 05c98bb853cf971117530967a94f9176f85ef049..926b5244263efd3dd1fadf637ce4790251367e60 100644 (file)
@@ -404,6 +404,9 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
        u64 code, addr, cc = 0;
        struct sthyi_sctns *sctns = NULL;
 
+       if (!test_kvm_facility(vcpu->kvm, 74))
+               return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
+
        /*
         * STHYI requires extensive locking in the higher hypervisors
         * and is very computational/memory expensive. Therefore we