From: Venkat Yadlapati <[email protected]>

Add support for the Adreno 829 (gen8_9_0) found on the Qualcomm Molokai
(SM8845) SoC. It is a two slice variant of the A840: same protected
registers, power-up lists and GBIF settings, but a smaller GMEM
(2432 KiB, hence a different GMEM protection range), its own firmware
and a smaller preemption context record.

Like on the A840, the GPU RSC signals that it is off through bit 30.

Assisted-by: LLM
Signed-off-by: Venkat Yadlapati <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c     |   3 +-
 drivers/gpu/drm/msm/adreno/a8xx_catalog.c | 100 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h   |   5 ++
 3 files changed, 107 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 662f09bec9d5..b8d94b2ca227 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -658,7 +658,8 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
        if (!test_and_clear_bit(GMU_STATUS_FW_START, &gmu->status))
                return;
 
-       if (adreno_is_a840(adreno_gpu) || adreno_is_a850_family(adreno_gpu))
+       if (adreno_is_a829(adreno_gpu) || adreno_is_a840(adreno_gpu) ||
+           adreno_is_a850_family(adreno_gpu))
                bitmask = BIT(30);
 
        gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, 1);
diff --git a/drivers/gpu/drm/msm/adreno/a8xx_catalog.c 
b/drivers/gpu/drm/msm/adreno/a8xx_catalog.c
index 55a805ab438c..6478849f6c96 100644
--- a/drivers/gpu/drm/msm/adreno/a8xx_catalog.c
+++ b/drivers/gpu/drm/msm/adreno/a8xx_catalog.c
@@ -840,6 +840,69 @@ static const struct adreno_reglist_pipe 
a840_nonctxt_regs[] = {
        { },
 };
 
