KVM: x86/xen: intercept xen hypercalls if enabled
Add a new exit reason for emulator to handle Xen hypercalls. Since this means KVM owns the ABI, dispense with the facility for the VMM to provide its own copy of the hypercall pages; just fill them in directly using VMCALL/VMMCALL as we do for the Hyper-V hypercall page. This behaviour is enabled by a new INTERCEPT_HCALL flag in the KVM_XEN_HVM_CONFIG ioctl structure, and advertised by the same flag being returned from the KVM_CAP_XEN_HVM check. Rename xen_hvm_config() to kvm_xen_write_hypercall_page() and move it to the nascent xen.c while we're at it, and add a test case. Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
This commit is contained in:
committed by
David Woodhouse
parent
92f4d400a4
commit
23200b7a30
@@ -216,6 +216,20 @@ struct kvm_hyperv_exit {
|
||||
} u;
|
||||
};
|
||||
|
||||
struct kvm_xen_exit {
|
||||
#define KVM_EXIT_XEN_HCALL 1
|
||||
__u32 type;
|
||||
union {
|
||||
struct {
|
||||
__u32 longmode;
|
||||
__u32 cpl;
|
||||
__u64 input;
|
||||
__u64 result;
|
||||
__u64 params[6];
|
||||
} hcall;
|
||||
} u;
|
||||
};
|
||||
|
||||
#define KVM_S390_GET_SKEYS_NONE 1
|
||||
#define KVM_S390_SKEYS_MAX 1048576
|
||||
|
||||
@@ -253,6 +267,7 @@ struct kvm_hyperv_exit {
|
||||
#define KVM_EXIT_DIRTY_RING_FULL 31
|
||||
#define KVM_EXIT_AP_RESET_HOLD 32
|
||||
#define KVM_EXIT_X86_BUS_LOCK 33
|
||||
#define KVM_EXIT_XEN 34
|
||||
|
||||
/* For KVM_EXIT_INTERNAL_ERROR */
|
||||
/* Emulate instruction failed. */
|
||||
@@ -429,6 +444,8 @@ struct kvm_run {
|
||||
__u32 index; /* kernel -> user */
|
||||
__u64 data; /* kernel <-> user */
|
||||
} msr;
|
||||
/* KVM_EXIT_XEN */
|
||||
struct kvm_xen_exit xen;
|
||||
/* Fix the size of the union. */
|
||||
char padding[256];
|
||||
};
|
||||
@@ -1133,6 +1150,9 @@ struct kvm_x86_mce {
|
||||
#endif
|
||||
|
||||
#ifdef KVM_CAP_XEN_HVM
|
||||
#define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR (1 << 0)
|
||||
#define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1)
|
||||
|
||||
struct kvm_xen_hvm_config {
|
||||
__u32 flags;
|
||||
__u32 msr;
|
||||
|
||||
Reference in New Issue
Block a user