• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Fix calculation of guest phys address for MMIO emulation · 70bddfef
    Paul Mackerras authored
    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: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
    70bddfef
book3s_64_mmu_hv.c 29.4 KB