+static const struct adreno_reglist_pipe a829_nonctxt_regs[] = {
+       { REG_A8XX_CP_SMMU_STREAM_ID_LPAC, 0x00000101, BIT(PIPE_NONE) },
+       { REG_A8XX_GRAS_DBG_ECO_CNTL, 0x00000800, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_GRAS_TSEFE_DBG_ECO_CNTL, 0x00200000, BIT(PIPE_BV) | 
BIT(PIPE_BR) },
+       { REG_A6XX_PC_AUTO_VERTEX_STRIDE, 0x00000001, BIT(PIPE_BV) | 
BIT(PIPE_BR) },
+       { REG_A8XX_PC_VIS_STREAM_CNTL, 0x10010000, BIT(PIPE_BV) | BIT(PIPE_BR) 
},
+       { REG_A8XX_PC_CONTEXT_SWITCH_STABILIZE_CNTL_1, 0x00000002, BIT(PIPE_BV) 
| BIT(PIPE_BR) },
+       { REG_A8XX_PC_CHICKEN_BITS_1, 0x00000003, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_PC_CHICKEN_BITS_2, 0x00000200, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_PC_CHICKEN_BITS_3, 0x00500000, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_PC_CHICKEN_BITS_4, 0x00500050, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       /* Disable Dead Draw Merge scheme on RB-HLSQ */
+       { REG_A6XX_RB_RBP_CNTL, BIT(5), BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A7XX_RB_CCU_CNTL, 0x00000068, BIT(PIPE_BR) },
+       /* Partially enable perf clear, Disable DINT to c/z be data forwarding 
*/
+       { REG_A7XX_RB_CCU_DBG_ECO_CNTL, 0x00002200, BIT(PIPE_BR) },
+       { REG_A8XX_RB_GC_GMEM_PROTECT, 0x02600000, BIT(PIPE_BR) },
+       { REG_A8XX_RB_RESOLVE_PREFETCH_CNTL, 0x00000007, BIT(PIPE_BR) },
+       { REG_A8XX_RB_CMP_DBG_ECO_CNTL, 0x00004000, BIT(PIPE_BR) },
+       { REG_A8XX_RBBM_NC_MODE_CNTL, 0x00000001, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_SLICE_NC_MODE_CNTL, 0x00000001, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_POWER_UP_RESET_SW_OVERRIDE, 0x70809060, BIT(PIPE_NONE) 
},
+       { REG_A8XX_RBBM_POWER_UP_RESET_SW_BV_OVERRIDE, 0x30000000, 
BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_WAIT_IDLE_CLOCKS_CNTL, 0x00000030, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_WAIT_IDLE_CLOCKS_CNTL2, 0x00000030, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_INTERFACE_HANG_INT_CNTL, 0x0fffffff, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_GBIF_CLIENT_QOS_CNTL, 0x22122212, BIT(PIPE_NONE) },
+       { REG_A8XX_RBBM_CGC_P2S_CNTL, 0x00000040, BIT(PIPE_NONE) },
+       /* Disable mode_switch optimization in UMAS */
+       { REG_A6XX_SP_CHICKEN_BITS, BIT(24) | BIT(26), BIT(PIPE_NONE) },
+       /* Disable LPAC large-LM mode */
+       { REG_A8XX_SP_SS_CHICKEN_BITS_0, BIT(3), BIT(PIPE_NONE) },
+       /* Disable PS out of order retire */
+       { REG_A7XX_SP_CHICKEN_BITS_2, 0x00c21800, BIT(PIPE_NONE) },
+       { REG_A7XX_SP_CHICKEN_BITS_3, 0x00300000, BIT(PIPE_NONE) },
+       /* Disable SP2TP info attribute */
+       { REG_A8XX_SP_CHICKEN_BITS_4, 0x00000002, BIT(PIPE_NONE) },
+       { REG_A6XX_SP_PERFCTR_SHADER_MASK, 0x0000003f, BIT(PIPE_NONE) },
+       { REG_A7XX_SP_HLSQ_DBG_ECO_CNTL, BIT(14), BIT(PIPE_NONE) },
+       /* Ignore HLSQ shared constant feedback from SP */
+       { REG_A7XX_SP_HLSQ_DBG_ECO_CNTL_1, BIT(17), BIT(PIPE_NONE) },
+       /* Disable CS dead batch merge */
+       { REG_A7XX_SP_HLSQ_DBG_ECO_CNTL_2, BIT(24), BIT(PIPE_NONE) },
+       { REG_A8XX_SP_HLSQ_DBG_ECO_CNTL_3, BIT(7), BIT(PIPE_NONE) },
+       { REG_A7XX_SP_HLSQ_TIMEOUT_THRESHOLD_DP, 0x00000080, BIT(PIPE_NONE) },
+       { REG_A7XX_SP_READ_SEL, 0x0001ff00, BIT(PIPE_NONE) },
+       { REG_A6XX_TPL1_DBG_ECO_CNTL, 0x10100000, BIT(PIPE_NONE) },
+       /* BIT(26): Disable final clamp for bicubic filtering */
+       { REG_A6XX_TPL1_DBG_ECO_CNTL1, 0x04000720, BIT(PIPE_NONE) },
+       { REG_A6XX_UCHE_MODE_CNTL, 0x80080000, BIT(PIPE_NONE) },
+       { REG_A8XX_UCHE_CCHE_MODE_CNTL, 0x00001000, BIT(PIPE_NONE) },
+       { REG_A8XX_UCHE_CCHE_CACHE_WAYS, 0x00000800, BIT(PIPE_NONE) },
+       { REG_A8XX_UCHE_GBIF_GX_CONFIG, 0x010240e0, BIT(PIPE_NONE) },
+       { REG_A8XX_UCHE_VARB_IDLE_TIMEOUT, 0x00000020, BIT(PIPE_NONE) },
+       { REG_A7XX_VFD_DBG_ECO_CNTL, 0x00008000, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_VFD_CB_BV_THRESHOLD, 0x00500050, BIT(PIPE_BV) | BIT(PIPE_BR) 
},
+       { REG_A8XX_VFD_CB_BR_THRESHOLD, 0x00600060, BIT(PIPE_BV) | BIT(PIPE_BR) 
},
+       { REG_A8XX_VFD_CB_BUSY_REQ_CNT, 0x00200020, BIT(PIPE_BV) | BIT(PIPE_BR) 
},
+       { REG_A8XX_VFD_CB_LP_REQ_CNT, 0x00000020, BIT(PIPE_BV) | BIT(PIPE_BR) },
+       { REG_A8XX_VPC_FLATSHADE_MODE_CNTL, 0x00000001, BIT(PIPE_BV) | 
BIT(PIPE_BR) },
+       { },
+};
+
 static const u32 a840_protect_regs[] = {
        A6XX_PROTECT_RDONLY(0x00008, 0x039b),
        A6XX_PROTECT_RDONLY(0x003b4, 0x008b),
@@ -1664,6 +1727,43 @@ static const struct adreno_info a8xx_gpus[] = {
                        { 252, 2 },
                        { 221, 3 },
                ),
+       }, {
+               .chip_ids = ADRENO_CHIP_IDS(0x44030a00),
+               .family = ADRENO_8XX_GEN2,
+               .fw = {
+                       [ADRENO_FW_SQE] = "gen80900_sqe.fw",
+                       [ADRENO_FW_GMU] = "gen80900_gmu.bin",
+                       [ADRENO_FW_AQE] = "gen80900_aqe.fw",
+               },
+               .gmem = 2432 * SZ_1K,
+               .inactive_period = DRM_MSM_INACTIVE_PERIOD,
+               .quirks = ADRENO_QUIRK_HAS_CACHED_COHERENT |
+                         ADRENO_QUIRK_HAS_HW_APRIV |
+                         ADRENO_QUIRK_PREEMPTION |
+                         ADRENO_QUIRK_IFPC,
+               .funcs = &a8xx_gpu_funcs,
+               .a6xx = &(const struct a6xx_info) {
+                       .protect = &a840_protect,
+                       .nonctxt_reglist = a829_nonctxt_regs,
+                       .pwrup_reglist = &a840_pwrup_reglist,
+                       .dyn_pwrup_reglist = &a840_dyn_pwrup_reglist,
+                       .ifpc_reglist = &a840_ifpc_reglist,
+                       .gbif_cx = a840_gbif,
+                       .max_slices = 2,
+                       .gmu_chipid = 0x8090000,
+                       .bcms = (const struct a6xx_bcm[]) {
+                               { .name = "SH0", .buswidth = 16 },
+                               { .name = "MC0", .buswidth = 4 },
+                               {
+                                       .name = "ACV",
+                                       .fixed = true,
+                                       .perfmode = BIT(2),
+                                       .perfmode_bw = 10687500,
+                               },
+                               { /* sentinel */ },
+                       },
+               },
+               .preempt_record_size = 3708 * SZ_1K,
        }, {
                .chip_ids = ADRENO_CHIP_IDS(0x44010000),
                .family = ADRENO_8XX_GEN1,
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index 4b2156825bdf..af13d4599d0d 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -612,6 +612,11 @@ static inline int adreno_is_x285_family(const struct 
adreno_gpu *gpu)
               gpu->info->chip_ids[0] == 0x44070001;
 }
 
+static inline int adreno_is_a829(struct adreno_gpu *gpu)
+{
+       return gpu->info->chip_ids[0] == 0x44030a00;
+}
+
 static inline int adreno_is_a830(struct adreno_gpu *gpu)
 {
        return gpu->info->chip_ids[0] == 0x44050001;

-- 
2.56.0


Reply via email to