dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/arm/malidp: Stop using iommu_present()
@ 2022-04-05 14:11 Robin Murphy
  2022-04-06  9:27 ` Brian Starkey
  0 siblings, 1 reply; 3+ messages in thread
From: Robin Murphy @ 2022-04-05 14:11 UTC (permalink / raw)
  To: liviu.dudau, brian.starkey; +Cc: iommu, dri-devel

iommu_get_domain_for_dev() is already perfectly happy to return NULL
if the given device has no IOMMU. Drop the unnecessary check.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 drivers/gpu/drm/arm/malidp_planes.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 0562bdaac00c..81d9f5004025 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -310,17 +310,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
 static u32 malidp_get_pgsize_bitmap(struct malidp_plane *mp)
 {
-	u32 pgsize_bitmap = 0;
+	struct iommu_domain *mmu_dom;
 
-	if (iommu_present(&platform_bus_type)) {
-		struct iommu_domain *mmu_dom =
-			iommu_get_domain_for_dev(mp->base.dev->dev);
+	mmu_dom = iommu_get_domain_for_dev(mp->base.dev->dev);
+	if (mmu_dom)
+		return mmu_dom->pgsize_bitmap;
 
-		if (mmu_dom)
-			pgsize_bitmap = mmu_dom->pgsize_bitmap;
-	}
-
-	return pgsize_bitmap;
+	return 0;
 }
 
 /*
-- 
2.28.0.dirty


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

* Re: [PATCH] drm/arm/malidp: Stop using iommu_present()
  2022-04-05 14:11 [PATCH] drm/arm/malidp: Stop using iommu_present() Robin Murphy
@ 2022-04-06  9:27 ` Brian Starkey
  2022-04-11 17:34   ` Liviu Dudau
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Starkey @ 2022-04-06  9:27 UTC (permalink / raw)
  To: Robin Murphy; +Cc: iommu, nd, liviu.dudau, dri-devel

Hi Robin,

On Tue, Apr 05, 2022 at 03:11:18PM +0100, Robin Murphy wrote:
> iommu_get_domain_for_dev() is already perfectly happy to return NULL
> if the given device has no IOMMU. Drop the unnecessary check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

LGTM, Acked-by: Brian Starkey <brian.starkey@arm.com>

I'll have to leave it to Liviu to push though.

Thanks,
-Brian

> ---
>  drivers/gpu/drm/arm/malidp_planes.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 0562bdaac00c..81d9f5004025 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -310,17 +310,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
>  
>  static u32 malidp_get_pgsize_bitmap(struct malidp_plane *mp)
>  {
> -	u32 pgsize_bitmap = 0;
> +	struct iommu_domain *mmu_dom;
>  
> -	if (iommu_present(&platform_bus_type)) {
> -		struct iommu_domain *mmu_dom =
> -			iommu_get_domain_for_dev(mp->base.dev->dev);
> +	mmu_dom = iommu_get_domain_for_dev(mp->base.dev->dev);
> +	if (mmu_dom)
> +		return mmu_dom->pgsize_bitmap;
>  
> -		if (mmu_dom)
> -			pgsize_bitmap = mmu_dom->pgsize_bitmap;
> -	}
> -
> -	return pgsize_bitmap;
> +	return 0;
>  }
>  
>  /*
> -- 
> 2.28.0.dirty
> 

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

* Re: [PATCH] drm/arm/malidp: Stop using iommu_present()
  2022-04-06  9:27 ` Brian Starkey
@ 2022-04-11 17:34   ` Liviu Dudau
  0 siblings, 0 replies; 3+ messages in thread
From: Liviu Dudau @ 2022-04-11 17:34 UTC (permalink / raw)
  To: Brian Starkey; +Cc: iommu, nd, Robin Murphy, dri-devel

On Wed, Apr 06, 2022 at 10:27:00AM +0100, Brian Starkey wrote:
> Hi Robin,
> 
> On Tue, Apr 05, 2022 at 03:11:18PM +0100, Robin Murphy wrote:
> > iommu_get_domain_for_dev() is already perfectly happy to return NULL
> > if the given device has no IOMMU. Drop the unnecessary check.
> > 
> > Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> LGTM, Acked-by: Brian Starkey <brian.starkey@arm.com>
> 
> I'll have to leave it to Liviu to push though.

I have now pushed the patch together with other 3 that have been lingering in my tree.

Best regards,
Liviu

> 
> Thanks,
> -Brian
> 
> > ---
> >  drivers/gpu/drm/arm/malidp_planes.c | 14 +++++---------
> >  1 file changed, 5 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> > index 0562bdaac00c..81d9f5004025 100644
> > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > @@ -310,17 +310,13 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
> >  
> >  static u32 malidp_get_pgsize_bitmap(struct malidp_plane *mp)
> >  {
> > -	u32 pgsize_bitmap = 0;
> > +	struct iommu_domain *mmu_dom;
> >  
> > -	if (iommu_present(&platform_bus_type)) {
> > -		struct iommu_domain *mmu_dom =
> > -			iommu_get_domain_for_dev(mp->base.dev->dev);
> > +	mmu_dom = iommu_get_domain_for_dev(mp->base.dev->dev);
> > +	if (mmu_dom)
> > +		return mmu_dom->pgsize_bitmap;
> >  
> > -		if (mmu_dom)
> > -			pgsize_bitmap = mmu_dom->pgsize_bitmap;
> > -	}
> > -
> > -	return pgsize_bitmap;
> > +	return 0;
> >  }
> >  
> >  /*
> > -- 
> > 2.28.0.dirty
> > 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

end of thread, other threads:[~2022-04-11 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 14:11 [PATCH] drm/arm/malidp: Stop using iommu_present() Robin Murphy
2022-04-06  9:27 ` Brian Starkey
2022-04-11 17:34   ` Liviu Dudau

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).