]> git.karo-electronics.de Git - karo-tx-linux.git/commit
KVM: PPC: Book3S HV: Fix calculation of guest phys address for MMIO emulation
authorPaul Mackerras <paulus@samba.org>
Thu, 20 Sep 2012 19:39:21 +0000 (19:39 +0000)
committerAlexander Graf <agraf@suse.de>
Fri, 5 Oct 2012 21:34:04 +0000 (23:34 +0200)
commit6e199bc1859555bbd9b7c4aed3d6fea7fcbcab22
tree64196d1bffa4379dfcf6ed6c4e809ba138ae44cc
parent2123e6a1b5f6056f51ba90a715e8c24c86abd7ea
KVM: PPC: Book3S HV: Fix calculation of guest phys address for MMIO emulation

In the case where the host kernel is using a 64kB base page size and
the guest uses a 4k HPTE (hashed page table entry) to map an emulated
MMIO device, we were calculating the guest physical address wrongly.
We were calculating a gfn as the guest physical address shifted right
16 bits (PAGE_SHIFT) but then only adding back in 12 bits from the
effective address, since the HPTE had a 4k page size.  Thus the gpa
reported to userspace was missing 4 bits.

Instead, we now compute the guest physical address from the HPTE
without reference to the host page size, and then compute the gfn
by shifting the gpa right PAGE_SHIFT bits.

Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/book3s_64_mmu_hv.c