[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220818022433.41770-1-yuancan@huawei.com>
Date: Thu, 18 Aug 2022 02:24:33 +0000
From: Yuan Can <yuancan@...wei.com>
To: <joro@...tes.org>, <will@...nel.org>, <robin.murphy@....com>,
<iommu@...ts.linux.dev>
CC: <linux-kernel@...r.kernel.org>, <yuancan@...wei.com>,
<baolu.lu@...ux.intel.com>, <haifeng.zhao@...ux.intel.com>
Subject: [PATCH -next v2] iommu: return early when devices in a group require different domain type
When alloc default domain for an iommu_group in
probe_alloc_default_domain, the expected domain type
of each device in the iommu_group is checked in a loop,
if two devices require different types, the loop can
be broken since the default domain will be set to
iommu_def_domain_type.
Return 1 when this happened to break the loop in
__iommu_group_for_each_dev.
Signed-off-by: Yuan Can <yuancan@...wei.com>
Reviewed-by: Lu Baolu <baolu.lu@...ux.intel.com>
---
drivers/iommu/iommu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 74bc9111c7be..0d4d78946d31 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1653,6 +1653,7 @@ static int probe_get_default_domain_type(struct device *dev, void *data)
dev_name(gtype->dev),
iommu_domain_type_str(gtype->type));
gtype->type = 0;
+ return 1; /* end the outer loop */
}
if (!gtype->dev) {
--
2.17.1
Powered by blists - more mailing lists