drm/v3d: Enable Performance Counters before clearing them
Subsystems (3)
Maíra Canal
maintainerPATCH 1/1 drm/v3d: Enable Performance Counters before clearing them
On the Raspberry Pi 5, performance counters are not being cleared when v3d_perfmon_start() is called, even though we write to the CLR register. As a result, their values accumulate until they overflow.
The expected behavior is for performance counters to reset to zero at the start of a job. When the job finishes and the perfmon is stopped, the counters should accurately reflect the values for that specific job.
To ensure this behavior, the performance counters are now enabled before being cleared. This allows the CLR register to function as intended, zeroing the counter values when the job begins.
--- drivers/gpu/drm/v3d/v3d_perfmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/v3d/v3d_perfmon.c +1 -1
@@ -255,9 +255,9 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon)V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_SRC_X (source), channel); } +V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask);V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_CLR , mask);V3D_CORE_WRITE (0 ,V3D_PCTR_0_OVERFLOW , mask); -V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask); v3d->active_perfmon = perfmon; }
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 39 lines · Maíra Canal
On the Raspberry Pi 5, performance counters are not being cleared when
v3d_perfmon_start()is called, even though we write to the CLR register. As a result, their values accumulate until they overflow.The expected behavior is for performance counters to reset to zero at the start of a job. When the job finishes and the perfmon is stopped, the counters should accurately reflect the values for that specific job.
To ensure this behavior, the performance counters are now enabled before being cleared. This allows the CLR register to function as intended, zeroing the counter values when the job begins.
Fixes 26a4dc29b74a ("drm/v3d: Expose performance counters touserspace")
Signed-off-by Maíra Canal <[email protected]>---
drivers/gpu/drm/v3d/v3d_perfmon.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/v3d/v3d_perfmon.c +0
-0@@ -255,9 +255,9 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon) V3D_CORE_WRITE(0, V3D_V4_PCTR_0_SRC_X(source),channel ); }drivers/gpu/drm/v3d/v3d_perfmon.c +1
-0+V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask);
V3D_CORE_WRITE(0, V3D_V4_PCTR_0_CLR, mask);V3D_CORE_WRITE(0, V3D_PCTR_0_OVERFLOW, mask);drivers/gpu/drm/v3d/v3d_perfmon.c +0
-1-V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask);
v3d->active_perfmon= perfmon;
}
Maíra Canal
maintainerHi Iago,
Quoted 1 line · Iago Toral
Reviewed-by Iago Toral Quiroga <[email protected]>
Thanks for reviewing! Applied to misc/kernel.git (drm-misc-fixes).
Best Regards,
- Maíra
Quoted 42 lines · Maíra Canal
Quoted 39 lines
On the Raspberry Pi 5, performance counters are not being cleared when
v3d_perfmon_start()is called, even though we write to the CLR register. As a result, their values accumulate until they overflow.The expected behavior is for performance counters to reset to zero at the start of a job. When the job finishes and the perfmon is stopped, the counters should accurately reflect the values for that specific job.
To ensure this behavior, the performance counters are now enabled before being cleared. This allows the CLR register to function as intended, zeroing the counter values when the job begins.
Fixes 26a4dc29b74a ("drm/v3d: Expose performance counters touserspace")
Signed-off-by Maíra Canal <[email protected]>--- drivers/gpu/drm/v3d/v3d_perfmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/v3d/v3d_perfmon.c +1
-1@@ -255,9 +255,9 @@ void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon) V3D_CORE_WRITE(0, V3D_V4_PCTR_0_SRC_X(source),channel ); } +V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask); V3D_CORE_WRITE(0, V3D_V4_PCTR_0_CLR, mask); V3D_CORE_WRITE(0, V3D_PCTR_0_OVERFLOW, mask); -V3D_CORE_WRITE (0 ,V3D_V4_PCTR_0_EN , mask);
v3d->active_perfmon= perfmon;
}