drm/msm/adreno: Fix warn splat for devices without revn
Subsystems (4)
PATCH 1/2 drm/msm/adreno: Fix warn splat for devices without revn
From: Rob Clark <[email protected]>
Recently, a WARN_ON() was introduced to ensure that revn is filled before adreno_is_aXYZ is called. This however doesn't work very well when revn is 0 by design (such as for A635).
--- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.h +6 -3
@@ -149,7 +149,8 @@ bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2);static inline bool adreno_is_revn (const struct adreno_gpu *gpu,uint32_t revn) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return gpu->revn == revn; }
@@ -161,14 +162,16 @@ static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu)static inline bool adreno_is_a2xx (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <300 ); }static inline bool adreno_is_a20x (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <210 ); }
Signature · 1 line
2.41.0
PATCH 2/2 drm/msm/a690: Remove revn and name
From: Rob Clark <[email protected]>
These fields are deprecated. But any userspace new enough to support a690 also knows how to identify the GPU based on chip-id.
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 -- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +0 -2
@@ -369,8 +369,6 @@ static const struct adreno_info gpulist[] = { .hwcg = a640_hwcg, }, { .rev = ADRENO_REV(6, 9, 0, ANY_ID), - .revn = 690, - .name = "A690", .fw = { [ADRENO_FW_SQE] = "a660_sqe.fw", [ADRENO_FW_GMU] = "a690_gmu.bin",
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2 -1
@@ -310,7 +310,8 @@ static inline int adreno_is_a680(const struct adreno_gpu *gpu)static inline int adreno_is_a690 (const struct adreno_gpu *gpu) { -return adreno_is_revn (gpu,690 ); +/* The order of args is important here to handle ANY_ID correctly */ +return adreno_cmp_rev (ADRENO_REV (6 ,9 ,0 ,ANY_ID ), gpu->rev); };/* check for a615, a616, a618, a619 or any derivatives */ static inline int adreno_is_a615_family (const struct adreno_gpu *gpu)
Signature · 1 line
2.41.0
Quoted 29 lines · Rob Clark
From: Rob Clark <[email protected]>
Recently, a
WARN_ON()was introduced to ensure that revn is filled beforeadreno_is_aXYZis called. This however doesn't work very well when revn is 0 by design (such as for A635).Cc Konrad Dybcio <[email protected]>Fixes cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set")Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/adreno/adreno_gpu.h +2
-1@@ -149,7 +149,8 @@ bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2);static inline bool adreno_is_revn (const struct adreno_gpu *gpu,uint32_t revn) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return gpu->revn == revn; }
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 168
Quoted 8 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2
-1@@ -161,14 +162,16 @@ static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu)static inline bool adreno_is_a2xx (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <300 );
This is then incorrect for a635 / a690 if they have revn at 0.
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 176
Quoted 9 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2
-1}static inline bool adreno_is_a20x (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <210 );
And this too.
Quoted 4 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0
-1} --2.41.0
Signature · 2 lines
With best wishes Dmitry
Quoted 38 lines · Dmitry Baryshkov
Quoted 36 lines · Rob Clark
From: Rob Clark <[email protected]>
Recently, a
WARN_ON()was introduced to ensure that revn is filled beforeadreno_is_aXYZis called. This however doesn't work very well when revn is 0 by design (such as for A635).Cc Konrad Dybcio <[email protected]>Fixes cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set")Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/adreno/adreno_gpu.h +4
-2@@ -149,7 +149,8 @@ bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2);static inline bool adreno_is_revn (const struct adreno_gpu *gpu,uint32_t revn) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return gpu->revn == revn; }@@ -161,14 +162,16 @@ static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu)static inline bool adreno_is_a2xx (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);
Quoted 3 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 168
Quoted 1 line
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0
-0return (gpu->revn <300 );This is then incorrect for a635 / a690 if they have revn at 0.
Fortunately not any more broken that it has ever been. But as long as sc7280/sc8280 have GPU OPP tables, you'd never hit this. I'm working on a better solution for next merge window.
BR,
-R
Quoted 21 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 176
Quoted 9 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2
-1}static inline bool adreno_is_a20x (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <210 );And this too.
Quoted 4 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0
-1} --2.41.0
--
With best wishes
Dmitry
Dmitry Baryshkov
Reviewed-byQuoted 40 lines · Rob Clark
Quoted 38 lines · Dmitry Baryshkov
Quoted 36 lines · Rob Clark
From: Rob Clark <[email protected]>
Recently, a
WARN_ON()was introduced to ensure that revn is filled beforeadreno_is_aXYZis called. This however doesn't work very well when revn is 0 by design (such as for A635).Cc Konrad Dybcio <[email protected]>Fixes cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set")Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/msm/adreno/adreno_gpu.h +4
-2@@ -149,7 +149,8 @@ bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2);static inline bool adreno_is_revn (const struct adreno_gpu *gpu,uint32_t revn) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return gpu->revn == revn; }@@ -161,14 +162,16 @@ static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu)static inline bool adreno_is_a2xx (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 168
Quoted 1 line
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0
-0return (gpu->revn <300 );This is then incorrect for a635 / a690 if they have revn at 0.
Fortunately not any more broken that it has ever been. But as long as sc7280/sc8280 have GPU OPP tables, you'd never hit this. I'm working on a better solution for next merge window.
Sounds fine with me then.
Quoted 25 lines
BR,
-RQuoted 21 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h static inline bool adreno_has_gmu_wrapper(const struct adreno_gpu *gpu) · line 176
Quoted 9 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +2
-1}static inline bool adreno_is_a20x (const struct adreno_gpu *gpu) { -WARN_ON_ONCE (!gpu->revn); +/* revn can be zero, but if not is set at same time as info */ +WARN_ON_ONCE (!gpu->info);return (gpu->revn <210 );And this too.
Quoted 4 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0
-1} --2.41.0
--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 2/2] drm/msm/a690: Remove revn and name
In reply to Rob ClarkQuoted 10 lines · Rob Clark
From: Rob Clark <[email protected]>
These fields are deprecated. But any userspace new enough to support a690 also knows how to identify the GPU based on chip-id.
Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 -- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Quoted 6 lines · Rob Clark
From: Rob Clark <[email protected]>
Recently, a
WARN_ON()was introduced to ensure that revn is filled beforeadreno_is_aXYZis called. This however doesn't work very well when revn is 0 by design (such as for A635).
Quoted 7 lines
Cc Konrad Dybcio <[email protected]>Fixes cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified before being set")Signed-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)