• Sean Christopherson's avatar
    KVM: x86/mmu: Stop using software available bits to denote MMIO SPTEs · 8120337a
    Sean Christopherson authored
    Stop tagging MMIO SPTEs with specific available bits and instead detect
    MMIO SPTEs by checking for their unique SPTE value.  The value is
    guaranteed to be unique on shadow paging and NPT as setting reserved
    physical address bits on any other type of SPTE would consistute a KVM
    bug.  Ditto for EPT, as creating a WX non-MMIO would also be a bug.
    
    Note, this approach is also future-compatibile with TDX, which will need
    to reflect MMIO EPT violations as #VEs into the guest.  To create an EPT
    violation instead of a misconfig, TDX EPTs will need to have RWX=0,  But,
    MMIO SPTEs will also be the only case where KVM clears SUPPRESS_VE, so
    MMIO SPTEs will still be guaranteed to have a unique value within a given
    MMU context.
    
    The main motivation is to make it easier to reason about which types of
    SPTEs use which available bits.  As a happy side effect, this frees up
    two more bits for storing the MMIO generation.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20210225204749.1512652-11-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    8120337a
svm.c 121 KB