• Sean Christopherson's avatar
    KVM: x86/mmu: Use separate namespaces for guest PTEs and shadow PTEs · 2ca3129e
    Sean Christopherson authored
    Separate the macros for KVM's shadow PTEs (SPTE) from guest 64-bit PTEs
    (PT64).  SPTE and PT64 are _mostly_ the same, but the few differences are
    quite critical, e.g. *_BASE_ADDR_MASK must differentiate between host and
    guest physical address spaces, and SPTE_PERM_MASK (was PT64_PERM_MASK) is
    very much specific to SPTEs.
    
    Opportunistically (and temporarily) move most guest macros into paging.h
    to clearly associate them with shadow paging, and to ensure that they're
    not used as of this commit.  A future patch will eliminate them entirely.
    
    Sadly, PT32_LEVEL_BITS is left behind in mmu_internal.h because it's
    needed for the quadrant calculation in kvm_mmu_get_page().  The quadrant
    calculation is hot enough (when using shadow paging with 32-bit guests)
    that adding a per-context helper is undesirable, and burying the
    computation in paging_tmpl.h with a forward declaration isn't exactly an
    improvement.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20220614233328.3896033-6-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    2ca3129e
paging_tmpl.h 31.9 KB