• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot() in page fault handler · 31c8b0d0
    Paul Mackerras authored
    This changes the hypervisor page fault handler for radix guests to use
    the generic KVM __gfn_to_pfn_memslot() function instead of using
    get_user_pages_fast() and then handling the case of VM_PFNMAP vmas
    specially.  The old code missed the case of VM_IO vmas; with this
    change, VM_IO vmas will now be handled correctly by code within
    __gfn_to_pfn_memslot.
    
    Currently, __gfn_to_pfn_memslot calls hva_to_pfn, which only uses
    __get_user_pages_fast for the initial lookup in the cases where
    either atomic or async is set.  Since we are not setting either
    atomic or async, we do our own __get_user_pages_fast first, for now.
    
    This also adds code to check for the KVM_MEM_READONLY flag on the
    memslot.  If it is set and this is a write access, we synthesize a
    data storage interrupt for the guest.
    
    In the case where the page is not normal RAM (i.e. page == NULL in
    kvmppc_book3s_radix_page_fault(), we read the PTE from the Linux page
    tables because we need the mapping attribute bits as well as the PFN.
    (The mapping attribute bits indicate whether accesses have to be
    non-cacheable and/or guarded.)
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    31c8b0d0
book3s_64_mmu_radix.c 20.3 KB