KVM: x86/mmu: cleanup computation of MMU roles for two-dimensional paging
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Feb 2022 12:33:08 +0000 (07:33 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 29 Apr 2022 16:49:55 +0000 (12:49 -0400)
commit2ba676774dfc9369f67f30cd3b4f58ccda907c24
treed6379ba7e57e2e4a86a22f745ce7d2a6d5fa1afb
parent19b5dcc3be2efe93760372f444dec44e77f67146
KVM: x86/mmu: cleanup computation of MMU roles for two-dimensional paging

Inline kvm_calc_mmu_role_common into its sole caller, and simplify it
by removing the computation of unnecessary bits.

Extended bits are unnecessary because page walking uses the CPU role,
and EFER.NX/CR0.WP can be set to one unconditionally---matching the
format of shadow pages rather than the format of guest pages.

The MMU role for two dimensional paging does still depend on the CPU role,
even if only barely so, due to SMM and guest mode; for consistency,
pass it down to kvm_calc_tdp_mmu_root_page_role instead of querying
the vcpu with is_smm or is_guest_mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c