diff mbox series

iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY

Message ID 0-v1-97f0adf27b5e+1f0-s50_identity_jgg@nvidia.com (mailing list archive)
State New, archived
Headers show
Series iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY | expand

Commit Message

Jason Gunthorpe Nov. 28, 2022, 2:06 p.m. UTC
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(-)


base-commit: 328827239b9ce3a95b5c0d33e8875651580de053

Comments

Robin Murphy Nov. 28, 2022, 2:21 p.m. UTC | #1
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
Joerg Roedel Dec. 5, 2022, 10:53 a.m. UTC | #2
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.
diff mbox series

Patch

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;