Skip to content

Commit 8ccd51c

Browse files
dmatlacksean-jc
authored andcommitted
KVM: x86/mmu: Drop @max_level from kvm_mmu_max_mapping_level()
Drop the @max_level parameter from kvm_mmu_max_mapping_level(). All callers pass in PG_LEVEL_NUM, so @max_level can be replaced with PG_LEVEL_NUM in the function body. No functional change intended. Signed-off-by: David Matlack <dmatlack@google.com> Link: https://lore.kernel.org/r/20240823235648.3236880-2-dmatlack@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent b9883ee commit 8ccd51c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,13 +3114,12 @@ static int __kvm_mmu_max_mapping_level(struct kvm *kvm,
31143114
}
31153115

31163116
int kvm_mmu_max_mapping_level(struct kvm *kvm,
3117-
const struct kvm_memory_slot *slot, gfn_t gfn,
3118-
int max_level)
3117+
const struct kvm_memory_slot *slot, gfn_t gfn)
31193118
{
31203119
bool is_private = kvm_slot_can_be_private(slot) &&
31213120
kvm_mem_is_private(kvm, gfn);
31223121

3123-
return __kvm_mmu_max_mapping_level(kvm, slot, gfn, max_level, is_private);
3122+
return __kvm_mmu_max_mapping_level(kvm, slot, gfn, PG_LEVEL_NUM, is_private);
31243123
}
31253124

31263125
void kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
@@ -6919,8 +6918,7 @@ static bool kvm_mmu_zap_collapsible_spte(struct kvm *kvm,
69196918
* mapping if the indirect sp has level = 1.
69206919
*/
69216920
if (sp->role.direct &&
6922-
sp->role.level < kvm_mmu_max_mapping_level(kvm, slot, sp->gfn,
6923-
PG_LEVEL_NUM)) {
6921+
sp->role.level < kvm_mmu_max_mapping_level(kvm, slot, sp->gfn)) {
69246922
kvm_zap_one_rmap_spte(kvm, rmap_head, sptep);
69256923

69266924
if (kvm_available_flush_remote_tlbs_range())

arch/x86/kvm/mmu/mmu_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
346346
}
347347

348348
int kvm_mmu_max_mapping_level(struct kvm *kvm,
349-
const struct kvm_memory_slot *slot, gfn_t gfn,
350-
int max_level);
349+
const struct kvm_memory_slot *slot, gfn_t gfn);
351350
void kvm_mmu_hugepage_adjust(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault);
352351
void disallowed_hugepage_adjust(struct kvm_page_fault *fault, u64 spte, int cur_level);
353352

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm,
16261626
if (iter.gfn < start || iter.gfn >= end)
16271627
continue;
16281628

1629-
max_mapping_level = kvm_mmu_max_mapping_level(kvm, slot,
1630-
iter.gfn, PG_LEVEL_NUM);
1629+
max_mapping_level = kvm_mmu_max_mapping_level(kvm, slot, iter.gfn);
16311630
if (max_mapping_level < iter.level)
16321631
continue;
16331632

0 commit comments

Comments
 (0)