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
936#define KVM_CAP_PPC_GET_CPU_CHAR 151936#define KVM_CAP_PPC_GET_CPU_CHAR 151
937#define KVM_CAP_S390_BPB 152937#define KVM_CAP_S390_BPB 152
938#define KVM_CAP_GET_MSR_FEATURES 153938#define KVM_CAP_GET_MSR_FEATURES 153
939#define KVM_CAP_HYPERV_EVENTFD 154
939 940
940#ifdef KVM_CAP_IRQ_ROUTING941#ifdef KVM_CAP_IRQ_ROUTING
941 942
@@ -1375,6 +1376,10 @@ struct kvm_enc_region { · 433 unmodified lines
1375#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)1376#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region)
1376#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)1377#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region)
1377 1378
1379/* Available with KVM_CAP_HYPERV_EVENTFD */
1380#define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd)
1381
1382
1378/* Secure Encrypted Virtualization command */1383/* Secure Encrypted Virtualization command */
1379enum sev_cmd_id {1384enum sev_cmd_id {
1380 /* Guest initialization commands */1385 /* Guest initialization commands */
@@ -1515,4 +1520,14 @@ struct kvm_assigned_msix_entry { · 134 unmodified lines
1515#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)1520#define KVM_ARM_DEV_EL1_PTIMER (1 << 1)
1516#define KVM_ARM_DEV_PMU (1 << 2)1521#define KVM_ARM_DEV_PMU (1 << 2)
1517 1522
1523struct 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
1518#endif /* __LINUX_KVM_H */1533#endif /* __LINUX_KVM_H */