Adreno QoL changes
Subsystems (4)
v2 cover Adreno QoL changes
This series brings some niceties in preparation for A7xx introduction.
It should be fully independent of the GMU wrapper series.
---
Changes in v2:
- Drop switching to using the GMU_AO counter in timestamp
- Add a definition for REG_A6XX_GMU_AHB_FENCE_STATUS_CLR, may be subbed
with a register sync after mesa MR22901
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Konrad Dybcio (6):
drm/msm/a6xx: Add REG_A6XX_GMU_AHB_FENCE_STATUS_CLR definition drm/msm/a6xx: Explain CP_PROTECT_CNTL writes in a6xx_set_cp_protect drm/msm/a6xx: Skip empty protection ranges entries drm/msm/a6xx: Ensure clean GMU state in a6xx_gmu_fw_start drm/msm/a6xx: Improve GMU force shutdown sequence drm/msm/a6xx: Fix up GMU region reservations
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 21 +++++++++++++++++---- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 ++ drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 14 +++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-)
---
base-commit: dbd91ef4e91c1ce3a24429f5fb3876b7a0306733
change-id: 20230517-topic-a7xx_prep-787a69c7d0ff
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH v2 1/6 drm/msm/a6xx: Add REG_A6XX_GMU_AHB_FENCE_STATUS_CLR definition
Add a definition of the REG_A6XX_GMU_AHB_FENCE_STATUS_CLR register. This may be substituted with a mesa header sync after MR22901 is merged.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h +2 -0
@@ -425,6 +425,8 @@ static inline uint32_t A6XX_GMU_GPU_NAP_CTRL_SID(uint32_t val)#define REG_A6XX_GMU_AHB_FENCE_STATUS 0x00009313 +#define REG_A6XX_GMU_AHB_FENCE_STATUS_CLR 0x00009314 +#define REG_A6XX_GMU_RBBM_INT_UNMASKED_STATUS 0x00009315#define REG_A6XX_GMU_AO_SPARE_CNTL 0x00009316
Signature · 1 line
2.40.1
PATCH v2 2/6 drm/msm/a6xx: Explain CP_PROTECT_CNTL writes in a6xx_set_cp_protect
In reply to Konrad DybcioWe have the necessary information, so explain which bit does what.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +4 -3
@@ -771,9 +771,10 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu) }/* -* Enable access protection to privileged registers, fault on an access -* protect violation and select the last span to protect from the start -* address all the way to the end of the register address space +* BIT(0) - Enable access protection to privileged registers +* BIT(1) - Enable fault on an access protect violation +* BIT(3) - Select the last span to protect from the start +* address all the way to the end of the register address space */ gpu_write (gpu,REG_A6XX_CP_PROTECT_CNTL ,BIT (0 ) |BIT (1 ) |BIT (3 ));
Signature · 1 line
2.40.1
Re: [PATCH v2 2/6] drm/msm/a6xx: Explain CP_PROTECT_CNTL writes in a6xx_set_cp_protect
Quoted 13 lines · Konrad Dybcio
We have the necessary information, so explain which bit does what.
Signed-off-by Konrad Dybcio <[email protected]>--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/adreno/a6xx_gpu.c +0
-0
drivers/gpu/drm/msm/adreno/a6xx_gpu.c static void a6xx_set_cp_protect(struct msm_gpu *gpu) · line 777
Quoted 10 lines
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +4
-3@@ -771,9 +771,10 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu) }/* -* Enable access protection to privileged registers, fault on an access -* protect violation and select the last span to protect from the start -* address all the way to the end of the register address space +* BIT(0) - Enable access protection to privileged registers +* BIT(1) - Enable fault on an access protect violation +* BIT(3) - Select the last span to protect from the start +* address all the way to the end of the register address space
Even better would be to give these bitfields names in the xml, which also gets you more meaningful decoding. We've been better about not open-coding a lot of stuff on the mesa side, but it is a bit easier with header generation integrated into the build.. but less open-coding on the kernel side is still a noble goal
BR,
-R
Quoted 7 lines
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +0
-1*/ gpu_write (gpu,REG_A6XX_CP_PROTECT_CNTL ,BIT (0 ) |BIT (1 ) |BIT (3 )); --2.40.1
PATCH v2 3/6 drm/msm/a6xx: Skip empty protection ranges entries
In reply to Konrad DybcioSome specific SKUs leave certain protection range registers empty. Allow for that behavior.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +5 -2
@@ -778,8 +778,11 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)*/ gpu_write (gpu,REG_A6XX_CP_PROTECT_CNTL ,BIT (0 ) |BIT (1 ) |BIT (3 )); -for (i =0 ; i < count -1 ; i++) -gpu_write (gpu,REG_A6XX_CP_PROTECT (i), regs[i]); +for (i =0 ; i < count -1 ; i++) { +/* Intentionally skip writing to some registers */ +if (regs[i]) +gpu_write (gpu,REG_A6XX_CP_PROTECT (i), regs[i]); + }/* last CP_PROTECT to have "infinite" length on the last entry */ gpu_write (gpu,REG_A6XX_CP_PROTECT (count_max -1 ), regs[i]); }
Signature · 1 line
2.40.1
PATCH v2 4/6 drm/msm/a6xx: Ensure clean GMU state in a6xx_gmu_fw_start
In reply to Konrad DybcioWhile it's not very well understood, there is some sort of a fault handler implemented in the GMU firmware which triggers when a certain bit is set, resulting in the M3 core not booting up the way we expect it to.
Write a magic value to a magic register to hopefully prevent that from happening.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +6 -0
@@ -796,6 +796,12 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)gmu_write (gmu,REG_A6XX_GMU_AHB_FENCE_RANGE_0 , (1 <<31 ) | (0xa <<18 ) | (0xa0 )); +/* +* Snapshots toggle the NMI bit which will result in a jump to the NMI +* handler instead of __main. Set the M3 config value to avoid that. +*/ +gmu_write (gmu,REG_A6XX_GMU_CM3_CFG ,0x4052 ); + chipid = adreno_gpu->rev.core <<24 ; chipid |= adreno_gpu->rev.major <<16 ; chipid |= adreno_gpu->rev.minor <<12 ;
Signature · 1 line
2.40.1
PATCH v2 5/6 drm/msm/a6xx: Improve GMU force shutdown sequence
In reply to Konrad DybcioThe GMU force shutdown sequence involves some additional register cleanup which was not implemented previously. Do so.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +7 -0
@@ -930,6 +930,13 @@ static void a6xx_gmu_force_off(struct a6xx_gmu *gmu)/* Make sure there are no outstanding RPMh votes */ a6xx_gmu_rpmh_off (gmu); +/* Clear the WRITEDROPPED fields and put fence into allow mode */ +gmu_write (gmu,REG_A6XX_GMU_AHB_FENCE_STATUS_CLR ,0x7 ); +gmu_write (gmu,REG_A6XX_GMU_AO_AHB_FENCE_CTRL ,0 ); + +/* Make sure the above writes go through */ +wmb (); +/* Halt the gmu cm3 core */ gmu_write (gmu,REG_A6XX_GMU_CM3_SYSRESET ,1 );
Signature · 1 line
2.40.1
PATCH v2 6/6 drm/msm/a6xx: Fix up GMU region reservations
In reply to Konrad DybcioChange the order of region allocations to make the addresses match downstream. This shouldn't matter very much, but helps eliminate one more difference when comparing register accesses.
Also, make the log region 16K long. That's what it is, unconditionally on A6xx and A7xx.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +4 -4
@@ -1614,13 +1614,13 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) goto err_memory; } -/* Allocate memory for for the HFI queues */ - ret =a6xx_gmu_memory_alloc (gmu, &gmu->hfi,SZ_16K ,0 ,"hfi" ); +/* Allocate memory for the GMU log region */ + ret =a6xx_gmu_memory_alloc (gmu, &gmu->log,SZ_16K ,0 ,"log" );if (ret) goto err_memory; -/* Allocate memory for the GMU log region */ - ret =a6xx_gmu_memory_alloc (gmu, &gmu->log,SZ_4K ,0 ,"log" ); +/* Allocate memory for for the HFI queues */ + ret =a6xx_gmu_memory_alloc (gmu, &gmu->hfi,SZ_16K ,0 ,"hfi" );if (ret) goto err_memory;
Signature · 1 line
2.40.1