drm/msm/a6xx: add support for Adreno 660 GPU
Subsystems (4)
v3 cover drm/msm/a6xx: add support for Adreno 660 GPU
Add support for Adreno 660 to the drm/msm driver. Very similar to A650 on the kernel side.
v2:
- added AOP PDC path for a650 and use it for a660 too
- fix UBWC config for a650 (also affects a660)
- add CP_PROTECT update, and corresponding a660 settings in A660 patch
v3:
- removed patches already picked up by robclark
- added patches for missing PC_DBG_ECO_CNTL/GMU_CX_FALNEXT_INTF settings
- changed a660_protect to exclude CP_PERFCTR_CP_SEL
- removed 635 id from adreno_is_a650_family
- squashed a660 patches
Jonathan Marek (5):
drm/msm: remove unused icc_path/ocmem_icc_path drm/msm/a6xx: use AOP-initialized PDC for a650 drm/msm/a6xx: add GMU_CX_GMU_CX_FALNEXT_INTF write for a650 drm/msm/a6xx: add missing PC_DBG_ECO_CNTL bit for a640/a650 drm/msm/a6xx: add support for Adreno 660 GPU
drivers/gpu/drm/msm/adreno/a6xx.xml.h | 4 + drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 53 +++++-- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 + drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 172 +++++++++++++++++---- drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 33 ++++ drivers/gpu/drm/msm/adreno/adreno_device.c | 13 ++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 5 +- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 13 +- drivers/gpu/drm/msm/msm_gpu.h | 9 -- 9 files changed, 248 insertions(+), 56 deletions(-)
Signature · 1 line
2.26.1
PATCH v3 1/5 drm/msm: remove unused icc_path/ocmem_icc_path
These aren't used by anything anymore.
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 --- drivers/gpu/drm/msm/msm_gpu.h | 9 --------- 2 files changed, 12 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +0 -3
@@ -946,7 +946,4 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)pm_runtime_disable (&priv->gpu_pdev->dev);msm_gpu_cleanup (&adreno_gpu->base); - -icc_put (gpu->icc_path); -icc_put (gpu->ocmem_icc_path); }
drivers/gpu/drm/msm/msm_gpu.h +0 -9
@@ -118,15 +118,6 @@ struct msm_gpu {struct clk *ebi1_clk, *core_clk, *rbbmtimer_clk;uint32_t fast_rate; -/* The gfx-mem interconnect path that's used by all GPU types. */ -struct icc_path *icc_path; - -/* -* Second interconnect path for some A3xx and all A4xx GPUs to the -* On Chip MEMory (OCMEM). -*/ -struct icc_path *ocmem_icc_path; -/* Hang and Inactivity Detection: */ #define DRM_MSM_INACTIVE_PERIOD 66/* in ms (roughly four frames) */
Signature · 1 line
2.26.1
PATCH v3 2/5 drm/msm/a6xx: use AOP-initialized PDC for a650
In reply to Jonathan MarekSM8250 AOP firmware already sets up PDC registers for us, and it only needs to be enabled. This path will be used for other newer GPUs.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +16 -5
@@ -512,19 +512,26 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)struct adreno_gpu *adreno_gpu = &a6xx_gpu->base;struct platform_device *pdev =to_platform_device (gmu->dev);void __iomem *pdcptr =a6xx_gmu_get_mmio (pdev,"gmu_pdc" ); -void __iomem *seqptr =a6xx_gmu_get_mmio (pdev,"gmu_pdc_seq" ); +void __iomem *seqptr;uint32_t pdc_address_offset; +bool pdc_in_aop = false; -if (!pdcptr || !seqptr) +if (!pdcptr) goto err; -if (adreno_is_a618 (adreno_gpu) ||adreno_is_a640 (adreno_gpu)) +if (adreno_is_a650 (adreno_gpu)) + pdc_in_aop = true; +else if (adreno_is_a618 (adreno_gpu) ||adreno_is_a640 (adreno_gpu)) pdc_address_offset =0x30090 ; -else if (adreno_is_a650 (adreno_gpu)) - pdc_address_offset =0x300a0 ;else pdc_address_offset =0x30080 ; +if (!pdc_in_aop) { + seqptr =a6xx_gmu_get_mmio (pdev,"gmu_pdc_seq" ); +if (!seqptr) + goto err; + } +/* Disable SDE clock gating */ gmu_write_rscc (gmu,REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0 ,BIT (24 ));
@@ -556,6 +563,9 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)gmu_write_rscc (gmu,REG_A6XX_RSCC_SEQ_MEM_0_DRV0 +4 ,0x0020e8a8 ); } +if (pdc_in_aop) + goto setup_pdc; +/* Load PDC sequencer uCode for power up and power down sequence */ pdc_write (seqptr,REG_A6XX_PDC_GPU_SEQ_MEM_0 ,0xfebea1e1 );pdc_write (seqptr,REG_A6XX_PDC_GPU_SEQ_MEM_0 +1 ,0xa5a4a3a2 );
@@ -596,6 +606,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)pdc_write (pdcptr,REG_A6XX_PDC_GPU_TCS3_CMD0_DATA +8 ,0x3 );/* Setup GPU PDC */ +setup_pdc:pdc_write (pdcptr,REG_A6XX_PDC_GPU_SEQ_START_ADDR ,0 );pdc_write (pdcptr,REG_A6XX_PDC_GPU_ENABLE_PDC ,0x80000001 );
Signature · 1 line
2.26.1
PATCH v3 3/5 drm/msm/a6xx: add GMU_CX_GMU_CX_FALNEXT_INTF write for a650
In reply to Jonathan Marekdownstream msm-5.14 kernel added a write to this register, so match that.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 +++- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +3 -1
@@ -751,8 +751,10 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)int ret;u32 chipid; -if (adreno_is_a650 (adreno_gpu)) +if (adreno_is_a650 (adreno_gpu)) { +gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF ,1 );gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF ,1 ); + }if (state ==GMU_WARM_BOOT ) { ret =a6xx_rpmh_start (gmu);
drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h +2 -0
@@ -292,6 +292,8 @@ static inline uint32_t A6XX_GMU_GPU_NAP_CTRL_SID(uint32_t val)#define REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF 0x000050f0 +#define REF_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF 0x000050f1 +#define REG_A6XX_GPU_GMU_CX_GMU_PWR_COL_CP_MSG 0x00005100#define REG_A6XX_GPU_GMU_CX_GMU_PWR_COL_CP_RESP 0x00005101
Signature · 1 line
2.26.1
Re: [PATCH v3 3/5] drm/msm/a6xx: add GMU_CX_GMU_CX_FALNEXT_INTF write for a650
Quoted 2 lines · Jonathan Marek
downstream msm-5.14 kernel added a write to this register, so match that.
Note: this should say msm-5.4 (msm-5.14 is not a thing)
Quoted 36 lines
Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 +++- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/msm/adreno/a6xx_gmu.c +3
-1@@ -751,8 +751,10 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)int ret;u32 chipid; -if (adreno_is_a650 (adreno_gpu)) +if (adreno_is_a650 (adreno_gpu)) { +gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF ,1 );gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF ,1 ); + }if (state ==GMU_WARM_BOOT ) { ret =a6xx_rpmh_start (gmu);drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h +2
-0@@ -292,6 +292,8 @@ static inline uint32_t A6XX_GMU_GPU_NAP_CTRL_SID(uint32_t val)#define REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF 0x000050f0 +#define REF_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF 0x000050f1 +#define REG_A6XX_GPU_GMU_CX_GMU_PWR_COL_CP_MSG 0x00005100#define REG_A6XX_GPU_GMU_CX_GMU_PWR_COL_CP_RESP 0x00005101
PATCH v3 4/5 drm/msm/a6xx: add missing PC_DBG_ECO_CNTL bit for a640/a650
In reply to Jonathan MarekSee downstream's "disable_tseskip" flag.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +6 -4
@@ -844,13 +844,15 @@ static int a6xx_hw_init(struct msm_gpu *gpu)/* Setting the mem pool size */ gpu_write (gpu,REG_A6XX_CP_MEM_POOL_SIZE ,128 ); -/* Setting the primFifo thresholds default values */ +/* Setting the primFifo thresholds default values, +* and vccCacheSkipDis=1 bit (0x200) for A640 and newer +*/ if (adreno_is_a650 (adreno_gpu)) -gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00300000 ); +gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00300200 );else if (adreno_is_a640 (adreno_gpu)) -gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00200000 ); +gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00200200 );else -gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL , (0x300 <<11 )); +gpu_write (gpu,REG_A6XX_PC_DBG_ECO_CNTL ,0x00180000 );/* Set the AHB default slave response to "ERROR" */ gpu_write (gpu,REG_A6XX_CP_AHB_CNTL ,0x1 );
Signature · 1 line
2.26.1
PATCH v3 5/5 drm/msm/a6xx: add support for Adreno 660 GPU
In reply to Jonathan MarekAdd adreno_is_{a660,a650_family} helpers and convert update existing adreno_is_a650 usage based on downstream driver's logic (changing into adreno_is_a650_family or adding adreno_is_a660).
And add the remaining changes required for A660, again based on the downstream driver: missing GMU allocations, additional register init, dummy hfi BW table, cp protect list, entry in gpulist table, hwcg table, updated a6xx_ucode_check_version check.
--- drivers/gpu/drm/msm/adreno/a6xx.xml.h | 4 + drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 32 +++- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 162 +++++++++++++++++---- drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 33 +++++ drivers/gpu/drm/msm/adreno/adreno_device.c | 13 ++ drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 13 +- 8 files changed, 224 insertions(+), 37 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx.xml.h +4 -0
@@ -2240,6 +2240,8 @@ static inline uint32_t A6XX_DBGC_CFG_DBGBUS_BYTEL_1_BYTEL15(uint32_t val)#define REG_A6XX_DBGC_CFG_DBGBUS_TRACE_BUF2 0x00000630 +#define REG_A6XX_CP_LPAC_PROG_FIFO_SIZE 0x00000b34 +#define REG_A6XX_VSC_PERFCTR_VSC_SEL_0 0x00000cd8#define REG_A6XX_VSC_PERFCTR_VSC_SEL_1 0x00000cd9
@@ -2340,6 +2342,8 @@ static inline uint32_t A6XX_UCHE_CLIENT_PF_PERFSEL(uint32_t val)#define REG_A6XX_UCHE_PERFCTR_UCHE_SEL_11 0x00000e27 +#define REG_A6XX_UCHE_CMDQ_CONFIG 0x00000e3c +#define REG_A6XX_SP_ADDR_MODE_CNTL 0x0000ae01#define REG_A6XX_SP_NC_MODE_CNTL 0x0000ae02
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +24 -8
@@ -519,7 +519,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)if (!pdcptr) goto err; -if (adreno_is_a650 (adreno_gpu)) +if (adreno_is_a650 (adreno_gpu) ||adreno_is_a660 (adreno_gpu)) pdc_in_aop = true;else if (adreno_is_a618 (adreno_gpu) ||adreno_is_a640 (adreno_gpu)) pdc_address_offset =0x30090 ;
@@ -549,7 +549,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)gmu_write_rscc (gmu,REG_A6XX_RSCC_PDC_MATCH_VALUE_HI ,0x4514 );/* Load RSC sequencer uCode for sleep and wakeup */ -if (adreno_is_a650 (adreno_gpu)) { +if (adreno_is_a650_family (adreno_gpu)) {gmu_write_rscc (gmu,REG_A6XX_RSCC_SEQ_MEM_0_DRV0 ,0xeaaae5a0 );gmu_write_rscc (gmu,REG_A6XX_RSCC_SEQ_MEM_0_DRV0 +1 ,0xe1a1ebab );gmu_write_rscc (gmu,REG_A6XX_RSCC_SEQ_MEM_0_DRV0 +2 ,0xa2e0a581 );
@@ -597,7 +597,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)pdc_write (pdcptr,REG_A6XX_PDC_GPU_TCS3_CMD0_MSGID +4 ,0x10108 );pdc_write (pdcptr,REG_A6XX_PDC_GPU_TCS3_CMD0_ADDR +4 ,0x30000 ); -if (adreno_is_a618 (adreno_gpu) ||adreno_is_a650 (adreno_gpu)) +if (adreno_is_a618 (adreno_gpu) ||adreno_is_a650_family (adreno_gpu))pdc_write (pdcptr,REG_A6XX_PDC_GPU_TCS3_CMD0_DATA +4 ,0x2 );else pdc_write (pdcptr,REG_A6XX_PDC_GPU_TCS3_CMD0_DATA +4 ,0x3 );
@@ -698,7 +698,7 @@ static int a6xx_gmu_fw_load(struct a6xx_gmu *gmu)u32 itcm_base =0x00000000 ;u32 dtcm_base =0x00040000 ; -if (adreno_is_a650 (adreno_gpu)) +if (adreno_is_a650_family (adreno_gpu)) dtcm_base =0x10004000 ;if (gmu->legacy) {
@@ -751,7 +751,7 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)int ret;u32 chipid; -if (adreno_is_a650 (adreno_gpu)) { +if (adreno_is_a650_family (adreno_gpu)) {gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF ,1 );gmu_write (gmu,REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF ,1 ); }
@@ -1496,12 +1496,28 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)if (ret) goto err_put_device; + +/* A660 now requires handling "prealloc requests" in GMU firmware +* For now just hardcode allocations based on the known firmware. +* note: there is no indication that these correspond to "dummy" or +* "debug" regions, but this "guess" allows reusing these BOs which +* are otherwise unused by a660. +*/ + gmu->dummy.size =SZ_4K ; +if (adreno_is_a660 (adreno_gpu)) { + ret =a6xx_gmu_memory_alloc (gmu, &gmu->debug,SZ_4K *7 ,0x60400000 ); +if (ret) + goto err_memory; + + gmu->dummy.size =SZ_8K ; + } +/* Allocate memory for the GMU dummy page */ - ret =a6xx_gmu_memory_alloc (gmu, &gmu->dummy,SZ_4K ,0x60000000 ); + ret =a6xx_gmu_memory_alloc (gmu, &gmu->dummy, gmu->dummy.size,0x60000000 );if (ret) goto err_memory; -if (adreno_is_a650 (adreno_gpu)) { +if (adreno_is_a650_family (adreno_gpu)) { ret =a6xx_gmu_memory_alloc (gmu, &gmu->icache,SZ_16M -SZ_16K ,0x04000 );if (ret)
@@ -1543,7 +1559,7 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) goto err_memory; } -if (adreno_is_a650 (adreno_gpu)) { +if (adreno_is_a650_family (adreno_gpu)) { gmu->rscc =a6xx_gmu_get_mmio (pdev,"rscc" );if (IS_ERR (gmu->rscc)) goto err_mmio;
drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h +1 -1
@@ -292,7 +292,7 @@ static inline uint32_t A6XX_GMU_GPU_NAP_CTRL_SID(uint32_t val)#define REG_A6XX_GPU_GMU_CX_GMU_CX_FAL_INTF 0x000050f0 -#define REF_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF 0x000050f1 +#define REG_A6XX_GPU_GMU_CX_GMU_CX_FALNEXT_INTF 0x000050f1#define REG_A6XX_GPU_GMU_CX_GMU_PWR_COL_CP_MSG 0x00005100
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +136 -26
247 lines not on this page · raw message
drivers/gpu/drm/msm/adreno/a6xx_hfi.c +33 -0
@@ -351,6 +351,37 @@ static void a650_build_bw_table(struct a6xx_hfi_msg_bw_table *msg) msg->cnoc_cmds_data[1 ][0 ] =0x60000001 ; } +static void a660_build_bw_table (struct a6xx_hfi_msg_bw_table *msg) +{ +/* +* Send a single "off" entry just to get things running +* TODO: bus scaling +*/ + msg->bw_level_num =1 ; + + msg->ddr_cmds_num =3 ; + msg->ddr_wait_bitmask =0x01 ; + + msg->ddr_cmds_addrs[0 ] =0x50004 ; + msg->ddr_cmds_addrs[1 ] =0x500a0 ; + msg->ddr_cmds_addrs[2 ] =0x50000 ; + + msg->ddr_cmds_data[0 ][0 ] =0x40000000 ; + msg->ddr_cmds_data[0 ][1 ] =0x40000000 ; + msg->ddr_cmds_data[0 ][2 ] =0x40000000 ; + +/* +* These are the CX (CNOC) votes - these are used by the GMU but the +* votes are known and fixed for the target +*/ + msg->cnoc_cmds_num =1 ; + msg->cnoc_wait_bitmask =0x01 ; + + msg->cnoc_cmds_addrs[0 ] =0x50070 ; + msg->cnoc_cmds_data[0 ][0 ] =0x40000000 ; + msg->cnoc_cmds_data[1 ][0 ] =0x60000001 ; +} +static void a6xx_build_bw_table (struct a6xx_hfi_msg_bw_table *msg) {/* Send a single "off" entry since the 630 GMU doesn't do bus scaling */
@@ -401,6 +432,8 @@ static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu)a640_build_bw_table (&msg); else if (adreno_is_a650(adreno_gpu)) a650_build_bw_table(&msg); + else if (adreno_is_a660(adreno_gpu)) + a660_build_bw_table(&msg); else a6xx_build_bw_table(&msg);
drivers/gpu/drm/msm/adreno/adreno_device.c +13 -0
@@ -287,6 +287,19 @@ static const struct adreno_info gpulist[] = { .init = a6xx_gpu_init, .zapfw = "a650_zap.mdt", .hwcg = a650_hwcg, + }, { + .rev = ADRENO_REV(6, 6, 0, ANY_ID), + .revn = 660, + .name = "A660", + .fw = { + [ADRENO_FW_SQE] = "a660_sqe.fw", + [ADRENO_FW_GMU] = "a660_gmu.bin", + }, + .gmem = SZ_1M + SZ_512K, + .inactive_period = DRM_MSM_INACTIVE_PERIOD, + .init = a6xx_gpu_init, + .zapfw = "a660_zap.mdt", + .hwcg = a660_hwcg, }, };
drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 -1
@@ -239,7 +239,7 @@ int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value) *value = adreno_gpu->gmem;return 0 ;case MSM_PARAM_GMEM_BASE : - *value = !adreno_is_a650 (adreno_gpu) ?0x100000 :0 ; + *value = !adreno_is_a650_family (adreno_gpu) ?0x100000 :0 ;return 0 ;case MSM_PARAM_CHIP_ID : *value = adreno_gpu->rev.patchid |
drivers/gpu/drm/msm/adreno/adreno_gpu.h +12 -1
@@ -55,7 +55,7 @@ struct adreno_reglist {u32 value; }; -extern const struct adreno_reglist a630_hwcg[], a640_hwcg[], a650_hwcg[]; +extern const struct adreno_reglist a630_hwcg[], a640_hwcg[], a650_hwcg[], a660_hwcg[];struct adreno_info {struct adreno_rev rev;
@@ -247,6 +247,17 @@ static inline int adreno_is_a650(struct adreno_gpu *gpu)return gpu->revn ==650 ; } +static inline int adreno_is_a660 (struct adreno_gpu *gpu) +{ +return gpu->revn ==660 ; +} + +/* check for a650, a660, or any derivatives */ +static inline int adreno_is_a650_family (struct adreno_gpu *gpu) +{ +return gpu->revn ==650 || gpu->revn ==620 || gpu->revn ==660 ; +} +int adreno_get_param (struct msm_gpu *gpu,uint32_t param,uint64_t *value);const struct firmware *adreno_request_fw (struct adreno_gpu *adreno_gpu,const char *fwname);
Signature · 1 line
2.26.1