KVM: s390: protvirt: Write sthyi data to instruction data area
authorJanosch Frank <frankja@linux.ibm.com>
Thu, 9 May 2019 08:23:16 +0000 (10:23 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 27 Feb 2020 18:47:11 +0000 (19:47 +0100)
STHYI data has to go through the bounce buffer.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
[borntraeger@de.ibm.com: patch merging, splitting, fixing]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/intercept.c

index f907715d94795faace68e6a899c724945fbc1375..6d5e486c82d566aab57e975b51d2ea4056563d21 100644 (file)
@@ -392,7 +392,7 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
                goto out;
        }
 
-       if (addr & ~PAGE_MASK)
+       if (!kvm_s390_pv_cpu_is_protected(vcpu) && (addr & ~PAGE_MASK))
                return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
        sctns = (void *)get_zeroed_page(GFP_KERNEL);
@@ -403,10 +403,15 @@ int handle_sthyi(struct kvm_vcpu *vcpu)
 
 out:
        if (!cc) {
-               r = write_guest(vcpu, addr, reg2, sctns, PAGE_SIZE);
-               if (r) {
-                       free_page((unsigned long)sctns);
-                       return kvm_s390_inject_prog_cond(vcpu, r);
+               if (kvm_s390_pv_cpu_is_protected(vcpu)) {
+                       memcpy((void *)(sida_origin(vcpu->arch.sie_block)),
+                              sctns, PAGE_SIZE);
+               } else {
+                       r = write_guest(vcpu, addr, reg2, sctns, PAGE_SIZE);
+                       if (r) {
+                               free_page((unsigned long)sctns);
+                               return kvm_s390_inject_prog_cond(vcpu, r);
+                       }
                }
        }