From ccd46dbae77dbf0d33f42e04b59536f108c395e8 Mon Sep 17 00:00:00 2001 From: Jike Song Date: Thu, 1 Dec 2016 13:20:06 +0800 Subject: 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 Cc: Paolo Bonzini Cc: Xiao Guangrong Signed-off-by: Jike Song [aw: remove use of new typedef] Signed-off-by: Alex Williamson --- include/linux/vfio.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/linux/vfio.h') 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, /* each type has independent events */ enum vfio_notify_type { VFIO_IOMMU_NOTIFY = 0, + VFIO_GROUP_NOTIFY = 1, }; /* events for VFIO_IOMMU_NOTIFY */ #define VFIO_IOMMU_NOTIFY_DMA_UNMAP BIT(0) +/* events for VFIO_GROUP_NOTIFY */ +#define VFIO_GROUP_NOTIFY_SET_KVM BIT(0) + extern int vfio_register_notifier(struct device *dev, enum vfio_notify_type type, unsigned long *required_events, @@ -124,6 +128,9 @@ extern int vfio_unregister_notifier(struct device *dev, enum vfio_notify_type type, struct notifier_block *nb); +struct kvm; +extern void vfio_group_set_kvm(struct vfio_group *group, struct kvm *kvm); + /* * Sub-module helpers */ -- cgit v1.2.3