@@ -4766,6 +4766,13 @@ static int vcpu_post_run_addressing_exception(struct kvm_vcpu *vcpu)
47664766 return kvm_s390_inject_prog_irq (vcpu , & pgm_info );
47674767}
47684768
4769+ static void kvm_s390_assert_primary_as (struct kvm_vcpu * vcpu )
4770+ {
4771+ KVM_BUG (current -> thread .gmap_teid .as != PSW_BITS_AS_PRIMARY , vcpu -> kvm ,
4772+ "Unexpected program interrupt 0x%x, TEID 0x%016lx" ,
4773+ current -> thread .gmap_int_code , current -> thread .gmap_teid .val );
4774+ }
4775+
47694776static int vcpu_post_run_handle_fault (struct kvm_vcpu * vcpu )
47704777{
47714778 unsigned int flags = 0 ;
@@ -4781,9 +4788,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
47814788 vcpu -> stat .exit_null ++ ;
47824789 break ;
47834790 case PGM_NON_SECURE_STORAGE_ACCESS :
4784- KVM_BUG (current -> thread .gmap_teid .as != PSW_BITS_AS_PRIMARY , vcpu -> kvm ,
4785- "Unexpected program interrupt 0x%x, TEID 0x%016lx" ,
4786- current -> thread .gmap_int_code , current -> thread .gmap_teid .val );
4791+ kvm_s390_assert_primary_as (vcpu );
47874792 /*
47884793 * This is normal operation; a page belonging to a protected
47894794 * guest has not been imported yet. Try to import the page into
@@ -4794,9 +4799,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
47944799 break ;
47954800 case PGM_SECURE_STORAGE_ACCESS :
47964801 case PGM_SECURE_STORAGE_VIOLATION :
4797- KVM_BUG (current -> thread .gmap_teid .as != PSW_BITS_AS_PRIMARY , vcpu -> kvm ,
4798- "Unexpected program interrupt 0x%x, TEID 0x%016lx" ,
4799- current -> thread .gmap_int_code , current -> thread .gmap_teid .val );
4802+ kvm_s390_assert_primary_as (vcpu );
48004803 /*
48014804 * This can happen after a reboot with asynchronous teardown;
48024805 * the new guest (normal or protected) will run on top of the
@@ -4825,9 +4828,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
48254828 case PGM_REGION_FIRST_TRANS :
48264829 case PGM_REGION_SECOND_TRANS :
48274830 case PGM_REGION_THIRD_TRANS :
4828- KVM_BUG (current -> thread .gmap_teid .as != PSW_BITS_AS_PRIMARY , vcpu -> kvm ,
4829- "Unexpected program interrupt 0x%x, TEID 0x%016lx" ,
4830- current -> thread .gmap_int_code , current -> thread .gmap_teid .val );
4831+ kvm_s390_assert_primary_as (vcpu );
48314832 if (vcpu -> arch .gmap -> pfault_enabled ) {
48324833 rc = gmap_fault (vcpu -> arch .gmap , gaddr , flags | FAULT_FLAG_RETRY_NOWAIT );
48334834 if (rc == - EFAULT )
0 commit comments