public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev()
@ 2023-09-22 14:55 Hector Martin
  2023-09-22 14:59 ` Jason Gunthorpe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hector Martin @ 2023-09-22 14:55 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy, Jason Gunthorpe,
	Jerry Snitselaar
  Cc: Joerg Roedel, Neal Gompa, Justin M. Forbes, iommu, linux-kernel,
	asahi, stable, regressions, Hector Martin

Commit a4fdd9762272 ("iommu: Use flush queue capability") hid the
IOMMU_DOMAIN_DMA_FQ domain type from domain allocation. A check was
introduced in iommu_dma_init_domain() to fall back if not supported, but
this check runs too late: by that point, devices have been attached to
the IOMMU, and apple-dart's attach_dev() callback does not expect
IOMMU_DOMAIN_DMA_FQ domains.

Change the logic so the IOMMU_DOMAIN_DMA codepath is the default,
instead of explicitly enumerating all types.

Fixes an apple-dart regression in v6.5.

Cc: regressions@lists.linux.dev
Cc: stable@vger.kernel.org
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Fixes: a4fdd9762272 ("iommu: Use flush queue capability")
Signed-off-by: Hector Martin <marcan@marcan.st>
---
Changes in v2:
- Fixed the issue in apple-dart instead of the iommu core, per Robin's
  suggestion.
- Link to v1: https://lore.kernel.org/r/20230922-iommu-type-regression-v1-1-1ed3825b2c38@marcan.st
---
 drivers/iommu/apple-dart.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index 2082081402d3..0b8927508427 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -671,8 +671,7 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
 		return ret;
 
 	switch (domain->type) {
-	case IOMMU_DOMAIN_DMA:
-	case IOMMU_DOMAIN_UNMANAGED:
+	default:
 		ret = apple_dart_domain_add_streams(dart_domain, cfg);
 		if (ret)
 			return ret;

---
base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70
change-id: 20230922-iommu-type-regression-25b4f43df770

Best regards,
-- 
Hector Martin <marcan@marcan.st>


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

* Re: [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev()
  2023-09-22 14:55 [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev() Hector Martin
@ 2023-09-22 14:59 ` Jason Gunthorpe
  2023-09-22 16:40 ` Neal Gompa
  2023-09-25  9:37 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2023-09-22 14:59 UTC (permalink / raw)
  To: Hector Martin
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, Jerry Snitselaar,
	Joerg Roedel, Neal Gompa, Justin M. Forbes, iommu, linux-kernel,
	asahi, stable, regressions

On Fri, Sep 22, 2023 at 11:55:23PM +0900, Hector Martin wrote:
> Commit a4fdd9762272 ("iommu: Use flush queue capability") hid the
> IOMMU_DOMAIN_DMA_FQ domain type from domain allocation. A check was
> introduced in iommu_dma_init_domain() to fall back if not supported, but
> this check runs too late: by that point, devices have been attached to
> the IOMMU, and apple-dart's attach_dev() callback does not expect
> IOMMU_DOMAIN_DMA_FQ domains.
> 
> Change the logic so the IOMMU_DOMAIN_DMA codepath is the default,
> instead of explicitly enumerating all types.
> 
> Fixes an apple-dart regression in v6.5.
> 
> Cc: regressions@lists.linux.dev
> Cc: stable@vger.kernel.org
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Fixes: a4fdd9762272 ("iommu: Use flush queue capability")
> Signed-off-by: Hector Martin <marcan@marcan.st>
> ---
> Changes in v2:
> - Fixed the issue in apple-dart instead of the iommu core, per Robin's
>   suggestion.
> - Link to v1: https://lore.kernel.org/r/20230922-iommu-type-regression-v1-1-1ed3825b2c38@marcan.st
> ---
>  drivers/iommu/apple-dart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

It is weird looking, but I have a followup series that will clean it -
this should go to -rc

Thanks,
Jason

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

* Re: [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev()
  2023-09-22 14:55 [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev() Hector Martin
  2023-09-22 14:59 ` Jason Gunthorpe
