Skip to content

Commit fe660f7

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Collapse 32-bit PAE and 64-bit statements for helpers
Skip paging32E_init_context() and paging64_init_context_common() and go directly to paging64_init_context() (was the common version) now that the relevant flows don't need to distinguish between 64-bit PAE and 32-bit PAE for other reasons. No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210622175739.3610207-46-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent f4bd6f7 commit fe660f7

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

arch/x86/kvm/mmu/mmu.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4531,21 +4531,15 @@ static void reset_guest_paging_metadata(struct kvm_vcpu *vcpu,
45314531
update_last_nonleaf_level(mmu);
45324532
}
45334533

4534-
static void paging64_init_context_common(struct kvm_mmu *context)
4534+
static void paging64_init_context(struct kvm_mmu *context)
45354535
{
4536-
WARN_ON_ONCE(!is_cr4_pae(context));
45374536
context->page_fault = paging64_page_fault;
45384537
context->gva_to_gpa = paging64_gva_to_gpa;
45394538
context->sync_page = paging64_sync_page;
45404539
context->invlpg = paging64_invlpg;
45414540
context->direct_map = false;
45424541
}
45434542

4544-
static void paging64_init_context(struct kvm_mmu *context)
4545-
{
4546-
paging64_init_context_common(context);
4547-
}
4548-
45494543
static void paging32_init_context(struct kvm_mmu *context)
45504544
{
45514545
context->page_fault = paging32_page_fault;
@@ -4555,11 +4549,6 @@ static void paging32_init_context(struct kvm_mmu *context)
45554549
context->direct_map = false;
45564550
}
45574551

4558-
static void paging32E_init_context(struct kvm_mmu *context)
4559-
{
4560-
paging64_init_context_common(context);
4561-
}
4562-
45634552
static union kvm_mmu_extended_role kvm_calc_mmu_role_ext(struct kvm_vcpu *vcpu,
45644553
struct kvm_mmu_role_regs *regs)
45654554
{
@@ -4650,8 +4639,6 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
46504639

46514640
if (!is_paging(vcpu))
46524641
context->gva_to_gpa = nonpaging_gva_to_gpa;
4653-
else if (is_long_mode(vcpu))
4654-
context->gva_to_gpa = paging64_gva_to_gpa;
46554642
else if (is_pae(vcpu))
46564643
context->gva_to_gpa = paging64_gva_to_gpa;
46574644
else
@@ -4704,10 +4691,8 @@ static void shadow_mmu_init_context(struct kvm_vcpu *vcpu, struct kvm_mmu *conte
47044691

47054692
if (!____is_cr0_pg(regs))
47064693
nonpaging_init_context(context);
4707-
else if (____is_efer_lma(regs))
4708-
paging64_init_context(context);
47094694
else if (____is_cr4_pae(regs))
4710-
paging32E_init_context(context);
4695+
paging64_init_context(context);
47114696
else
47124697
paging32_init_context(context);
47134698
context->root_level = role_regs_to_root_level(regs);

0 commit comments

Comments
 (0)