Re: [PATCH v5 08/11] drm/panfrost: Move perfcnt GPU disable sequence into a helper

Adrián Larumbe <[email protected]>
Newsgroups gmane.linux.kernel,gmane.comp.video.dri.devel
Message-ID <an24SCQL-OGjFwRE@sobremesa>
On 12.08.2026 11:48, Boris Brezillon wrote:
> On Tue, 11 Aug 2026 22:42:17 +0100
> Adrián Larumbe <[email protected]> wrote:
> 
> > Just for the sake of avoiding repetition.
> > 
> > Reviewed-by: Steven Price <[email protected]>
> > Reviewed-by: Boris Brezillon <[email protected]>
> > Signed-off-by: Adrián Larumbe <[email protected]>
> > ---
> >  drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 31 ++++++++++++-----------------
> >  1 file changed, 13 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> > index 7020c0192e18..ad1156678e91 100644
> > --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> > +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> > @@ -35,6 +35,16 @@ struct panfrost_perfcnt {
> >  	struct completion dump_comp;
> >  };
> >  
> > +static void panfrost_perfcnt_gpu_disable(struct panfrost_device *pfdev)
> 
> I see you introduce panfrost_perfcnt_hw_enable() in patch 10, so maybe
> s/panfrost_perfcnt_gpu_disable/panfrost_perfcnt_hw_disable/ to be
> consistent.

Acked.

> > +{
> > +	gpu_write(pfdev, GPU_PERFCNT_CFG,
> > +		  GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF));
> > +	gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0x0);
> > +	gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0x0);
> > +	gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0x0);
> > +	gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
> > +}
> > +
> >  void panfrost_perfcnt_clean_cache_done(struct panfrost_device *pfdev)
> >  {
> >  	complete(&pfdev->perfcnt->dump_comp);
> > @@ -193,12 +203,7 @@ static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev,
> >  	if (user != perfcnt->user)
> >  		return -EINVAL;
> >  
> > -	gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0x0);
> > -	gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0x0);
> > -	gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0x0);
> > -	gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
> > -	gpu_write(pfdev, GPU_PERFCNT_CFG,
> > -		  GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF));
> > +	panfrost_perfcnt_gpu_disable(pfdev);
> >  
> >  	perfcnt->user = NULL;
> >  	drm_gem_vunmap(&perfcnt->mapping->obj->base.base, &map);
> > @@ -327,12 +332,7 @@ int panfrost_perfcnt_init(struct panfrost_device *pfdev)
> >  	perfcnt->bosize = size;
> >  
> >  	/* Start with everything disabled. */
> > -	gpu_write(pfdev, GPU_PERFCNT_CFG,
> > -		  GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF));
> > -	gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
> > +	panfrost_perfcnt_gpu_disable(pfdev);
> >  
> >  	init_completion(&perfcnt->dump_comp);
> >  	mutex_init(&perfcnt->lock);
> > @@ -344,10 +344,5 @@ int panfrost_perfcnt_init(struct panfrost_device *pfdev)
> >  void panfrost_perfcnt_fini(struct panfrost_device *pfdev)
> >  {
> >  	/* Disable everything before leaving. */
> > -	gpu_write(pfdev, GPU_PERFCNT_CFG,
> > -		  GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF));
> > -	gpu_write(pfdev, GPU_PRFCNT_JM_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_SHADER_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_MMU_L2_EN, 0);
> > -	gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
> > +	panfrost_perfcnt_gpu_disable(pfdev);
> >  }
> > 


Adrian Larumbe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.