aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2016-01-27 11:18:41 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-20 03:54:34 -0400
commit7a6741576b268820c8bd2b66288e6ff3bc57d4a7 (patch)
tree305b26510f3c526c03f2cc0ab0bc35b7b71a813b
parente52f8b6112353e9e8eac64f082bfbc65e64bb2dd (diff)
s390/mm: protection exceptions are corrrectly shadowed
As gmap shadows contains correct protection permissions, protection exceptons can directly be forwarded to guest 3. If we would encounter a protection exception while faulting, the next guest 3 run will automatically handle that for us. Keep the dat_protection logic in place, as it will be helpful later. Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/kvm/gaccess.c6
-rw-r--r--arch/s390/kvm/gaccess.h2
2 files changed, 2 insertions, 6 deletions
diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index 5b5eee2d51cd..b2783dd71854 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -1075,7 +1075,6 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
1075 * kvm_s390_shadow_fault - handle fault on a shadow page table 1075 * kvm_s390_shadow_fault - handle fault on a shadow page table
1076 * @sg: pointer to the shadow guest address space structure 1076 * @sg: pointer to the shadow guest address space structure
1077 * @saddr: faulting address in the shadow gmap 1077 * @saddr: faulting address in the shadow gmap
1078 * @write: =1 map r/w, =0 map r/o
1079 * 1078 *
1080 * Returns: - 0 if the shadow fault was successfully resolved 1079 * Returns: - 0 if the shadow fault was successfully resolved
1081 * - > 0 (pgm exception code) on exceptions while faulting 1080 * - > 0 (pgm exception code) on exceptions while faulting
@@ -1083,7 +1082,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
1083 * - -EFAULT when accessing invalid guest addresses 1082 * - -EFAULT when accessing invalid guest addresses
1084 * - -ENOMEM if out of memory 1083 * - -ENOMEM if out of memory
1085 */ 1084 */
1086int kvm_s390_shadow_fault(struct gmap *sg, unsigned long saddr, int write) 1085int kvm_s390_shadow_fault(struct gmap *sg, unsigned long saddr)
1087{ 1086{
1088 union vaddress vaddr; 1087 union vaddress vaddr;
1089 union page_table_entry pte; 1088 union page_table_entry pte;
@@ -1104,9 +1103,6 @@ int kvm_s390_shadow_fault(struct gmap *sg, unsigned long saddr, int write)
1104 rc = PGM_PAGE_TRANSLATION; 1103 rc = PGM_PAGE_TRANSLATION;
1105 if (!rc && (pte.z || pte.co)) 1104 if (!rc && (pte.z || pte.co))
1106 rc = PGM_TRANSLATION_SPEC; 1105 rc = PGM_TRANSLATION_SPEC;
1107 dat_protection |= pte.p;
1108 if (!rc && write && dat_protection)
1109 rc = PGM_PROTECTION;
1110 if (!rc) 1106 if (!rc)
1111 rc = gmap_shadow_page(sg, saddr, __pte(pte.val)); 1107 rc = gmap_shadow_page(sg, saddr, __pte(pte.val));
1112 up_read(&sg->mm->mmap_sem); 1108 up_read(&sg->mm->mmap_sem);
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index e5ec4734d42d..0d044d09dbd8 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -361,6 +361,6 @@ void ipte_unlock(struct kvm_vcpu *vcpu);
361int ipte_lock_held(struct kvm_vcpu *vcpu); 361int ipte_lock_held(struct kvm_vcpu *vcpu);
362int kvm_s390_check_low_addr_prot_real(struct kvm_vcpu *vcpu, unsigned long gra); 362int kvm_s390_check_low_addr_prot_real(struct kvm_vcpu *vcpu, unsigned long gra);
363 363
364int kvm_s390_shadow_fault(struct gmap *shadow, unsigned long saddr, int write); 364int kvm_s390_shadow_fault(struct gmap *shadow, unsigned long saddr);
365 365
366#endif /* __KVM_S390_GACCESS_H */ 366#endif /* __KVM_S390_GACCESS_H */