Skip to contentSkip to conversation

drm/msm/a2xx: Pass the revision information

PATCH New Fabio Estevam 1 participant 4 messages Jun 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 drm/msm/a2xx: Pass the revision information

From: Fabio Estevam <[email protected]>

Commit cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set") exposes the need of setting the GPU revision fields prior to using the adreno_is_xxx() functions:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at drivers/gpu/drm/msm/adreno/adreno_gpu.h:171 a2xx_gpu_init+0x138/0x184
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.4.0-rc7-next-20230620 #993

Pass the GPU revision information to avoid run-time warning.

Tested on a imx53-qsb board.

---
Changes since v1:
- Make it part of a single patch series.

 drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/gpu/drm/msm/adreno/a2xx_gpu.c +19 -0
index c67089a7ebc1..4e1218462a23 100644
@@ -520,6 +520,8 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)
 	struct msm_gpu *gpu;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
+	struct adreno_platform_config *config = pdev->dev.platform_data;
+	const struct adreno_info *info;
 	int ret;
 
 	if (!pdev) {
@@ -540,6 +542,23 @@ struct msm_gpu *a2xx_gpu_init(struct drm_device *dev)
 	gpu->perfcntrs = perfcntrs;
 	gpu->num_perfcntrs = ARRAY_SIZE(perfcntrs);
 
+	/*
+	 * We need to know the platform type before calling into adreno_gpu_init
+	 * so that the hw_apriv flag can be correctly set. Snoop into the info
+	 * and grab the revision number
+	 */
+	info = adreno_info(config->rev);
+	if (!info)
+		return ERR_PTR(-EINVAL);
+
+	/* Assign these early so that we can use the is_aXYZ helpers */
+	/* Numeric revision IDs (e.g. 630) */
+	adreno_gpu->revn = info->revn;
+	/* New-style ADRENO_REV()-only */
+	adreno_gpu->rev = info->rev;
+	/* Quirk data */
+	adreno_gpu->info = info;
+
 	if (adreno_is_a20x(adreno_gpu))
 		adreno_gpu->registers = a200_registers;
 	else if (adreno_is_a225(adreno_gpu))
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 3/4 drm/msm/a4xx: Pass the revision information

From: Fabio Estevam <[email protected]>

Commit cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set") exposes the need of setting the GPU revision fields prior to using the adreno_is_xxx() functions.

Pass the GPU revision information to avoid run-time warning.

---
Build-tested only.

Changes since v1:
- None

 drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/msm/adreno/a4xx_gpu.c +21 -0
index 715436cb3996..2ae072b4e79d 100644
@@ -658,6 +658,8 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
 	struct msm_gpu *gpu;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
+	struct adreno_platform_config *config = pdev->dev.platform_data;
+	const struct adreno_info *info;
 	struct icc_path *ocmem_icc_path;
 	struct icc_path *icc_path;
 	int ret;
@@ -684,6 +686,25 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
 	if (ret)
 		goto fail;
 
+	/*
+	 * We need to know the platform type before calling into adreno_gpu_init
+	 * so that the hw_apriv flag can be correctly set. Snoop into the info
+	 * and grab the revision number
+	 */
+	info = adreno_info(config->rev);
+	if (!info) {
+		ret = -EINVAL;
+		goto fail;
+	}
+
+	/* Assign these early so that we can use the is_aXYZ helpers */
+	/* Numeric revision IDs (e.g. 630) */
+	adreno_gpu->revn = info->revn;
+	/* New-style ADRENO_REV()-only */
+	adreno_gpu->rev = info->rev;
+	/* Quirk data */
+	adreno_gpu->info = info;
+
 	adreno_gpu->registers = adreno_is_a405(adreno_gpu) ? a405_registers :
 							     a4xx_registers;
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/4 drm/msm/a3xx: Pass the revision information

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Commit cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set") exposes the need of setting the GPU revision fields prior to using the adreno_is_xxx() functions.

Pass the GPU revision information to avoid run-time warning.

---
Build-tested only.

Changes since v1:
- None

 drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/msm/adreno/a3xx_gpu.c +21 -0
index c86b377f6f0d..fc23810d7684 100644
@@ -530,6 +530,8 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
 	struct msm_gpu *gpu;
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
+	struct adreno_platform_config *config = pdev->dev.platform_data;
+	const struct adreno_info *info;
 	struct icc_path *ocmem_icc_path;
 	struct icc_path *icc_path;
 	int ret;
@@ -558,6 +560,25 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
 	if (ret)
 		goto fail;
 
+	/*
+	 * We need to know the platform type before calling into adreno_gpu_init
+	 * so that the hw_apriv flag can be correctly set. Snoop into the info
+	 * and grab the revision number
+	 */
+	info = adreno_info(config->rev);
+	if (!info) {
+		ret = -EINVAL;
+		goto fail;
+	}
+
+	/* Assign these early so that we can use the is_aXYZ helpers */
+	/* Numeric revision IDs (e.g. 630) */
+	adreno_gpu->revn = info->revn;
+	/* New-style ADRENO_REV()-only */
+	adreno_gpu->rev = info->rev;
+	/* Quirk data */
+	adreno_gpu->info = info;
+
 	/* if needed, allocate gmem: */
 	if (adreno_is_a330(adreno_gpu)) {
 		ret = adreno_gpu_ocmem_init(&adreno_gpu->base.pdev->dev,
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 4/4 drm/msm/a5xx: Pass the revision information

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

Commit cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set") exposes the need of setting the GPU revision fields prior to using the adreno_is_xxx() functions.

Pass the GPU revision information to avoid run-time warning.

---
Build-tested only.

Changes since v1:
- None

 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +18 -0
index a99310b68793..b4c1720ba89c 100644
@@ -1744,6 +1744,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
 	struct adreno_platform_config *config = pdev->dev.platform_data;
+	const struct adreno_info *info;
 	struct a5xx_gpu *a5xx_gpu = NULL;
 	struct adreno_gpu *adreno_gpu;
 	struct msm_gpu *gpu;
@@ -1770,6 +1771,23 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
 
 	nr_rings = 4;
 
+	/*
+	 * We need to know the platform type before calling into adreno_gpu_init
+	 * so that the hw_apriv flag can be correctly set. Snoop into the info
+	 * and grab the revision number
+	 */
+	info = adreno_info(config->rev);
+	if (!info)
+		return ERR_PTR(-EINVAL);
+
+	/* Assign these early so that we can use the is_aXYZ helpers */
+	/* Numeric revision IDs (e.g. 630) */
+	adreno_gpu->revn = info->revn;
+	/* New-style ADRENO_REV()-only */
+	adreno_gpu->rev = info->rev;
+	/* Quirk data */
+	adreno_gpu->info = info;
+
 	if (adreno_cmp_rev(ADRENO_REV(5, 1, 0, ANY_ID), config->rev))
 		nr_rings = 1;
 
Signature · 1 line
2.34.1