aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/gaccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm/gaccess.c')
-rw-r--r--arch/s390/kvm/gaccess.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index 633fe9bd75a9..c230904429cc 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -697,28 +697,29 @@ int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva,
697} 697}
698 698
699/** 699/**
700 * kvm_s390_check_low_addr_protection - check for low-address protection 700 * kvm_s390_check_low_addr_prot_real - check for low-address protection
701 * @ga: Guest address 701 * @gra: Guest real address
702 * 702 *
703 * Checks whether an address is subject to low-address protection and set 703 * Checks whether an address is subject to low-address protection and set
704 * up vcpu->arch.pgm accordingly if necessary. 704 * up vcpu->arch.pgm accordingly if necessary.
705 * 705 *
706 * Return: 0 if no protection exception, or PGM_PROTECTION if protected. 706 * Return: 0 if no protection exception, or PGM_PROTECTION if protected.
707 */ 707 */
708int kvm_s390_check_low_addr_protection(struct kvm_vcpu *vcpu, unsigned long ga) 708int kvm_s390_check_low_addr_prot_real(struct kvm_vcpu *vcpu, unsigned long gra)
709{ 709{
710 struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm; 710 struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm;
711 psw_t *psw = &vcpu->arch.sie_block->gpsw; 711 psw_t *psw = &vcpu->arch.sie_block->gpsw;
712 struct trans_exc_code_bits *tec_bits; 712 struct trans_exc_code_bits *tec_bits;
713 union ctlreg0 ctlreg0 = {.val = vcpu->arch.sie_block->gcr[0]};
713 714
714 if (!is_low_address(ga) || !low_address_protection_enabled(vcpu)) 715 if (!ctlreg0.lap || !is_low_address(gra))
715 return 0; 716 return 0;
716 717
717 memset(pgm, 0, sizeof(*pgm)); 718 memset(pgm, 0, sizeof(*pgm));
718 tec_bits = (struct trans_exc_code_bits *)&pgm->trans_exc_code; 719 tec_bits = (struct trans_exc_code_bits *)&pgm->trans_exc_code;
719 tec_bits->fsi = FSI_STORE; 720 tec_bits->fsi = FSI_STORE;
720 tec_bits->as = psw_bits(*psw).as; 721 tec_bits->as = psw_bits(*psw).as;
721 tec_bits->addr = ga >> PAGE_SHIFT; 722 tec_bits->addr = gra >> PAGE_SHIFT;
722 pgm->code = PGM_PROTECTION; 723 pgm->code = PGM_PROTECTION;
723 724
724 return pgm->code; 725 return pgm->code;