Re: [PATCH v2 19/25] KVM: x86/mmu: simplify and/or inline computation of shadow MMU roles

From: Paolo Bonzini
Date: Wed Mar 09 2022 - 05:33:29 EST


On 3/8/22 20:35, Sean Christopherson wrote:
+ 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;


It's not that easy until the very end (when cpu_mode is set in kvm_mmu_init_walker), but I'll make sure to switch to is_efer_lma once it is possible.

Paolo