public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] iommu: return early when devices in a group require different domain type
@ 2022-08-16  2:07 Yuan Can
  2022-08-17  2:06 ` Ethan Zhao
  2022-08-17 10:34 ` Baolu Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan Can @ 2022-08-16  2:07 UTC (permalink / raw)
  To: joro, will, robin.murphy, iommu; +Cc: linux-kernel, yuancan

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 breaked 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@huawei.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] iommu: return early when devices in a group require different domain type
  2022-08-16  2:07 [PATCH -next] iommu: return early when devices in a group require different domain type Yuan Can
@ 2022-08-17  2:06 ` Ethan Zhao
  2022-08-17 10:34 ` Baolu Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Ethan Zhao @ 2022-08-17  2:06 UTC (permalink / raw)
  To: Yuan Can, joro, will, robin.murphy, iommu; +Cc: linux-kernel

Yuan,

在 2022/8/16 10:07, Yuan Can 写道:
> 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 breaked since the default domain
s/breaked/broken
> 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@huawei.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) {

Thanks,

Ethan

-- 
"firm, enduring, strong, and long-lived"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] iommu: return early when devices in a group require different domain type
  2022-08-16  2:07 [PATCH -next] iommu: return early when devices in a group require different domain type Yuan Can
  2022-08-17  2:06 ` Ethan Zhao
@ 2022-08-17 10:34 ` Baolu Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Baolu Lu @ 2022-08-17 10:34 UTC (permalink / raw)
  To: Yuan Can, joro, will, robin.murphy, iommu; +Cc: baolu.lu, linux-kernel

On 2022/8/16 10:07, Yuan Can wrote:
> 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 breaked 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@huawei.com>

Nit:
Try to use up the allowed number of characters per line before wrapping
and use "./scripts/checkpatch.pl --strict --codespell _your_patch_file"
to check the patch.

For the change:

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>

Best regards,
baolu

> ---
>   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) {


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-17 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16  2:07 [PATCH -next] iommu: return early when devices in a group require different domain type Yuan Can
2022-08-17  2:06 ` Ethan Zhao
2022-08-17 10:34 ` Baolu Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox