@@ -1414,6 +1414,14 @@ int vfio_external_user_iommu_id(struct vfio_group *group)
}
EXPORT_SYMBOL_GPL(vfio_external_user_iommu_id);
+int vfio_external_user_check_extension(struct vfio_group *group,
+ unsigned long arg)
+{
+ return vfio_ioctl_check_extension(group->container, arg);
+
+}
+EXPORT_SYMBOL_GPL(vfio_external_user_check_extension);
+
/**
* Module/class support
*/
@@ -840,6 +840,10 @@ static long vfio_iommu_type1_ioctl(void *iommu_data,
switch (arg) {
case VFIO_TYPE1_IOMMU:
return 1;
+ case VFIO_IOMMU_CAP_CACHE_COHERENCY:
+ return !iommu ? 0 :
+ iommu_domain_has_cap(iommu->domain,
+ IOMMU_CAP_CACHE_COHERENCY);
default:
return 0;
}
@@ -96,5 +96,7 @@ extern void vfio_unregister_iommu_driver(
extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
extern void vfio_group_put_external_user(struct vfio_group *group);
extern int vfio_external_user_iommu_id(struct vfio_group *group);
+extern int vfio_external_user_check_extension(struct vfio_group *group,
+ unsigned long arg);
#endif /* VFIO_H */
@@ -23,6 +23,7 @@
#define VFIO_TYPE1_IOMMU 1
#define VFIO_SPAPR_TCE_IOMMU 2
+#define VFIO_IOMMU_CAP_CACHE_COHERENCY 3
/*
* The IOCTL interface is designed for extensibility by embedding the
This adds the ability for an external user to check VFIO extensions. The first one we care about is support for IOMMU cache coherency. Without this, external users, like KVM, would need to assume the IOMMU allows No-Snoop transactions which are not coherent with processor cache. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> --- drivers/vfio/vfio.c | 8 ++++++++ drivers/vfio/vfio_iommu_type1.c | 4 ++++ include/linux/vfio.h | 2 ++ include/uapi/linux/vfio.h | 1 + 4 files changed, 15 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html