* [PATCH v3 1/6] drm/msm/a6xx: Add some missing header definitions
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL Konrad Dybcio
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
Add a definition of the GMU_AHB_FENCE_STATUS_CLR reg and CP_PROTECT_CNTL
bitfields.
This may be substituted with a mesa header sync.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h
index 9ab15d91aced..fcd9eb53baf8 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.xml.h
@@ -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
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 1/6] drm/msm/a6xx: Add some missing header definitions Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
2023-06-20 7:18 ` kernel test robot
2023-06-19 16:44 ` [PATCH v3 3/6] drm/msm/a6xx: Skip empty protection ranges entries Konrad Dybcio
` (3 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
We have the necessary information, so explain which bit does what.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index b3ada1e7b598..cd0c9bccdc19 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -930,7 +930,10 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
* protect violation and 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));
+ gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL,
+ A6XX_CP_PROTECT_CNTL_ACCESS_PROT_EN |
+ A6XX_CP_PROTECT_CNTL_ACCESS_FAULT_ON_VIOL_EN |
+ A6XX_CP_PROTECT_CNTL_LAST_SPAN_INF_RANGE);
for (i = 0; i < count - 1; i++)
gpu_write(gpu, REG_A6XX_CP_PROTECT(i), regs[i]);
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL
2023-06-19 16:44 ` [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL Konrad Dybcio
@ 2023-06-20 7:18 ` kernel test robot
0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2023-06-20 7:18 UTC (permalink / raw)
To: Konrad Dybcio, Rob Clark, Abhinav Kumar, Dmitry Baryshkov,
Sean Paul, David Airlie, Daniel Vetter
Cc: oe-kbuild-all, Jonathan Marek, linux-arm-msm, linux-kernel,
dri-devel, Konrad Dybcio, Marijn Suijten, freedreno
Hi Konrad,
kernel test robot noticed the following build errors:
[auto build test ERROR on 47045630bc409ce6606d97b790895210dd1d517d]
url: https://github.com/intel-lab-lkp/linux/commits/Konrad-Dybcio/drm-msm-a6xx-Add-some-missing-header-definitions/20230620-004639
base: 47045630bc409ce6606d97b790895210dd1d517d
patch link: https://lore.kernel.org/r/20230517-topic-a7xx_prep-v3-2-a3ce3725385b%40linaro.org
patch subject: [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20230620/202306201502.pisn6tpR-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230620/202306201502.pisn6tpR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306201502.pisn6tpR-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/gpu/drm/msm/adreno/a6xx_gpu.c: In function 'a6xx_set_cp_protect':
>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c:934:19: error: 'A6XX_CP_PROTECT_CNTL_ACCESS_PROT_EN' undeclared (first use in this function)
934 | A6XX_CP_PROTECT_CNTL_ACCESS_PROT_EN |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/msm/adreno/a6xx_gpu.c:934:19: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c:935:19: error: 'A6XX_CP_PROTECT_CNTL_ACCESS_FAULT_ON_VIOL_EN' undeclared (first use in this function)
935 | A6XX_CP_PROTECT_CNTL_ACCESS_FAULT_ON_VIOL_EN |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c:936:19: error: 'A6XX_CP_PROTECT_CNTL_LAST_SPAN_INF_RANGE' undeclared (first use in this function)
936 | A6XX_CP_PROTECT_CNTL_LAST_SPAN_INF_RANGE);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SM_GCC_8350
Depends on [n]: COMMON_CLK [=y] && COMMON_CLK_QCOM [=m] && (ARM64 || COMPILE_TEST [=n])
Selected by [m]:
- SM_VIDEOCC_8350 [=m] && COMMON_CLK [=y] && COMMON_CLK_QCOM [=m]
WARNING: unmet direct dependencies detected for SM_GCC_8450
Depends on [n]: COMMON_CLK [=y] && COMMON_CLK_QCOM [=m] && (ARM64 || COMPILE_TEST [=n])
Selected by [m]:
- SM_GPUCC_8450 [=m] && COMMON_CLK [=y] && COMMON_CLK_QCOM [=m]
- SM_VIDEOCC_8450 [=m] && COMMON_CLK [=y] && COMMON_CLK_QCOM [=m]
WARNING: unmet direct dependencies detected for SM_GCC_8550
Depends on [n]: COMMON_CLK [=y] && COMMON_CLK_QCOM [=m] && (ARM64 || COMPILE_TEST [=n])
Selected by [m]:
- SM_GPUCC_8550 [=m] && COMMON_CLK [=y] && COMMON_CLK_QCOM [=m]
- SM_VIDEOCC_8550 [=m] && COMMON_CLK [=y] && COMMON_CLK_QCOM [=m]
vim +/A6XX_CP_PROTECT_CNTL_ACCESS_PROT_EN +934 drivers/gpu/drm/msm/adreno/a6xx_gpu.c
899
900 static void a6xx_set_cp_protect(struct msm_gpu *gpu)
901 {
902 struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
903 const u32 *regs = a6xx_protect;
904 unsigned i, count, count_max;
905
906 if (adreno_is_a650(adreno_gpu)) {
907 regs = a650_protect;
908 count = ARRAY_SIZE(a650_protect);
909 count_max = 48;
910 BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
911 } else if (adreno_is_a690(adreno_gpu)) {
912 regs = a690_protect;
913 count = ARRAY_SIZE(a690_protect);
914 count_max = 48;
915 BUILD_BUG_ON(ARRAY_SIZE(a690_protect) > 48);
916 } else if (adreno_is_a660_family(adreno_gpu)) {
917 regs = a660_protect;
918 count = ARRAY_SIZE(a660_protect);
919 count_max = 48;
920 BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
921 } else {
922 regs = a6xx_protect;
923 count = ARRAY_SIZE(a6xx_protect);
924 count_max = 32;
925 BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
926 }
927
928 /*
929 * Enable access protection to privileged registers, fault on an access
930 * protect violation and select the last span to protect from the start
931 * address all the way to the end of the register address space
932 */
933 gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL,
> 934 A6XX_CP_PROTECT_CNTL_ACCESS_PROT_EN |
> 935 A6XX_CP_PROTECT_CNTL_ACCESS_FAULT_ON_VIOL_EN |
> 936 A6XX_CP_PROTECT_CNTL_LAST_SPAN_INF_RANGE);
937
938 for (i = 0; i < count - 1; i++)
939 gpu_write(gpu, REG_A6XX_CP_PROTECT(i), regs[i]);
940 /* last CP_PROTECT to have "infinite" length on the last entry */
941 gpu_write(gpu, REG_A6XX_CP_PROTECT(count_max - 1), regs[i]);
942 }
943
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3 3/6] drm/msm/a6xx: Skip empty protection ranges entries
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 1/6] drm/msm/a6xx: Add some missing header definitions Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 2/6] drm/msm/a6xx: Use descriptive bitfield names for CP_PROTECT_CNTL Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 4/6] drm/msm/a6xx: Ensure clean GMU state in a6xx_gmu_fw_start Konrad Dybcio
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
Some specific SKUs leave certain protection range registers empty.
Allow for that behavior.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index cd0c9bccdc19..488c69cf08d3 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -935,8 +935,11 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
A6XX_CP_PROTECT_CNTL_ACCESS_FAULT_ON_VIOL_EN |
A6XX_CP_PROTECT_CNTL_LAST_SPAN_INF_RANGE);
- 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]);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 4/6] drm/msm/a6xx: Ensure clean GMU state in a6xx_gmu_fw_start
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
` (2 preceding siblings ...)
2023-06-19 16:44 ` [PATCH v3 3/6] drm/msm/a6xx: Skip empty protection ranges entries Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 5/6] drm/msm/a6xx: Improve GMU force shutdown sequence Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 6/6] drm/msm/a6xx: Fix up GMU region reservations Konrad Dybcio
5 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
While 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.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 5deb79924897..9929ff187368 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -790,6 +790,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;
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 5/6] drm/msm/a6xx: Improve GMU force shutdown sequence
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
` (3 preceding siblings ...)
2023-06-19 16:44 ` [PATCH v3 4/6] drm/msm/a6xx: Ensure clean GMU state in a6xx_gmu_fw_start Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
2023-06-19 16:44 ` [PATCH v3 6/6] drm/msm/a6xx: Fix up GMU region reservations Konrad Dybcio
5 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
The GMU force shutdown sequence involves some additional register cleanup
which was not implemented previously. Do so.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 9929ff187368..55b12a8066ee 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -893,6 +893,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);
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v3 6/6] drm/msm/a6xx: Fix up GMU region reservations
2023-06-19 16:44 [PATCH v3 0/6] Adreno QoL changes Konrad Dybcio
` (4 preceding siblings ...)
2023-06-19 16:44 ` [PATCH v3 5/6] drm/msm/a6xx: Improve GMU force shutdown sequence Konrad Dybcio
@ 2023-06-19 16:44 ` Konrad Dybcio
5 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-06-19 16:44 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter
Cc: Marijn Suijten, Jonathan Marek, linux-arm-msm, dri-devel,
freedreno, linux-kernel, Konrad Dybcio
Change 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.
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 55b12a8066ee..d682c1ed48db 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1640,13 +1640,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;
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread