Skip to contentSkip to conversation

drm/msm/a6xx: Fix speed-bin detection vs probe-defer

PATCH In review Rob Clark 2 participants 2 messages Nov 15, 2022 – Nov 17, 2022

Subsystems (4)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH v3 1/1 drm/msm/a6xx: Fix speed-bin detection vs probe-defer

From: Rob Clark <[email protected]>

If we get an error (other than -ENOENT) we need to propagate that up the stack. Otherwise if the nvmem driver hasn't probed yet, we'll end up end up claiming that we support all the OPPs which is not likely to be true (and on some generations impossible to be true, ie. if there are conflicting OPPs).

v2: Update commit msg, gc unused label, etc
v3: Add previously missing \n's

Fixed: fe7952c629da ("drm/msm: Add speed-bin support to a618 gpu")

---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +5 -7
index 7fe60c65a1eb..ebe9599a8316 100644
@@ -1931,7 +1931,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
 
 	if (val == UINT_MAX) {
 		DRM_DEV_ERROR(dev,
-			"missing support for speed-bin: %u. Some OPPs may not be supported by hardware",
+			"missing support for speed-bin: %u. Some OPPs may not be supported by hardware\n",
 			fuse);
 		return UINT_MAX;
 	}
@@ -1941,7 +1941,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
 
 static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
 {
-	u32 supp_hw = UINT_MAX;
+	u32 supp_hw;
 	u32 speedbin;
 	int ret;
 
@@ -1953,15 +1953,13 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
 	if (ret == -ENOENT) {
 		return 0;
 	} else if (ret) {
-		DRM_DEV_ERROR(dev,
-			      "failed to read speed-bin (%d). Some OPPs may not be supported by hardware",
-			      ret);
-		goto done;
+		dev_err_probe(dev, ret,
+			      "failed to read speed-bin. Some OPPs may not be supported by hardware\n");
+		return ret;
 	}
 
 	supp_hw = fuse_to_supp_hw(dev, rev, speedbin);
 
-done:
 	ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1);
 	if (ret)
 		return ret;
Signature · 1 line
2.38.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 49 lines · Rob Clark

From: Rob Clark <[email protected]>

If we get an error (other than -ENOENT) we need to propagate that up the stack. Otherwise if the nvmem driver hasn't probed yet, we'll end up end up claiming that we support all the OPPs which is not likely to be true (and on some generations impossible to be true, ie. if there are conflicting OPPs).

v2: Update commit msg, gc unused label, etc
v3: Add previously missing \n's

Fixed: fe7952c629da ("drm/msm: Add speed-bin support to a618 gpu")

---
  drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +3 -6
index 7fe60c65a1eb..ebe9599a8316 100644
@@ -1931,7 +1931,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
 
  	if (val == UINT_MAX) {
  		DRM_DEV_ERROR(dev,
-			"missing support for speed-bin: %u. Some OPPs may not be supported by hardware",
+			"missing support for speed-bin: %u. Some OPPs may not be supported by hardware\n",
  			fuse);
  		return UINT_MAX;
  	}
@@ -1941,7 +1941,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
 
  static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
  {
-	u32 supp_hw = UINT_MAX;
+	u32 supp_hw;
  	u32 speedbin;
  	int ret;
 
@@ -1953,15 +1953,13 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
  	if (ret == -ENOENT) {
  		return 0;
  	} else if (ret) {
-		DRM_DEV_ERROR(dev,
-			      "failed to read speed-bin (%d). Some OPPs may not be supported by hardware",
-			      ret);
-		goto done;
+		dev_err_probe(dev, ret,

drivers/gpu/drm/msm/adreno/a6xx_gpu.c static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev) · line 1965

Quoted 10 lines
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +2 -1
+			      "failed to read speed-bin. Some OPPs may not be supported by hardware\n");
+		return ret;
  	}
 
  	supp_hw = fuse_to_supp_hw(dev, rev, speedbin);
 
-done:
  	ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1);
  	if (ret)
  		return ret;

-Akhil.