KVM: x86/mmu: split cpu_role from mmu_role
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 11 Feb 2022 11:50:11 +0000 (06:50 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 29 Apr 2022 16:49:53 +0000 (12:49 -0400)
commite5ed0fb01004f93ddf8a0c632cbc8a3f1ea5b518
treefd59eecd3558d9126ae32361880eb8900946031c
parentb89805082adf1f502b1f0b993063e938e1bcb098
KVM: x86/mmu: split cpu_role from mmu_role

Snapshot the state of the processor registers that govern page walk into
a new field of struct kvm_mmu.  This is a more natural representation
than having it *mostly* in mmu_role but not exclusively; the delta
right now is represented in other fields, such as root_level.

The nested MMU now has only the CPU role; and in fact the new function
kvm_calc_cpu_role is analogous to the previous kvm_calc_nested_mmu_role,
except that it has role.base.direct equal to !CR0.PG.  For a walk-only
MMU, "direct" has no meaning, but we set it to !CR0.PG so that
role.ext.cr0_pg can go away in a future patch.

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