aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.h
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@linux.alibaba.com>2021-11-24 20:20:45 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2021-12-08 04:25:11 -0500
commitc59a0f57fa32cfa77643daa17a8e55377cc9fe0b (patch)
treef5be62c8c6af8bc3ed1cdf928090d23b6c6a8a9d /arch/x86/kvm/mmu.h
parentKVM: X86: Add parameter struct kvm_mmu *mmu into mmu->gva_to_gpa() (diff)
downloadlinux-dev-c59a0f57fa32cfa77643daa17a8e55377cc9fe0b.tar.xz
linux-dev-c59a0f57fa32cfa77643daa17a8e55377cc9fe0b.zip
KVM: X86: Remove mmu->translate_gpa
Reduce an indirect function call (retpoline) and some intialization code. Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> Message-Id: <20211124122055.64424-4-jiangshanlai@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.h')
-rw-r--r--arch/x86/kvm/mmu.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 9ae6168d381e..97e13c2988b3 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -351,4 +351,17 @@ static inline void kvm_update_page_stats(struct kvm *kvm, int level, int count)
{
atomic64_add(count, &kvm->stat.pages[level - 1]);
}
+
+gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access,
+ struct x86_exception *exception);
+
+static inline gpa_t kvm_translate_gpa(struct kvm_vcpu *vcpu,
+ struct kvm_mmu *mmu,
+ gpa_t gpa, u32 access,
+ struct x86_exception *exception)
+{
+ if (mmu != &vcpu->arch.nested_mmu)
+ return gpa;
+ return translate_nested_gpa(vcpu, gpa, access, exception);
+}
#endif