• Sean Christopherson's avatar
    KVM: x86/mmu: Mark the PAE roots as decrypted for shadow paging · 4a98623d
    Sean Christopherson authored
    Set the PAE roots used as decrypted to play nice with SME when KVM is
    using shadow paging.  Explicitly skip setting the C-bit when loading
    CR3 for PAE shadow paging, even though it's completely ignored by the
    CPU.  The extra documentation is nice to have.
    
    Note, there are several subtleties at play with NPT.  In addition to
    legacy shadow paging, the PAE roots are used for SVM's NPT when either
    KVM is 32-bit (uses PAE paging) or KVM is 64-bit and shadowing 32-bit
    NPT.  However, 32-bit Linux, and thus KVM, doesn't support SME.  And
    64-bit KVM can happily set the C-bit in CR3.  This also means that
    keeping __sme_set(root) for 32-bit KVM when NPT is enabled is
    conceptually wrong, but functionally ok since SME is 64-bit only.
    Leave it as is to avoid unnecessary pollution.
    
    Fixes: d0ec49d4 ("kvm/x86/svm: Support Secure Memory Encryption within KVM")
    Cc: stable@vger.kernel.org
    Cc: Brijesh Singh <brijesh.singh@amd.com>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20210309224207.1218275-5-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    4a98623d
mmu.c 158 KB