Skip to content

Commit 2032195

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Add convenience wrapper for acting on single hva in TDP MMU
Add a TDP MMU helper to handle a single HVA hook, the name is a nice reminder that the flow in question is operating on a single HVA. No functional change intended. Cc: Ben Gardon <bgardon@google.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20210226010329.1766033-6-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent c1b9149 commit 2032195

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎arch/x86/kvm/mmu/tdp_mmu.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,14 @@ static __always_inline int kvm_tdp_mmu_handle_hva_range(struct kvm *kvm,
920920
return ret;
921921
}
922922

923+
static __always_inline int kvm_tdp_mmu_handle_hva(struct kvm *kvm,
924+
unsigned long addr,
925+
unsigned long data,
926+
tdp_handler_t handler)
927+
{
928+
return kvm_tdp_mmu_handle_hva_range(kvm, addr, addr + 1, data, handler);
929+
}
930+
923931
static int zap_gfn_range_hva_wrapper(struct kvm *kvm,
924932
struct kvm_memory_slot *slot,
925933
struct kvm_mmu_page *root, gfn_t start,
@@ -1007,8 +1015,7 @@ static int test_age_gfn(struct kvm *kvm, struct kvm_memory_slot *slot,
10071015

10081016
int kvm_tdp_mmu_test_age_hva(struct kvm *kvm, unsigned long hva)
10091017
{
1010-
return kvm_tdp_mmu_handle_hva_range(kvm, hva, hva + 1, 0,
1011-
test_age_gfn);
1018+
return kvm_tdp_mmu_handle_hva(kvm, hva, 0, test_age_gfn);
10121019
}
10131020

10141021
/*
@@ -1069,9 +1076,8 @@ static int set_tdp_spte(struct kvm *kvm, struct kvm_memory_slot *slot,
10691076
int kvm_tdp_mmu_set_spte_hva(struct kvm *kvm, unsigned long address,
10701077
pte_t *host_ptep)
10711078
{
1072-
return kvm_tdp_mmu_handle_hva_range(kvm, address, address + 1,
1073-
(unsigned long)host_ptep,
1074-
set_tdp_spte);
1079+
return kvm_tdp_mmu_handle_hva(kvm, address, (unsigned long)host_ptep,
1080+
set_tdp_spte);
10751081
}
10761082

10771083
/*

0 commit comments

Comments
 (0)