[PATCH 06/20] drm/msm: Use iommu_paging_domain_alloc()

Dmitry Baryshkov dmitry.baryshkov at linaro.org
Wed May 29 08:21:02 UTC 2024


On Wed, May 29, 2024 at 01:32:36PM +0800, Lu Baolu wrote:
> The domain allocated in msm_iommu_new() is for the @dev. Replace
> iommu_domain_alloc() with iommu_paging_domain_alloc() to make it explicit.
> 
> Update msm_iommu_new() to always return ERR_PTR in failure cases instead
> of NULL.

Please don't mix unrelated changes, because ...

> 
> Signed-off-by: Lu Baolu <baolu.lu at linux.intel.com>
> ---
>  drivers/gpu/drm/msm/msm_iommu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
> index d5512037c38b..f7e28d4b5f62 100644
> --- a/drivers/gpu/drm/msm/msm_iommu.c
> +++ b/drivers/gpu/drm/msm/msm_iommu.c
> @@ -407,9 +407,9 @@ struct msm_mmu *msm_iommu_new(struct device *dev, unsigned long quirks)
>  	struct msm_iommu *iommu;
>  	int ret;
>  
> -	domain = iommu_domain_alloc(dev->bus);
> -	if (!domain)
> -		return NULL;
> +	domain = iommu_paging_domain_alloc(dev);
> +	if (IS_ERR(domain))
> +		return ERR_CAST(domain);
>  
>  	iommu_set_pgtable_quirks(domain, quirks);
>  
> @@ -441,7 +441,7 @@ struct msm_mmu *msm_iommu_gpu_new(struct device *dev, struct msm_gpu *gpu, unsig
>  	struct msm_mmu *mmu;
>  
>  	mmu = msm_iommu_new(dev, quirks);
> -	if (IS_ERR_OR_NULL(mmu))
> +	if (IS_ERR(mmu))
>  		return mmu;

NAK, not having an IOMMU is a poor but legit usecase for some of devices
which don't have IOMMU support yet (for example because of the buggy
implementation for which we were not able to get all the hooks in).

Please don't break compatibility for existing platforms.

>  
>  	iommu = to_msm_iommu(mmu);
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry


More information about the dri-devel mailing list