On a7xx/a8xx a6xx_gmu_resume() warm boots the GMU when
CX_MISC_TCM_RET_CNTL reads back 1. The flag survives a GPU unbind/bind
as long as CX stays powered, but a warm boot skips a6xx_gmu_fw_load()
while the icache/dcache/dummy buffers of the new instance are empty, so
the first GPU open after a rebind fails:

  *ERROR* GMU firmware initialization timed out
  *ERROR* Couldn't power up the GPU: -110

Only allow a warm boot on a7xx/a8xx once this instance has loaded the
firmware.

Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support")
Cc: [email protected]
Signed-off-by: Yuanjie Yang <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 ++++
 drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e1178053953a..e6b8985c473b 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -992,6 +992,8 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned 
int state)
                ret = a6xx_gmu_fw_load(gmu);
                if (ret)
                        return ret;
+
+               gmu->fw_loaded = true;
        }
 
        /* Clear init result to make sure we are getting a fresh value */
@@ -1382,6 +1384,8 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
        if (adreno_is_a7xx(adreno_gpu) || adreno_is_a8xx(adreno_gpu)) {
                status = a6xx_cx_misc_read(a6xx_gpu, 
REG_A7XX_CX_MISC_TCM_RET_CNTL) == 1 ?
                        GMU_WARM_BOOT : GMU_COLD_BOOT;
+               if (!gmu->fw_loaded)
+                       status = GMU_COLD_BOOT;
        } else if (gmu->legacy) {
                status = gmu_read(gmu, REG_A6XX_GMU_GENERAL_7) == 1 ?
                        GMU_WARM_BOOT : GMU_COLD_BOOT;
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index b9e966e602e2..f3b8f22bd189 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -117,6 +117,7 @@ struct a6xx_gmu {
        bool initialized;
        bool hung;
        bool legacy; /* a618 or a630 */
+       bool fw_loaded;
 
        /* For power domain callback */
        struct notifier_block pd_nb;

-- 
2.43.0

Reply via email to