iommu: Don't break iommu_attach_device() if iommu shared by more than one master

Don't break iommu_attach_device.
iommu_attach_device will break if iommu shared by two or more masters

Change-Id: Ifd1c652341e2270bfde57ebe1e0cd00d51d38eec
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue
2019-11-20 16:55:27 +08:00
committed by Tao Huang
parent f9613e3a3c
commit 502e1d32f2

View File

@@ -1962,7 +1962,9 @@ int iommu_attach_device(struct iommu_domain *domain, struct device *dev)
*/
mutex_lock(&group->mutex);
ret = -EINVAL;
if (iommu_group_device_count(group) != 1)
/* don't break attach if iommu shared by more than one master */
if (iommu_group_device_count(group) < 1)
goto out_unlock;
ret = __iommu_attach_group(domain, group);