[PATCH 2/4] drm/msm/a5xx: Get HBB dynamically, if available
Konrad Dybcio
konradybcio at kernel.org
Wed Apr 9 14:47:30 UTC 2025
From: Konrad Dybcio <konrad.dybcio at oss.qualcomm.com>
The Highest Bank address Bit value can change based on memory type used.
Attempt to retrieve it dynamically, and fall back to a reasonable
default (the one used prior to this change) on error.
Signed-off-by: Konrad Dybcio <konrad.dybcio at oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 650e5bac225f372e819130b891f1d020b464f17f..b6a8a7a03e2cbdde5983061d2dfc0c8106840672 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -9,6 +9,7 @@
#include <linux/pm_opp.h>
#include <linux/nvmem-consumer.h>
#include <linux/slab.h>
+#include <linux/soc/qcom/smem.h>
#include "msm_gem.h"
#include "msm_mmu.h"
#include "a5xx_gpu.h"
@@ -833,8 +834,12 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
- BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
- hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ hbb = qcom_smem_dram_get_hbb();
+ if (hbb < 0)
+ hbb = adreno_gpu->ubwc_config.highest_bank_bit;
+
+ hbb -= 13;
+ BUG_ON(hbb < 0);
gpu_write(gpu, REG_A5XX_TPL1_MODE_CNTL, hbb << 7);
gpu_write(gpu, REG_A5XX_RB_MODE_CNTL, hbb << 1);
@@ -1760,6 +1765,10 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
unsigned int nr_rings;
int ret;
+ /* We need data from SMEM to retrieve HBB in set_ubwc_config() */
+ if (!qcom_smem_is_available())
+ return ERR_PTR(-EPROBE_DEFER);
+
a5xx_gpu = kzalloc(sizeof(*a5xx_gpu), GFP_KERNEL);
if (!a5xx_gpu)
return ERR_PTR(-ENOMEM);
--
2.49.0
More information about the dri-devel
mailing list