• Anthony Liguori's avatar
    KVM: MMU: Don't assume struct page for x86 · 35149e21
    Anthony Liguori authored
    This patch introduces a gfn_to_pfn() function and corresponding functions like
    kvm_release_pfn_dirty().  Using these new functions, we can modify the x86
    MMU to no longer assume that it can always get a struct page for any given gfn.
    We don't want to eliminate gfn_to_page() entirely because a number of places
    assume they can do gfn_to_page() and then kmap() the results.  When we support
    IO memory, gfn_to_page() will fail for IO pages although gfn_to_pfn() will
    This does not implement support for avoiding reference counting for reserved
    RAM or for IO memory.  However, it should make those things pretty straight
    Since we're only introducing new common symbols, I don't think it will break
    the non-x86 architectures but I haven't tested those.  I've tested Intel,
    AMD, NPT, and hugetlbfs with Windows and Linux guests.
    [avi: fix overflow when shifting left pfns by adding casts]
    Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
    Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
kvm_types.h 1.36 KB