diff mbox series

[1/3] drm/panthor: Call panthor_gpu_coherency_init() after PM resume()

Message ID 20250401075710.2638950-2-boris.brezillon@collabora.com (mailing list archive)
State New
Headers show
Series drm/panthor: Misc fixes | expand

Commit Message

Boris Brezillon April 1, 2025, 7:57 a.m. UTC
When the device is coherent, panthor_gpu_coherency_init() will read
GPU_COHERENCY_FEATURES to make sure the GPU supports the ACE-Lite
coherency protocol, which will fail if the clocks/power-domains are
not enabled when the read is done. Move the
panthor_gpu_coherency_init() call after the device has been resumed
to prevent that.

Fixes: dd7db8d911a1 ("drm/panthor: Explicitly set the coherency mode")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 drivers/gpu/drm/panthor/panthor_device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Liviu Dudau April 1, 2025, 4:17 p.m. UTC | #1
On Tue, Apr 01, 2025 at 09:57:08AM +0200, Boris Brezillon wrote:
> When the device is coherent, panthor_gpu_coherency_init() will read
> GPU_COHERENCY_FEATURES to make sure the GPU supports the ACE-Lite
> coherency protocol, which will fail if the clocks/power-domains are
> not enabled when the read is done. Move the
> panthor_gpu_coherency_init() call after the device has been resumed
> to prevent that.

While doing this, do you mind fixing the definitions for GPU_COHERENCY_ACE
and GPU_COHERENCY_ACE_LITE? They are swapped, according to my arch spec.

Otherwise, patch looks good to me.

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> 
> Fixes: dd7db8d911a1 ("drm/panthor: Explicitly set the coherency mode")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
>  drivers/gpu/drm/panthor/panthor_device.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> index a9da1d1eeb70..c73c1608d6e6 100644
> --- a/drivers/gpu/drm/panthor/panthor_device.c
> +++ b/drivers/gpu/drm/panthor/panthor_device.c
> @@ -171,10 +171,6 @@ int panthor_device_init(struct panthor_device *ptdev)
>  	struct page *p;
>  	int ret;
>  
> -	ret = panthor_gpu_coherency_init(ptdev);
> -	if (ret)
> -		return ret;
> -
>  	init_completion(&ptdev->unplug.done);
>  	ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
>  	if (ret)
> @@ -247,6 +243,10 @@ int panthor_device_init(struct panthor_device *ptdev)
>  	if (ret)
>  		goto err_rpm_put;
>  
> +	ret = panthor_gpu_coherency_init(ptdev);
> +	if (ret)
> +		return ret;
> +
>  	ret = panthor_mmu_init(ptdev);
>  	if (ret)
>  		goto err_unplug_gpu;
> -- 
> 2.48.1
>
Boris Brezillon April 1, 2025, 4:43 p.m. UTC | #2
On Tue, 1 Apr 2025 17:17:40 +0100
Liviu Dudau <liviu.dudau@arm.com> wrote:

> On Tue, Apr 01, 2025 at 09:57:08AM +0200, Boris Brezillon wrote:
> > When the device is coherent, panthor_gpu_coherency_init() will read
> > GPU_COHERENCY_FEATURES to make sure the GPU supports the ACE-Lite
> > coherency protocol, which will fail if the clocks/power-domains are
> > not enabled when the read is done. Move the
> > panthor_gpu_coherency_init() call after the device has been resumed
> > to prevent that.  
> 
> While doing this, do you mind fixing the definitions for GPU_COHERENCY_ACE
> and GPU_COHERENCY_ACE_LITE? They are swapped, according to my arch spec.

Oh, nice catch! I'll add a patch fixing that in v2.

> 
> Otherwise, patch looks good to me.
> 
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> 
> Best regards,
> Liviu
> 
> > 
> > Fixes: dd7db8d911a1 ("drm/panthor: Explicitly set the coherency mode")
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> > ---
> >  drivers/gpu/drm/panthor/panthor_device.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
> > index a9da1d1eeb70..c73c1608d6e6 100644
> > --- a/drivers/gpu/drm/panthor/panthor_device.c
> > +++ b/drivers/gpu/drm/panthor/panthor_device.c
> > @@ -171,10 +171,6 @@ int panthor_device_init(struct panthor_device *ptdev)
> >  	struct page *p;
> >  	int ret;
> >  
> > -	ret = panthor_gpu_coherency_init(ptdev);
> > -	if (ret)
> > -		return ret;
> > -
> >  	init_completion(&ptdev->unplug.done);
> >  	ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
> >  	if (ret)
> > @@ -247,6 +243,10 @@ int panthor_device_init(struct panthor_device *ptdev)
> >  	if (ret)
> >  		goto err_rpm_put;
> >  
> > +	ret = panthor_gpu_coherency_init(ptdev);
> > +	if (ret)
> > +		return ret;
> > +
> >  	ret = panthor_mmu_init(ptdev);
> >  	if (ret)
> >  		goto err_unplug_gpu;
> > -- 
> > 2.48.1
> >   
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
index a9da1d1eeb70..c73c1608d6e6 100644
--- a/drivers/gpu/drm/panthor/panthor_device.c
+++ b/drivers/gpu/drm/panthor/panthor_device.c
@@ -171,10 +171,6 @@  int panthor_device_init(struct panthor_device *ptdev)
 	struct page *p;
 	int ret;
 
-	ret = panthor_gpu_coherency_init(ptdev);
-	if (ret)
-		return ret;
-
 	init_completion(&ptdev->unplug.done);
 	ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
 	if (ret)
@@ -247,6 +243,10 @@  int panthor_device_init(struct panthor_device *ptdev)
 	if (ret)
 		goto err_rpm_put;
 
+	ret = panthor_gpu_coherency_init(ptdev);
+	if (ret)
+		return ret;
+
 	ret = panthor_mmu_init(ptdev);
 	if (ret)
 		goto err_unplug_gpu;