summaryrefslogtreecommitdiffstats
path: root/arch/arm/kvm
diff options
context:
space:
mode:
authorMarc Zyngier2012-12-12 15:42:09 +0100
committerChristoffer Dall2013-03-07 00:48:44 +0100
commitcfe3950c2a19c1e1ad85b9dd2622617e309d2845 (patch)
treebcdc30a0d28f61026663d10e9f8b7d9b0e97cd53 /arch/arm/kvm
parentARM: KVM: move kvm_target_cpu to guest.c (diff)
downloadkernel-qcow2-linux-cfe3950c2a19c1e1ad85b9dd2622617e309d2845.tar.gz
kernel-qcow2-linux-cfe3950c2a19c1e1ad85b9dd2622617e309d2845.tar.xz
kernel-qcow2-linux-cfe3950c2a19c1e1ad85b9dd2622617e309d2845.zip
ARM: KVM: fix fault_ipa computing
The ARM ARM says that HPFAR reports bits [39:12] of the faulting IPA, and we need to complement it with the bottom 12 bits of the faulting VA. This is always 12 bits, irrespective of the page size. Makes it clearer in the code. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm/kvm')
-rw-r--r--arch/arm/kvm/mmu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index ec14269a791c..efded4f1a11b 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -606,8 +606,13 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
goto out_unlock;
}
- /* Adjust page offset */
- fault_ipa |= kvm_vcpu_get_hfar(vcpu) & ~PAGE_MASK;
+ /*
+ * The IPA is reported as [MAX:12], so we need to
+ * complement it with the bottom 12 bits from the
+ * faulting VA. This is always 12 bits, irrespective
+ * of the page size.
+ */
+ fault_ipa |= kvm_vcpu_get_hfar(vcpu) & ((1 << 12) - 1);
ret = io_mem_abort(vcpu, run, fault_ipa);
goto out_unlock;
}