Skip to content

Commit 36f2678

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Use MMU's role to determine PTTYPE
Use the MMU's role instead of vCPU state or role_regs to determine the PTTYPE, i.e. which helpers to wire up. No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210622175739.3610207-47-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent fe660f7 commit 36f2678

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/x86/kvm/mmu/mmu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4637,9 +4637,9 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
46374637
context->inject_page_fault = kvm_inject_page_fault;
46384638
context->root_level = role_regs_to_root_level(&regs);
46394639

4640-
if (!is_paging(vcpu))
4640+
if (!is_cr0_pg(context))
46414641
context->gva_to_gpa = nonpaging_gva_to_gpa;
4642-
else if (is_pae(vcpu))
4642+
else if (is_cr4_pae(context))
46434643
context->gva_to_gpa = paging64_gva_to_gpa;
46444644
else
46454645
context->gva_to_gpa = paging32_gva_to_gpa;
@@ -4689,9 +4689,9 @@ static void shadow_mmu_init_context(struct kvm_vcpu *vcpu, struct kvm_mmu *conte
46894689

46904690
context->mmu_role.as_u64 = new_role.as_u64;
46914691

4692-
if (!____is_cr0_pg(regs))
4692+
if (!is_cr0_pg(context))
46934693
nonpaging_init_context(context);
4694-
else if (____is_cr4_pae(regs))
4694+
else if (is_cr4_pae(context))
46954695
paging64_init_context(context);
46964696
else
46974697
paging32_init_context(context);

0 commit comments

Comments
 (0)