diff options
author | Jike Song <jike.song@intel.com> | 2016-12-01 00:20:06 -0500 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-12-01 12:40:05 -0500 |
commit | ccd46dbae77dbf0d33f42e04b59536f108c395e8 (patch) | |
tree | 6857fe3d01f70509d63f656670a8f757d0b67c4e /include/linux/vfio.h | |
parent | 22195cbd3451a75abaf30651a61cf85c89061327 (diff) |
vfio: support notifier chain in vfio_group
Beyond vfio_iommu events, users might also be interested in
vfio_group events. For example, if a vfio_group is used along
with Qemu/KVM, whenever kvm pointer is set to/cleared from the
vfio_group, users could be notified.
Currently only VFIO_GROUP_NOTIFY_SET_KVM supported.
Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Jike Song <jike.song@intel.com>
[aw: remove use of new typedef]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'include/linux/vfio.h')
-rw-r--r-- | include/linux/vfio.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 0e5201f207d3..edf9b2cad277 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h | |||
@@ -111,11 +111,15 @@ extern int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn, | |||
111 | /* each type has independent events */ | 111 | /* each type has independent events */ |
112 | enum vfio_notify_type { | 112 | enum vfio_notify_type { |
113 | VFIO_IOMMU_NOTIFY = 0, | 113 | VFIO_IOMMU_NOTIFY = 0, |
114 | VFIO_GROUP_NOTIFY = 1, | ||
114 | }; | 115 | }; |
115 | 116 | ||
116 | /* events for VFIO_IOMMU_NOTIFY */ | 117 | /* events for VFIO_IOMMU_NOTIFY */ |
117 | #define VFIO_IOMMU_NOTIFY_DMA_UNMAP BIT(0) | 118 | #define VFIO_IOMMU_NOTIFY_DMA_UNMAP BIT(0) |
118 | 119 | ||
120 | /* events for VFIO_GROUP_NOTIFY */ | ||
121 | #define VFIO_GROUP_NOTIFY_SET_KVM BIT(0) | ||
122 | |||
119 | extern int vfio_register_notifier(struct device *dev, | 123 | extern int vfio_register_notifier(struct device *dev, |
120 | enum vfio_notify_type type, | 124 | enum vfio_notify_type type, |
121 | unsigned long *required_events, | 125 | unsigned long *required_events, |
@@ -124,6 +128,9 @@ extern int vfio_unregister_notifier(struct device *dev, | |||
124 | enum vfio_notify_type type, | 128 | enum vfio_notify_type type, |
125 | struct notifier_block *nb); | 129 | struct notifier_block *nb); |
126 | 130 | ||
131 | struct kvm; | ||
132 | extern void vfio_group_set_kvm(struct vfio_group *group, struct kvm *kvm); | ||
133 | |||
127 | /* | 134 | /* |
128 | * Sub-module helpers | 135 | * Sub-module helpers |
129 | */ | 136 | */ |