Messages in this thread | | | Date | Tue, 8 Mar 2022 19:41:36 +0000 | From | Sean Christopherson <> | Subject | Re: [PATCH v2 19/25] KVM: x86/mmu: simplify and/or inline computation of shadow MMU roles |
| |
On Tue, Mar 08, 2022, Sean Christopherson wrote: > On Mon, Feb 21, 2022, Paolo Bonzini wrote: > > @@ -4822,18 +4798,23 @@ static void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, > > { > > struct kvm_mmu *context = &vcpu->arch.root_mmu; > > union kvm_mmu_paging_mode cpu_mode = kvm_calc_cpu_mode(vcpu, regs); > > - union kvm_mmu_page_role root_role = > > - kvm_calc_shadow_mmu_root_page_role(vcpu, cpu_mode); > > + union kvm_mmu_page_role root_role; > > > > - shadow_mmu_init_context(vcpu, context, cpu_mode, root_role); > > -} > > + root_role = cpu_mode.base; > > + root_role.level = max_t(u32, root_role.level, PT32E_ROOT_LEVEL); > > Heh, we have different definitions of "simpler". Can we split the difference > and do? > > /* KVM uses PAE paging whenever the guest isn't using 64-bit paging. */ > if (!____is_efer_lma(regs)) > root_role.level = PT32E_ROOT_LEVEL;
Ha, and then the very next patch stomps all over this. I think this just needs to add
BUILD_MMU_ROLE_ACCESSOR(ext, efer, lma);
and do
if (!is_efer_lma(context)) root_role.level = PT32E_ROOT_LEVEL;
| |