Since commit f248d5d5159a ("drm/msm/a6xx: Fix PDC sleep sequence") the
PDC is only woken up when GMU_STATUS_PDC_SLEEP is set, i.e. after this
instance put it to sleep. The PDC lives outside the GPU and stays
asleep across a GPU unbind/bind, while gmu->status of the new instance
starts out clear. The wake sequence is then skipped, the GMU cannot
reach RPMh and the first GPU open after a rebind fails:
*ERROR* Message HFI_H2F_MSG_GX_BW_PERF_VOTE id 8 timed out waiting for
response
*ERROR* Timeout waiting for GMU OOB set GPU_SET: 0x0
*ERROR* gpu hw init failed: -110
On the first GMU boot of an instance, set GMU_STATUS_PDC_SLEEP if the
RSC status reports the PDC asleep, using the same bit a6xx_rpmh_stop()
waits for, so that the wake sequence still only follows a sleep. Move
the bit selection into a helper shared with a6xx_rpmh_stop().
Fixes: f248d5d5159a ("drm/msm/a6xx: Fix PDC sleep sequence")
Cc: [email protected]
Signed-off-by: Yuanjie Yang <[email protected]>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e6b8985c473b..8618887fb8be 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -623,6 +623,14 @@ static int a6xx_gmu_notify_slumber(struct a6xx_gmu *gmu)
return ret;
}
+static u32 a6xx_rsc_sleep_mask(struct adreno_gpu *adreno_gpu)
+{
+ if (adreno_is_a840(adreno_gpu) || adreno_is_a850_family(adreno_gpu))
+ return BIT(30);
+
+ return BIT(16);
+}
+
static int a6xx_rpmh_start(struct a6xx_gmu *gmu)
{
int ret;
@@ -657,16 +665,13 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
{
struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;
- u32 bitmask = BIT(16);
+ u32 bitmask = a6xx_rsc_sleep_mask(adreno_gpu);
int ret;
u32 val;
if (!test_and_clear_bit(GMU_STATUS_FW_START, &gmu->status))
return;
- if (adreno_is_a840(adreno_gpu) || adreno_is_a850_family(adreno_gpu))
- bitmask = BIT(30);
-
gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, 1);
ret = gmu_poll_timeout_rscc(gmu, REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0,
@@ -980,6 +985,13 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu,
unsigned int state)
else if (!adreno_is_a8xx(adreno_gpu))
gmu_write(gmu, REG_A6XX_GMU_GENERAL_7, 1);
+ if (!gmu->fw_loaded &&
+ (gmu_read_rscc(gmu, REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0) &
+ a6xx_rsc_sleep_mask(adreno_gpu))) {
+ DRM_DEV_DEBUG_DRIVER(gmu->dev, "GPU RSC left asleep, waking it
up\n");
+ set_bit(GMU_STATUS_PDC_SLEEP, &gmu->status);
+ }
+
ret = a6xx_rpmh_start(gmu);
if (ret)
return ret;
--
2.43.0