diff options
| author | Binbin Wu <binbin.wu@linux.intel.com> | 2024-11-27 16:43:40 -0800 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-22 13:00:25 -0500 |
| commit | c4c083d95105445ebf1cadfb7d05dd2630976241 (patch) | |
| tree | 03ab07a860124c8a178ada6f62862144f6cf76f1 /arch/x86/kvm/x86.c | |
| parent | KVM: x86: clear vcpu->run->hypercall.ret before exiting for KVM_EXIT_HYPERCALL (diff) | |
| download | linux-c4c083d95105445ebf1cadfb7d05dd2630976241.tar.gz linux-c4c083d95105445ebf1cadfb7d05dd2630976241.zip | |
KVM: x86: Add a helper to check for user interception of KVM hypercalls
Add and use user_exit_on_hypercall() to check if userspace wants to handle
a KVM hypercall instead of open-coding the logic everywhere.
No functional change intended.
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
[sean: squash into one patch, keep explicit KVM_HC_MAP_GPA_RANGE check]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-ID: <20241128004344.4072099-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
| -rw-r--r-- | arch/x86/kvm/x86.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 615cba6fe466..d485a53ac410 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10041,7 +10041,7 @@ unsigned long __kvm_emulate_hypercall(struct kvm_vcpu *vcpu, unsigned long nr, u64 gpa = a0, npages = a1, attrs = a2; ret = -KVM_ENOSYS; - if (!(vcpu->kvm->arch.hypercall_exit_enabled & (1 << KVM_HC_MAP_GPA_RANGE))) + if (!user_exit_on_hypercall(vcpu->kvm, KVM_HC_MAP_GPA_RANGE)) break; if (!PAGE_ALIGNED(gpa) || !npages || |
