• Sean Christopherson's avatar
    KVM: x86/mmu: Add struct and helpers to retrieve MMU role bits from regs · 594e91a1
    Sean Christopherson authored
    Introduce "struct kvm_mmu_role_regs" to hold the register state that is
    incorporated into the mmu_role.  For nested TDP, the register state that
    is factored into the MMU isn't vCPU state; the dedicated struct will be
    used to propagate the correct state throughout the flows without having
    to pass multiple params, and also provides helpers for the various flag
    accessors.
    
    Intentionally make the new helpers cumbersome/ugly by prepending four
    underscores.  In the not-too-distant future, it will be preferable to use
    the mmu_role to query bits as the mmu_role can drop irrelevant bits
    without creating contradictions, e.g. clearing CR4 bits when CR0.PG=0.
    Reserve the clean helper names (no underscores) for the mmu_role.
    
    Add a helper for vCPU conversion, which is the common case.
    
    No functional change intended.
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20210622175739.3610207-21-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    594e91a1
mmu.c 164 KB