Skip to content

Commit f195421

Browse files
akhilpo-qcomRob Clark
authored andcommitted
drm/msm/a6xx: Switch to GMU AO counter
CP_ALWAYS_ON counter falls under GX domain which is collapsed during IFPC. So switch to GMU_ALWAYS_ON counter for any CPU reads since it is not impacted by IFPC. Both counters are clocked by same xo clock source. Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/673373/ Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
1 parent 0e7107a commit f195421

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616

1717
#define GPU_PAS_ID 13
1818

19+
static u64 read_gmu_ao_counter(struct a6xx_gpu *a6xx_gpu)
20+
{
21+
u64 count_hi, count_lo, temp;
22+
23+
do {
24+
count_hi = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H);
25+
count_lo = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L);
26+
temp = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H);
27+
} while (unlikely(count_hi != temp));
28+
29+
return (count_hi << 32) | count_lo;
30+
}
31+
1932
static bool fence_status_check(struct msm_gpu *gpu, u32 offset, u32 value, u32 status, u32 mask)
2033
{
2134
/* Success if !writedropped0/1 */
@@ -376,8 +389,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
376389
OUT_RING(ring, upper_32_bits(rbmemptr(ring, fence)));
377390
OUT_RING(ring, submit->seqno);
378391

379-
trace_msm_gpu_submit_flush(submit,
380-
gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER));
392+
trace_msm_gpu_submit_flush(submit, read_gmu_ao_counter(a6xx_gpu));
381393

382394
a6xx_flush(gpu, ring);
383395
}
@@ -577,8 +589,7 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
577589
}
578590

579591

580-
trace_msm_gpu_submit_flush(submit,
581-
gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER));
592+
trace_msm_gpu_submit_flush(submit, read_gmu_ao_counter(a6xx_gpu));
582593

583594
a6xx_flush(gpu, ring);
584595

@@ -2268,16 +2279,7 @@ static int a6xx_gmu_get_timestamp(struct msm_gpu *gpu, uint64_t *value)
22682279
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
22692280
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
22702281

2271-
mutex_lock(&a6xx_gpu->gmu.lock);
2272-
2273-
/* Force the GPU power on so we can read this register */
2274-
a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET);
2275-
2276-
*value = gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER);
2277-
2278-
a6xx_gmu_clear_oob(&a6xx_gpu->gmu, GMU_OOB_PERFCOUNTER_SET);
2279-
2280-
mutex_unlock(&a6xx_gpu->gmu.lock);
2282+
*value = read_gmu_ao_counter(a6xx_gpu);
22812283

22822284
return 0;
22832285
}

0 commit comments

Comments
 (0)