diff options
author | Joao Martins <joao.m.martins@oracle.com> | 2018-06-13 15:55:44 +0200 |
---|---|---|
committer | David Woodhouse <dwmw@amazon.co.uk> | 2021-02-04 15:19:24 +0100 |
commit | 79033bebf6fa3045bfa9bbe543c0eb7b43a0f4a3 (patch) | |
tree | 7b1eebd8240021a79f43d43161f69667a1a72863 /arch/x86/kvm/xen.c | |
parent | KVM: x86/xen: intercept xen hypercalls if enabled (diff) | |
download | linux-79033bebf6fa3045bfa9bbe543c0eb7b43a0f4a3.tar.xz linux-79033bebf6fa3045bfa9bbe543c0eb7b43a0f4a3.zip |
KVM: x86/xen: Fix coexistence of Xen and Hyper-V hypercalls
Disambiguate Xen vs. Hyper-V calls by adding 'orl $0x80000000, %eax'
at the start of the Hyper-V hypercall page when Xen hypercalls are
also enabled.
That bit is reserved in the Hyper-V ABI, and those hypercall numbers
will never be used by Xen (because it does precisely the same trick).
Switch to using kvm_vcpu_write_guest() while we're at it, instead of
open-coding it.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Diffstat (limited to 'arch/x86/kvm/xen.c')
-rw-r--r-- | arch/x86/kvm/xen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 62569ca43857..19bcb2bfba86 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -8,6 +8,7 @@ #include "x86.h" #include "xen.h" +#include "hyperv.h" #include <linux/kvm_host.h> @@ -101,6 +102,11 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu) input = (u64)kvm_register_read(vcpu, VCPU_REGS_RAX); + /* Hyper-V hypercalls get bit 31 set in EAX */ + if ((input & 0x80000000) && + kvm_hv_hypercall_enabled(vcpu->kvm)) + return kvm_hv_hypercall(vcpu); + longmode = is_64_bit_mode(vcpu); if (!longmode) { params[0] = (u32)kvm_rbx_read(vcpu); |