Re: [PATCH v2 08/25] KVM: x86/mmu: split cpu_mode from mmu_role

From: Paolo Bonzini
Date: Wed Mar 09 2022 - 10:40:45 EST


On 3/9/22 16:38, Sean Christopherson wrote:
Can we instead tweak that patch to make it and kvm_calc_shadow_npt_root_page_role() be

static union kvm_mmu_role
kvm_calc_shadow_mmu_root_page_role(struct kvm_vcpu *vcpu,
union kvm_mmu_role cpu_role)
{
union kvm_mmu_role root_role = cpu_role;

if (!cpu_role.ext.efer_lma)
root_role.base.level = PT32E_ROOT_LEVEL;
else if (cpu_role.ext.cr4_la57)
root_role.base.level = PT64_ROOT_5LEVEL;
else
root_role.base.level = PT64_ROOT_4LEVEL;

return root_role;
}

Yep, figured the same in the meanwhile.

Paolo