]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: s390: introduce and use KVM_REQ_VSIE_RESTART
authorDavid Hildenbrand <david@redhat.com>
Tue, 25 Sep 2018 23:16:17 +0000 (19:16 -0400)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 26 Sep 2018 07:13:20 +0000 (09:13 +0200)
When we change the crycb (or execution controls), we also have to make sure
that the vSIE shadow datastructures properly consider the changed
values before rerunning the vSIE. We can achieve that by simply using a
VCPU request now.

This has to be a synchronous request (== handled before entering the
(v)SIE again).

The request will make sure that the vSIE handler is left, and that the
request will be processed (NOP), therefore forcing a reload of all
vSIE data (including rebuilding the crycb) when re-entering the vSIE
interception handler the next time.

Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20180925231641.4954-3-akrowiak@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/kvm-s390.c

index 29c940bf8506a78ca726befcde6888e570582b22..75d39628f21db21ea113bed5bad9b182ef0c07b4 100644 (file)
@@ -44,6 +44,7 @@
 #define KVM_REQ_ICPT_OPEREXC   KVM_ARCH_REQ(2)
 #define KVM_REQ_START_MIGRATION KVM_ARCH_REQ(3)
 #define KVM_REQ_STOP_MIGRATION  KVM_ARCH_REQ(4)
+#define KVM_REQ_VSIE_RESTART   KVM_ARCH_REQ(5)
 
 #define SIGP_CTRL_C            0x80
 #define SIGP_CTRL_SCN_MASK     0x3f
index 0b5aff0e3984218c51ff2398a2004f74c7533633..876fbb2b0c04b32efc42e76bf5baf354fc508550 100644 (file)
@@ -844,8 +844,11 @@ void kvm_s390_vcpu_crypto_reset_all(struct kvm *kvm)
 
        kvm_s390_vcpu_block_all(kvm);
 
-       kvm_for_each_vcpu(i, vcpu, kvm)
+       kvm_for_each_vcpu(i, vcpu, kvm) {
                kvm_s390_vcpu_crypto_setup(vcpu);
+               /* recreate the shadow crycb by leaving the VSIE handler */
+               kvm_s390_sync_request(KVM_REQ_VSIE_RESTART, vcpu);
+       }
 
        kvm_s390_vcpu_unblock_all(kvm);
 }
@@ -3203,6 +3206,8 @@ retry:
 
        /* nothing to do, just clear the request */
        kvm_clear_request(KVM_REQ_UNHALT, vcpu);
+       /* we left the vsie handler, nothing to do, just clear the request */
+       kvm_clear_request(KVM_REQ_VSIE_RESTART, vcpu);
 
        return 0;
 }