]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: KVM: fix fault_ipa computing
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 12 Dec 2012 14:42:09 +0000 (14:42 +0000)
committerChristoffer Dall <cdall@cs.columbia.edu>
Wed, 6 Mar 2013 23:48:44 +0000 (15:48 -0800)
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>
arch/arm/kvm/mmu.c

index ec14269a791cf9de5af535b380eea7315ddf3147..efded4f1a11b200eab960f023c5e786aacd03ff4 100644 (file)
@@ -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;
        }