]> asedeno.scripts.mit.edu Git - linux.git/commit
KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot() in page fault handler
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 1 Mar 2018 04:14:02 +0000 (15:14 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Tue, 27 Mar 2018 21:27:58 +0000 (08:27 +1100)
commit31c8b0d0694a1f7e3b46df0d1341a874ecb5e0de
treefa5d51b339894ee6a2f4e497b89fef598efadc56
parent58c5c276b4c2ceb2b02ecd959ad9784b997d4332
KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot() in page fault handler

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: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_64_mmu_radix.c