@@ -3191,6 +3191,18 @@ static int iommu_change_dev_def_domain(struct iommu_group *group,
return ret;
}
+int iommu_realloc_dev_group(struct device *dev)
+{
+ struct iommu_group *group;
+ int ret;
+
+ group = iommu_group_get(dev);
+ ret = iommu_change_dev_def_domain(group, dev, 0, true);
+ iommu_group_put(group);
+
+ return ret;
+}
+
/*
* Changing the default domain or any other IOMMU group attribute through sysfs
* requires the users to unbind the drivers from the devices in the IOMMU group.
@@ -482,6 +482,7 @@ bool iommu_get_dma_strict(struct iommu_domain *domain);
extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
unsigned long iova, int flags);
+extern int iommu_realloc_dev_group(struct device *dev);
static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)
{
@@ -699,6 +700,11 @@ static inline size_t iommu_map_sg_atomic(struct iommu_domain *domain,
return 0;
}
+static inline int iommu_realloc_dev_group(struct device *dev)
+{
+ return -ENODEV;
+}
+
static inline void iommu_flush_iotlb_all(struct iommu_domain *domain)
{
}
Add a function to re-alloc IOMMU group default domain. Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/iommu/iommu.c | 12 ++++++++++++ include/linux/iommu.h | 6 ++++++ 2 files changed, 18 insertions(+) -- 2.26.2