We can just simplify things and calculate the value, instead of manually
adding it to the nonctx list.

Signed-off-by: Rob Clark <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
index 3e22ef788f2d..6d7982a117f7 100644
--- a/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
@@ -373,7 +373,7 @@ static void a8xx_set_ubwc_config(struct msm_gpu *gpu)
                  hbb_lo << 1 | ubwc_mode);
 }
 
-static void a8xx_nonctxt_config(struct msm_gpu *gpu, u32 *gmem_protect)
+static void a8xx_nonctxt_config(struct msm_gpu *gpu)
 {
        struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
        struct a6xx_gmu *gmu = &to_a6xx_gpu(adreno_gpu)->gmu;
@@ -393,9 +393,6 @@ static void a8xx_nonctxt_config(struct msm_gpu *gpu, u32 
*gmem_protect)
                        if (!(BIT(pipe_id) & regs[i].pipe))
                                continue;
 
-                       if (regs[i].offset == REG_A8XX_RB_GC_GMEM_PROTECT)
-                               *gmem_protect = regs[i].value;
-
                        if ((regs[i].offset << 2) >= gmu->mmio_offset) {
                                gmu_write(gmu, regs[i].offset, regs[i].value);
                        } else {
@@ -641,7 +638,6 @@ static int hw_init(struct msm_gpu *gpu)
        struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
        struct a6xx_gmu *gmu = &a6xx_gpu->gmu;
        unsigned int pipe_id, i;
-       u32 gmem_protect = 0;
        u64 gmem_range_min;
        int ret;
 
@@ -722,7 +718,7 @@ static int hw_init(struct msm_gpu *gpu)
 
        gpu_write(gpu, REG_A8XX_UCHE_CLIENT_PF, BIT(7) | 0x1);
 
-       a8xx_nonctxt_config(gpu, &gmem_protect);
+       a8xx_nonctxt_config(gpu);
 
        /* Enable fault detection */
        gpu_write(gpu, REG_A8XX_RBBM_INTERFACE_HANG_INT_CNTL, BIT(30) | 
0xcfffff);
@@ -841,8 +837,8 @@ static int hw_init(struct msm_gpu *gpu)
         * GMEM_PROTECT register should be programmed after GPU is transitioned 
to
         * non-secure mode
         */
-       a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_RB_GC_GMEM_PROTECT, 
gmem_protect);
-       WARN_ON(!gmem_protect);
+       a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_RB_GC_GMEM_PROTECT,
+                       (adreno_gpu->info->gmem / SZ_4K) << 16);
        a8xx_aperture_clear(gpu);
 
        if (!a6xx_gpu->pwrup_reglist_emitted) {
-- 
2.56.0

Reply via email to