[PATCH] iommu/sun50i: Remove IOMMU_DOMAIN_IDENTITY

Robin Murphy robin.murphy at arm.com
Mon Nov 28 06:21:56 PST 2022


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 at arm.com>

> Fixes: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver")
> Signed-off-by: Jason Gunthorpe <jgg at 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



More information about the linux-arm-kernel mailing list