drm/msm: a5xx: Remove unneeded parens
Subsystems (4)
PATCH 1/2 drm/msm: a5xx: Remove unneeded parens
From: Sean Paul <[email protected]>
A small fixup I posted with my v2 patch [1] that was dropped.
[1]- https://lists.freedesktop.org/archives/freedreno/2018-October/003647.html
Signed-off-by Sean Paul <[email protected]>
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +2 -2
@@ -1443,8 +1443,8 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu) busy_cycles =gpu_read64 (gpu,REG_A5XX_RBBM_PERFCTR_RBBM_0_LO ,REG_A5XX_RBBM_PERFCTR_RBBM_0_HI ); - busy_time = (busy_cycles - gpu->devfreq.busy_cycles); -do_div (busy_time, (clk_get_rate (gpu->core_clk) /1000000 )); + busy_time = busy_cycles - gpu->devfreq.busy_cycles; +do_div (busy_time,clk_get_rate (gpu->core_clk) /1000000 ); gpu->devfreq.busy_cycles = busy_cycles;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20181008182424.108745-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org
PATCH 2/2 drm/msm: a6xx: Fix improper u64 division
From: Sean Paul <[email protected]>
This patch uses the proper do_div() macro to perform u64 division and guards against overflow if the result is too large for the unsigned long return type
Fixes a2c3c0a54d4c drm/msm/a6xx: Add devfreq support for a6xx
Cc Sharat Masetty <[email protected]>
Signed-off-by Sean Paul <[email protected]>
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +7 -4
@@ -761,18 +761,21 @@ static unsigned long a6xx_gpu_busy(struct msm_gpu *gpu) {struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu);struct a6xx_gpu *a6xx_gpu =to_a6xx_gpu (adreno_gpu); -u64 busy_cycles; -unsigned long busy_time; +u64 busy_cycles, busy_time; busy_cycles =gmu_read64 (&a6xx_gpu->gmu,REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L ,REG_A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H ); - busy_time = ((busy_cycles - gpu->devfreq.busy_cycles) *10 ) /192 ; + busy_time = (busy_cycles - gpu->devfreq.busy_cycles) *10 ; +do_div (busy_time,192 ); gpu->devfreq.busy_cycles = busy_cycles; -return busy_time; +if (WARN_ON (busy_time > ~0LU )) +return ~0LU ; + +return (unsigned long )busy_time; }static const struct adreno_gpu_funcs funcs = {
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno