From f4721b63c8e4cd89edb24a36eff3346b98f85829 Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Fri, 17 Jul 2020 13:14:42 -0600 Subject: [PATCH 1/3] msm: kgsl: Do not capture DTCM on gmu boot failure Accessing DTCM can cause NoC error sometimes if GMU is accessing any of its TCMs at the same time as host. Change-Id: I3d7a3169620854dbd659f378c216a7b15435c914 Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/adreno_a6xx_gmu.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index a68a0d7a9e56..28e9a7254d2d 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -457,15 +457,8 @@ static int a6xx_gmu_device_start(struct adreno_device *adreno_dev) if (timed_poll_check(device, A6XX_GMU_CM3_FW_INIT_RESULT, val, GMU_START_TIMEOUT, mask)) { - u32 val; - /* - * The breadcrumb is written to a gmu virtual mapping - * which points to dtcm byte offset 0x3fdc. - */ - gmu_core_regread(device, - A6XX_GMU_CM3_DTCM_START + (0x3fdc >> 2), &val); - dev_err(&gmu->pdev->dev, "GMU doesn't boot: 0x%x\n", val); + dev_err(&gmu->pdev->dev, "GMU doesn't boot\n"); gmu_fault_snapshot(device); return -ETIMEDOUT; } From f91275238fe80a9435d000fcb0ea819b37e102e1 Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Tue, 4 Aug 2020 16:43:18 -0600 Subject: [PATCH 2/3] msm: kgsl: Fix device check when enabling counters via cmdstream This is because gmu and rgmu based targets don't use the ADRENO_DEVICE_STARTED anymore. Instead, we can use KGSL_STATE_ACTIVE which also indicates that the device is active. Change-Id: I485c9366ee570084a0d6a8eb93423c568009fc19 Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/adreno_perfcounter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno_perfcounter.c b/drivers/gpu/msm/adreno_perfcounter.c index 7b2966896400..18557ed7a4a7 100644 --- a/drivers/gpu/msm/adreno_perfcounter.c +++ b/drivers/gpu/msm/adreno_perfcounter.c @@ -753,7 +753,7 @@ static int _perfcounter_enable_default(struct adreno_device *adreno_dev, reg = &(grp->regs[counter]); if (_perfcounter_inline_update(adreno_dev, group) && - test_bit(ADRENO_DEVICE_STARTED, &adreno_dev->priv)) { + (device->state == KGSL_STATE_ACTIVE)) { struct adreno_ringbuffer *rb = &adreno_dev->ringbuffers[0]; unsigned int buf[4]; unsigned int *cmds = buf; From 2a1ab962b377deee3912cff59fb0854556b8d624 Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Tue, 4 Aug 2020 17:49:47 -0600 Subject: [PATCH 3/3] msm: kgsl: Add back power tracepoints to gmu and rgmu targets This ensures compatibility with existing tools that rely on the important power related tracepoints. Only need to print the tracepoints and no need to modify the states. Change-Id: I87432aff998cb21a22452a152bd5e6b8f59c0f75 Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/adreno_a6xx_gmu.c | 29 +++++++++++++++++++++++++++++ drivers/gpu/msm/adreno_a6xx_rgmu.c | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index 28e9a7254d2d..e7b2f5124748 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -2138,6 +2138,8 @@ static int a6xx_gmu_first_boot(struct adreno_device *adreno_dev) struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); int level, ret; + trace_kgsl_pwr_request_state(device, KGSL_STATE_AWARE); + ret = a6xx_gmu_aop_send_acd_state(gmu->mailbox.channel, adreno_dev->acd_enabled); if (ret) { @@ -2202,6 +2204,8 @@ static int a6xx_gmu_first_boot(struct adreno_device *adreno_dev) device->gmu_fault = false; + trace_kgsl_pwr_set_state(device, KGSL_STATE_AWARE); + return 0; err: @@ -2227,6 +2231,8 @@ static int a6xx_gmu_boot(struct adreno_device *adreno_dev) struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev); int ret = 0; + trace_kgsl_pwr_request_state(device, KGSL_STATE_AWARE); + ret = a6xx_gmu_enable_gdsc(adreno_dev); if (ret) return ret; @@ -2275,6 +2281,8 @@ static int a6xx_gmu_boot(struct adreno_device *adreno_dev) device->gmu_fault = false; + trace_kgsl_pwr_set_state(device, KGSL_STATE_AWARE); + return 0; err: @@ -2921,6 +2929,8 @@ static int a6xx_boot(struct adreno_device *adreno_dev) WARN_ON(test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)); + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_gmu_boot(adreno_dev); if (ret) return ret; @@ -2937,6 +2947,8 @@ static int a6xx_boot(struct adreno_device *adreno_dev) set_bit(GMU_PRIV_GPU_STARTED, &gmu->flags); device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + return ret; } @@ -2970,6 +2982,8 @@ static int a6xx_first_boot(struct adreno_device *adreno_dev) if (ret) return ret; + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_gmu_first_boot(adreno_dev); if (ret) return ret; @@ -3007,6 +3021,9 @@ static int a6xx_first_boot(struct adreno_device *adreno_dev) device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + + return 0; } @@ -3033,6 +3050,8 @@ static int a6xx_power_off(struct adreno_device *adreno_dev) WARN_ON(!test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)); + trace_kgsl_pwr_request_state(device, KGSL_STATE_SLUMBER); + ret = a6xx_gmu_oob_set(device, oob_gpu); if (ret) { a6xx_gmu_oob_clear(device, oob_gpu); @@ -3079,6 +3098,8 @@ no_gx_power: kgsl_pwrscale_sleep(device); + trace_kgsl_pwr_set_state(device, KGSL_STATE_SLUMBER); + return ret; } @@ -3170,6 +3191,8 @@ static int a6xx_gmu_pm_suspend(struct adreno_device *adreno_dev) if (test_bit(GMU_PRIV_PM_SUSPEND, &gmu->flags)) return 0; + trace_kgsl_pwr_request_state(device, KGSL_STATE_SUSPEND); + /* Halt any new submissions */ reinit_completion(&device->halt_gate); @@ -3192,6 +3215,8 @@ static int a6xx_gmu_pm_suspend(struct adreno_device *adreno_dev) adreno_dispatcher_halt(device); + trace_kgsl_pwr_set_state(device, KGSL_STATE_SUSPEND); + return 0; err: adreno_dispatcher_start(device); @@ -3232,6 +3257,8 @@ static void a6xx_gmu_touch_wakeup(struct adreno_device *adreno_dev) if (test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags)) goto done; + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_gmu_boot(adreno_dev); if (ret) return; @@ -3245,6 +3272,8 @@ static void a6xx_gmu_touch_wakeup(struct adreno_device *adreno_dev) set_bit(GMU_PRIV_GPU_STARTED, &gmu->flags); device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + done: /* * When waking up from a touch event we want to stay active long enough diff --git a/drivers/gpu/msm/adreno_a6xx_rgmu.c b/drivers/gpu/msm/adreno_a6xx_rgmu.c index 0b0846230a2d..2e086d3bd3d0 100644 --- a/drivers/gpu/msm/adreno_a6xx_rgmu.c +++ b/drivers/gpu/msm/adreno_a6xx_rgmu.c @@ -800,6 +800,8 @@ static int a6xx_rgmu_boot(struct adreno_device *adreno_dev) struct kgsl_device *device = KGSL_DEVICE(adreno_dev); int ret; + trace_kgsl_pwr_request_state(device, KGSL_STATE_AWARE); + ret = a6xx_rgmu_enable_gdsc(adreno_dev); if (ret) return ret; @@ -827,6 +829,8 @@ static int a6xx_rgmu_boot(struct adreno_device *adreno_dev) device->gmu_fault = false; + trace_kgsl_pwr_set_state(device, KGSL_STATE_AWARE); + return 0; err: @@ -871,6 +875,8 @@ static int a6xx_boot(struct adreno_device *adreno_dev) if (test_bit(RGMU_PRIV_GPU_STARTED, &rgmu->flags)) return 0; + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_rgmu_boot(adreno_dev); if (ret) return ret; @@ -888,6 +894,8 @@ static int a6xx_boot(struct adreno_device *adreno_dev) device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + return 0; } @@ -908,6 +916,8 @@ static void a6xx_rgmu_touch_wakeup(struct adreno_device *adreno_dev) if (test_bit(RGMU_PRIV_GPU_STARTED, &rgmu->flags)) goto done; + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_rgmu_boot(adreno_dev); if (ret) return; @@ -922,6 +932,8 @@ static void a6xx_rgmu_touch_wakeup(struct adreno_device *adreno_dev) device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + done: /* * When waking up from a touch event we want to stay active long enough @@ -963,6 +975,8 @@ static int a6xx_first_boot(struct adreno_device *adreno_dev) if (ret) return ret; + trace_kgsl_pwr_request_state(device, KGSL_STATE_ACTIVE); + ret = a6xx_rgmu_boot(adreno_dev); if (ret) return ret; @@ -986,6 +1000,8 @@ static int a6xx_first_boot(struct adreno_device *adreno_dev) device->state = KGSL_STATE_ACTIVE; + trace_kgsl_pwr_set_state(device, KGSL_STATE_ACTIVE); + return 0; } @@ -1018,6 +1034,8 @@ static int a6xx_power_off(struct adreno_device *adreno_dev) if (!test_bit(RGMU_PRIV_GPU_STARTED, &rgmu->flags)) return 0; + trace_kgsl_pwr_request_state(device, KGSL_STATE_SLUMBER); + ret = a6xx_rgmu_oob_set(device, oob_gpu); if (ret) { a6xx_rgmu_oob_clear(device, oob_gpu); @@ -1065,6 +1083,8 @@ no_gx_power: kgsl_pwrscale_sleep(device); + trace_kgsl_pwr_set_state(device, KGSL_STATE_SLUMBER); + return ret; } @@ -1117,6 +1137,8 @@ static int a6xx_rgmu_pm_suspend(struct adreno_device *adreno_dev) if (test_bit(RGMU_PRIV_PM_SUSPEND, &rgmu->flags)) return 0; + trace_kgsl_pwr_request_state(device, KGSL_STATE_SUSPEND); + /* Halt any new submissions */ reinit_completion(&device->halt_gate); @@ -1138,6 +1160,8 @@ static int a6xx_rgmu_pm_suspend(struct adreno_device *adreno_dev) adreno_dispatcher_halt(device); + trace_kgsl_pwr_set_state(device, KGSL_STATE_SUSPEND); + return 0; err: adreno_dispatcher_start(device);