@ 2023-09-22 16:40 ` Neal Gompa
  2023-09-25  9:37 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: Neal Gompa @ 2023-09-22 16:40 UTC (permalink / raw)
  To: Hector Martin
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, Jason Gunthorpe,
	Jerry Snitselaar, Joerg Roedel, Justin M. Forbes, iommu,
	linux-kernel, asahi, stable, regressions

On Fri, Sep 22, 2023 at 10:55 AM Hector Martin <marcan@marcan.st> wrote:
>
> Commit a4fdd9762272 ("iommu: Use flush queue capability") hid the
> IOMMU_DOMAIN_DMA_FQ domain type from domain allocation. A check was
> introduced in iommu_dma_init_domain() to fall back if not supported, but
> this check runs too late: by that point, devices have been attached to
> the IOMMU, and apple-dart's attach_dev() callback does not expect
> IOMMU_DOMAIN_DMA_FQ domains.
>
> Change the logic so the IOMMU_DOMAIN_DMA codepath is the default,
> instead of explicitly enumerating all types.
>
> Fixes an apple-dart regression in v6.5.
>
> Cc: regressions@lists.linux.dev
> Cc: stable@vger.kernel.org
> Suggested-by: Robin Murphy <robin.murphy@arm.com>
> Fixes: a4fdd9762272 ("iommu: Use flush queue capability")
> Signed-off-by: Hector Martin <marcan@marcan.st>
> ---
> Changes in v2:
> - Fixed the issue in apple-dart instead of the iommu core, per Robin's
>   suggestion.
> - Link to v1: https://lore.kernel.org/r/20230922-iommu-type-regression-v1-1-1ed3825b2c38@marcan.st
> ---
>  drivers/iommu/apple-dart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
> index 2082081402d3..0b8927508427 100644
> --- a/drivers/iommu/apple-dart.c
> +++ b/drivers/iommu/apple-dart.c
> @@ -671,8 +671,7 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
>                 return ret;
>
>         switch (domain->type) {
> -       case IOMMU_DOMAIN_DMA:
> -       case IOMMU_DOMAIN_UNMANAGED:
> +       default:
>                 ret = apple_dart_domain_add_streams(dart_domain, cfg);
>                 if (ret)
>                         return ret;
>
> ---
> base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70
> change-id: 20230922-iommu-type-regression-25b4f43df770
>
> Best regards,
> --
> Hector Martin <marcan@marcan.st>
>

Looks good to me.

Reviewed-by: Neal Gompa <neal@gompa.dev>


-- 
真実はいつも一つ!/ Always, there's only one truth!

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

* Re: [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev()
  2023-09-22 14:55 [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev() Hector Martin
  2023-09-22 14:59 ` Jason Gunthorpe
  2023-09-22 16:40 ` Neal Gompa
@ 2023-09-25  9:37 ` Joerg Roedel
  2 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2023-09-25  9:37 UTC (permalink / raw)
  To: Hector Martin
  Cc: Will Deacon, Robin Murphy, Jason Gunthorpe, Jerry Snitselaar,
	Joerg Roedel, Neal Gompa, Justin M. Forbes, iommu, linux-kernel,
	asahi, stable, regressions

On Fri, Sep 22, 2023 at 11:55:23PM +0900, Hector Martin wrote:
> ---
> Changes in v2:
> - Fixed the issue in apple-dart instead of the iommu core, per Robin's
>   suggestion.
> - Link to v1: https://lore.kernel.org/r/20230922-iommu-type-regression-v1-1-1ed3825b2c38@marcan.st
> ---
>  drivers/iommu/apple-dart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied for v6.6, thanks.

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

end of thread, other threads:[~2023-09-25  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 14:55 [PATCH REGRESSION v2] iommu/apple-dart: Handle DMA_FQ domains in attach_dev() Hector Martin
2023-09-22 14:59 ` Jason Gunthorpe
2023-09-22 16:40 ` Neal Gompa
2023-09-25  9:37 ` Joerg Roedel

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