History

kvm: x86: hyperv: guest->host event signaling via eventfd

In Hyper-V, the fast guest->host notification mechanism is the SIGNAL_EVENT hypercall, with a single parameter of the connection ID to signal. Currently this hypercall incurs a user exit and requires the userspace to decode the parameters and trigger the notification of the potentially different I/O context. To avoid the costly user exit, process this hypercall and signal the corresponding eventfd in KVM, similar to ioeventfd. The association between the connection id and the eventfd is established via the newly introduced KVM_HYPERV_EVENTFD ioctl, and maintained in an (srcu-protected) IDR.

Roman Kagan committed 8 years ago

Commit faeb7831 parent cbc02367 files · +164 −1Browse files

Showing the changes to include/uapi/linux (1 of 7 files). Show all

Unified · Split

include/uapi/linux/kvm.h+15−0
@@ -936,6 +936,7 @@ struct kvm_ppc_resize_hpt { · 935 unmodified lines
936936 #define KVM_CAP_PPC_GET_CPU_CHAR 151
937937 #define KVM_CAP_S390_BPB 152
938938 #define KVM_CAP_GET_MSR_FEATURES 153
939+#define KVM_CAP_HYPERV_EVENTFD 154
939940
940941 #ifdef KVM_CAP_IRQ_ROUTING
941942
@@ -1375,6 +1376,10 @@ struct kvm_enc_region { · 433 unmodified lines
13751376 #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
13761377 #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
13771378
1379+/* Available with KVM_CAP_HYPERV_EVENTFD */
1380+#define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd)
1381+
1382+
13781383 /* Secure Encrypted Virtualization command */
13791384 enum sev_cmd_id {
13801385 /* Guest initialization commands */
@@ -1515,4 +1520,14 @@ struct kvm_assigned_msix_entry { · 134 unmodified lines
15151520 #define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
15161521 #define KVM_ARM_DEV_PMU (1 << 2)
15171522
1523+struct kvm_hyperv_eventfd {
1524+ __u32 conn_id;
1525+ __s32 fd;
1526+ __u32 flags;
1527+ __u32 padding[3];
1528+};
1529+
1530+#define KVM_HYPERV_CONN_ID_MASK 0x00ffffff
1531+#define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0)
1532+
15181533 #endif /* __LINUX_KVM_H */