@@ -491,8 +491,8 @@ enum prot_type {
491491 PROT_TYPE_IEP = 4 ,
492492};
493493
494- static int trans_exc (struct kvm_vcpu * vcpu , int code , unsigned long gva ,
495- u8 ar , enum gacc_mode mode , enum prot_type prot )
494+ static int trans_exc_ending (struct kvm_vcpu * vcpu , int code , unsigned long gva , u8 ar ,
495+ enum gacc_mode mode , enum prot_type prot , bool terminate )
496496{
497497 struct kvm_s390_pgm_info * pgm = & vcpu -> arch .pgm ;
498498 struct trans_exc_code_bits * tec ;
@@ -520,6 +520,11 @@ static int trans_exc(struct kvm_vcpu *vcpu, int code, unsigned long gva,
520520 tec -> b61 = 1 ;
521521 break ;
522522 }
523+ if (terminate ) {
524+ tec -> b56 = 0 ;
525+ tec -> b60 = 0 ;
526+ tec -> b61 = 0 ;
527+ }
523528 fallthrough ;
524529 case PGM_ASCE_TYPE :
525530 case PGM_PAGE_TRANSLATION :
@@ -552,6 +557,12 @@ static int trans_exc(struct kvm_vcpu *vcpu, int code, unsigned long gva,
552557 return code ;
553558}
554559
560+ static int trans_exc (struct kvm_vcpu * vcpu , int code , unsigned long gva , u8 ar ,
561+ enum gacc_mode mode , enum prot_type prot )
562+ {
563+ return trans_exc_ending (vcpu , code , gva , ar , mode , prot , false);
564+ }
565+
555566static int get_vcpu_asce (struct kvm_vcpu * vcpu , union asce * asce ,
556567 unsigned long ga , u8 ar , enum gacc_mode mode )
557568{
@@ -1109,8 +1120,11 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
11091120 data += fragment_len ;
11101121 ga = kvm_s390_logical_to_effective (vcpu , ga + fragment_len );
11111122 }
1112- if (rc > 0 )
1113- rc = trans_exc (vcpu , rc , ga , ar , mode , prot );
1123+ if (rc > 0 ) {
1124+ bool terminate = (mode == GACC_STORE ) && (idx > 0 );
1125+
1126+ rc = trans_exc_ending (vcpu , rc , ga , ar , mode , prot , terminate );
1127+ }
11141128out_unlock :
11151129 if (need_ipte_lock )
11161130 ipte_unlock (vcpu );
0 commit comments