]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commita3aaa653136d1d2b9e1857e85f7891e15960fad4
treed6379ba7e57e2e4a86a22f745ce7d2a6d5fa1afb
parenta374f5ba73b37ecb17f7df0073dba9a9c7b6f9f5
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