Skip to contentSkip to conversation

drm/msm/adreno: Update GPU name format

PATCH In review Rob Clark 3 participants 6 messages Mar 16

Subsystems (4)
lore
Share & tools
lore

Rob Clark

author maintainer
#0 lore raw

cover drm/msm/adreno: Update GPU name format

The "ipv4 style" of formatting the chip_id is less useful after a740 with the new chip_id format. Rather than doing dec->hex conversion in my head, just switch to using %08x, which is still easy enough to read for the old scheme.

Also, for a8xx update the name after patching in the slice-count.

This series only changes things for kernel dmesg.

Rob Clark (2):
drm/msm/adreno: Change chip_id format
drm/msm/a8xx: Update GPU name with slice_mask

 drivers/gpu/drm/msm/adreno/a8xx_gpu.c   | 10 ++++++++++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  8 ++------
 2 files changed, 12 insertions(+), 6 deletions(-)
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/2 drm/msm/adreno: Change chip_id format

The "ipv4-style" %u.%u.%u.%u used to make sense when the chip_id was simply encoding gen.major.minor.patch. But this hasn't been true for at least a couple years.

Switch to %08x, which is still easy enough to read for older devices, and much easier to read with the new scheme.

---
 drivers/gpu/drm/msm/adreno/adreno_gpu.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2 -6
index 1d0145f8b3ec..6cdfafcb0c57 100644
@@ -67,12 +67,8 @@ enum adreno_family {
 /* Helper for formating the chip_id in the way that userspace tools like
  * crashdec expect.
  */
-#define ADRENO_CHIPID_FMT "u.%u.%u.%u"
-#define ADRENO_CHIPID_ARGS(_c) \
-	(((_c) >> 24) & 0xff), \
-	(((_c) >> 16) & 0xff), \
-	(((_c) >> 8)  & 0xff), \
-	((_c) & 0xff)
+#define ADRENO_CHIPID_FMT "08x"
+#define ADRENO_CHIPID_ARGS(_c) (_c)
 
 struct adreno_gpu;
 
Signature · 1 line
2.53.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/msm/adreno: Change chip_id format

Quoted 4 lines · Rob Clark

The "ipv4-style" %u.%u.%u.%u used to make sense when the chip_id was simply encoding gen.major.minor.patch. But this hasn't been true for at least a couple years.

Quoted 8 lines

Switch to %08x, which is still easy enough to read for older devices, and much easier to read with the new scheme.

---
 drivers/gpu/drm/msm/adreno/adreno_gpu.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
author maintainer
#3 lore raw

PATCH 2/2 drm/msm/a8xx: Update GPU name with slice_mask

In reply to Rob Clark

Once we've updated the chip_id after reading the slice_mask, also update the GPU name so it matches.

---
 drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/msm/adreno/a8xx_gpu.c +10 -0
index 5a320f5bde41..fb1d92095db7 100644
@@ -87,6 +87,7 @@ void a8xx_gpu_get_slice_info(struct msm_gpu *gpu)
 	struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
 	struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
 	const struct a6xx_info *info = adreno_gpu->info->a6xx;
+	struct device *dev = &gpu->pdev->dev;
 	u32 slice_mask;
 
 	if (adreno_gpu->info->family < ADRENO_8XX_GEN1)
@@ -110,6 +111,15 @@ void a8xx_gpu_get_slice_info(struct msm_gpu *gpu)
 
 	/* Chip ID depends on the number of slices available. So update it */
 	adreno_gpu->chip_id |= FIELD_PREP(GENMASK(7, 4), hweight32(slice_mask));
+
+	/* Update the gpu-name to reflect the slice config: */
+	const char *name = devm_kasprintf(dev, GFP_KERNEL,
+			"%"ADRENO_CHIPID_FMT,
+			ADRENO_CHIPID_ARGS(adreno_gpu->chip_id));
+	if (name) {
+		devm_kfree(dev, adreno_gpu->base.name);
+		adreno_gpu->base.name = name;
+	}
 }
 
 static u32 a8xx_get_first_slice(struct a6xx_gpu *a6xx_gpu)
Signature · 1 line
2.53.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/msm/a8xx: Update GPU name with slice_mask

Quoted 8 lines · Rob Clark

Once we've updated the chip_id after reading the slice_mask, also update the GPU name so it matches.

---
 drivers/gpu/drm/msm/adreno/a8xx_gpu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
Quoted 1 line
Signature · 2 lines
With best wishes
Dmitry
reviewer Reviewed-by on the v1 series
#5 lore raw
In reply to Rob Clark
Quoted 9 lines · Rob Clark

The "ipv4 style" of formatting the chip_id is less useful after a740 with the new chip_id format. Rather than doing dec->hex conversion in my head, just switch to using %08x, which is still easy enough to read for the old scheme.

Also, for a8xx update the name after patching in the slice-count.

This series only changes things for kernel dmesg.

Quoted 8 lines

Rob Clark (2):
drm/msm/adreno: Change chip_id format
drm/msm/a8xx: Update GPU name with slice_mask

 drivers/gpu/drm/msm/adreno/a8xx_gpu.c   | 10 ++++++++++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h |  8 ++------
 2 files changed, 12 insertions(+), 6 deletions(-)

-Akhil.