ANDROID: KVM: arm64: FAR_EL2 mask as a define

Create a macro definition for the FAR_EL2 mask and use it instead
of a hard-coded value, and put it in a share header to be used by
hyp.

No functional change intended.

Bug: 209580772
Change-Id: Ib83932d670cba6bf8f1ed45d2c0e1ed34331d98d
Signed-off-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Fuad Tabba
2021-10-12 15:18:45 +01:00
committed by Quentin Perret
parent 2e5989b503
commit 7c4000b1ea
2 changed files with 3 additions and 1 deletions

View File

@@ -344,6 +344,8 @@
#define PAR_TO_HPFAR(par) \
(((par) & GENMASK_ULL(PHYS_MASK_SHIFT - 1, 12)) >> 8)
#define FAR_MASK GENMASK_ULL(11, 0)
#define ECN(x) { ESR_ELx_EC_##x, #x }
#define kvm_arm_exception_class \

View File

@@ -1678,7 +1678,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
* faulting VA. This is always 12 bits, irrespective
* of the page size.
*/
fault_ipa |= kvm_vcpu_get_hfar(vcpu) & ((1 << 12) - 1);
fault_ipa |= kvm_vcpu_get_hfar(vcpu) & FAR_MASK;
ret = io_mem_abort(vcpu, fault_ipa);
goto out_unlock;
}