* [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY
@ 2022-11-28 14:06 Jason Gunthorpe
2022-11-28 14:21 ` Robin Murphy
2022-12-05 10:53 ` Joerg Roedel
0 siblings, 2 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2022-11-28 14:06 UTC (permalink / raw)
To: iommu, Maxime Ripard, Jernej Skrabec, Joerg Roedel,
linux-arm-kernel, linux-sunxi, Robin Murphy, Samuel Holland,
Chen-Yu Tsai, Will Deacon
Cc: Joerg Roedel
This driver treats IOMMU_DOMAIN_IDENTITY the same as UNMANAGED, which
cannot possibly be correct.
UNMANAGED domains are required to start out blocking all DMAs. This seems
to be what this driver does as it allocates a first level 'dt' for the IO
page table that is 0 filled.
Thus UNMANAGED looks like a working IO page table, and so IDENTITY must be
a mistake. Remove it.
Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/iommu/sun50i-iommu.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
index cd9b74ee24def1..0843418434ff3a 100644
--- a/drivers/iommu/sun50i-iommu.c
+++ b/drivers/iommu/sun50i-iommu.c
@@ -601,7 +601,6 @@ static struct iommu_domain *sun50i_iommu_domain_alloc(unsigned type)
struct sun50i_iommu_domain *sun50i_domain;
if (type != IOMMU_DOMAIN_DMA &&
- type != IOMMU_DOMAIN_IDENTITY &&
type != IOMMU_DOMAIN_UNMANAGED)
return NULL;
base-commit: 328827239b9ce3a95b5c0d33e8875651580de053
--
2.38.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY
2022-11-28 14:06 [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY Jason Gunthorpe
@ 2022-11-28 14:21 ` Robin Murphy
2022-12-05 10:53 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2022-11-28 14:21 UTC (permalink / raw)
To: Jason Gunthorpe, iommu, Maxime Ripard, Jernej Skrabec,
Joerg Roedel, linux-arm-kernel, linux-sunxi, Samuel Holland,
Chen-Yu Tsai, Will Deacon
Cc: Joerg Roedel, Andre Przywara
On 2022-11-28 14:06, Jason Gunthorpe wrote:
> This driver treats IOMMU_DOMAIN_IDENTITY the same as UNMANAGED, which
> cannot possibly be correct.
>
> UNMANAGED domains are required to start out blocking all DMAs. This seems
> to be what this driver does as it allocates a first level 'dt' for the IO
> page table that is 0 filled.
>
> Thus UNMANAGED looks like a working IO page table, and so IDENTITY must be
> a mistake. Remove it.
Ah yes, this did once catch my eye ages ago and Andre confirmed that
real hardware fell over with "iommu.passthrough=1", but it seems we both
forgot about it again before a patch got written. Thanks for taking the
time!
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/iommu/sun50i-iommu.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
> index cd9b74ee24def1..0843418434ff3a 100644
> --- a/drivers/iommu/sun50i-iommu.c
> +++ b/drivers/iommu/sun50i-iommu.c
> @@ -601,7 +601,6 @@ static struct iommu_domain *sun50i_iommu_domain_alloc(unsigned type)
> struct sun50i_iommu_domain *sun50i_domain;
>
> if (type != IOMMU_DOMAIN_DMA &&
> - type != IOMMU_DOMAIN_IDENTITY &&
> type != IOMMU_DOMAIN_UNMANAGED)
> return NULL;
>
>
> base-commit: 328827239b9ce3a95b5c0d33e8875651580de053
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY
2022-11-28 14:06 [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY Jason Gunthorpe
2022-11-28 14:21 ` Robin Murphy
@ 2022-12-05 10:53 ` Joerg Roedel
1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2022-12-05 10:53 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: iommu, Maxime Ripard, Jernej Skrabec, linux-arm-kernel,
linux-sunxi, Robin Murphy, Samuel Holland, Chen-Yu Tsai,
Will Deacon, Joerg Roedel
On Mon, Nov 28, 2022 at 10:06:28AM -0400, Jason Gunthorpe wrote:
> This driver treats IOMMU_DOMAIN_IDENTITY the same as UNMANAGED, which
> cannot possibly be correct.
>
> UNMANAGED domains are required to start out blocking all DMAs. This seems
> to be what this driver does as it allocates a first level 'dt' for the IO
> page table that is 0 filled.
>
> Thus UNMANAGED looks like a working IO page table, and so IDENTITY must be
> a mistake. Remove it.
>
> Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Applied, thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-05 10:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-28 14:06 [PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY Jason Gunthorpe
2022-11-28 14:21 ` Robin Murphy
2022-12-05 10:53 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).