• Sean Christopherson's avatar
    KVM: x86/mmu: Do not apply HPA (memory encryption) mask to GPAs · fc9bf2e0
    Sean Christopherson authored
    Ignore "dynamic" host adjustments to the physical address mask when
    generating the masks for guest PTEs, i.e. the guest PA masks.  The host
    physical address space and guest physical address space are two different
    beasts, e.g. even though SEV's C-bit is the same bit location for both
    host and guest, disabling SME in the host (which clears shadow_me_mask)
    does not affect the guest PTE->GPA "translation".
    
    For non-SEV guests, not dropping bits is the correct behavior.  Assuming
    KVM and userspace correctly enumerate/configure guest MAXPHYADDR, bits
    that are lost as collateral damage from memory encryption are treated as
    reserved bits, i.e. KVM will never get to the point where it attempts to
    generate a gfn using the affected bits.  And if userspace wants to create
    a bogus vCPU, then userspace gets to deal with the fallout of hardware
    doing odd things with bad GPAs.
    
    For SEV guests, not dropping the C-bit is technically wrong, but it's a
    moot poi...
    fc9bf2e0
paging.h 562 Bytes