• James Hogan's avatar
    KVM: MIPS/MMU: Convert guest physical map to page table · 06c158c9
    James Hogan authored
    Current guest physical memory is mapped to host physical addresses using
    a single linear array (guest_pmap of length guest_pmap_npages). This was
    only really meant to be temporary, and isn't sparse, so its wasteful of
    memory. A small amount of RAM at GPA 0 and a small boot exception vector
    at GPA 0x1fc00000 cannot be represented without a full 128KiB guest_pmap
    allocation (MIPS32 with 16KiB pages), which is one reason why QEMU
    currently runs its boot code at the top of RAM instead of the usual boot
    exception vector address.
    
    Instead use the existing infrastructure for host virtual page table
    management to allocate a page table for guest physical memory too. This
    should be sufficient for now, assuming the size of physical memory
    doesn't exceed the size of virtual memory. It may need extending in
    future to handle XPA (eXtended Physical Addressing) in 32-bit guests, as
    supported by VZ guests on P5600.
    
    Some of this code is based loosely on Cavium's VZ KVM implementation.
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: "Radim Krčmář" <rkrcmar@redhat.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    06c158c9
mmu.c 18.3 KB