• Sean Christopherson's avatar
    KVM: x86/mmu: Pivot on "TDP MMU enabled" to check if active MMU is TDP MMU · f2e4535c
    Sean Christopherson authored
    Simplify and optimize the logic for detecting if the current/active MMU
    is a TDP MMU.  If the TDP MMU is globally enabled, then the active MMU is
    a TDP MMU if it is direct.  When TDP is enabled, so called nonpaging MMUs
    are never used as the only form of shadow paging KVM uses is for nested
    TDP, and the active MMU can't be direct in that case.
    
    Rename the helper and take the vCPU instead of an arbitrary MMU, as
    nonpaging MMUs can show up in the walk_mmu if L1 is using nested TDP and
    L2 has paging disabled.  Taking the vCPU has the added bonus of cleaning
    up the callers, all of which check the current MMU but wrap code that
    consumes the vCPU.
    
    No functional change intended.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20221012181702.3663607-9-seanjc@google.com>
    [Use tdp_mmu_enabled variable. - Paolo]
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    f2e4535c
tdp_mmu.h 2.57 KB