Skip to contentSkip to conversation

drm/amd/pm: Fix the error of dpm_enabled flag

PATCH In review Ma Jun 3 participants 3 messages Nov 15, 2023

Subsystems (3)
lore
Share & tools
lore

Ma Jun

author
#0 lore raw

PATCH 1/1 drm/amd/pm: Fix the error of dpm_enabled flag

Set dpm_enabled flag to false only when dpms is
successfully disabled.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -4
index 1b9896001172..4bb86315e8c1 100644
@@ -1740,6 +1740,8 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
 		return ret;
 	}
 
+	adev->pm.dpm_enabled = false;
+
 	return 0;
 }
 
@@ -1762,8 +1764,6 @@ static int smu_hw_fini(void *handle)
 	if (!smu->pm_enabled)
 		return 0;
 
-	adev->pm.dpm_enabled = false;
-
 	return smu_smc_hw_cleanup(smu);
 }
 
@@ -1808,8 +1808,6 @@ static int smu_suspend(void *handle)
 	if (!smu->pm_enabled)
 		return 0;
 
-	adev->pm.dpm_enabled = false;
-
 	ret = smu_smc_hw_cleanup(smu);
 	if (ret)
 		return ret;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Ma Jun

Set dpm_enabled flag to false only when dpms is
successfully disabled.

This a software flag and we block many services based on this flag status. I think the purpose of setting it early is to block other service calls which could come in between. Did you find any real issue with this?

Thanks,
Lijo

Quoted 36 lines
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -4
index 1b9896001172..4bb86315e8c1 100644
@@ -1740,6 +1740,8 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
  		return ret;
  	}
 
+	adev->pm.dpm_enabled = false;
+
  	return 0;
  }
 
@@ -1762,8 +1764,6 @@ static int smu_hw_fini(void *handle)
  	if (!smu->pm_enabled)
  		return 0;
 
-	adev->pm.dpm_enabled = false;
-
  	return smu_smc_hw_cleanup(smu);
  }
 
@@ -1808,8 +1808,6 @@ static int smu_suspend(void *handle)
  	if (!smu->pm_enabled)
  		return 0;
 
-	adev->pm.dpm_enabled = false;
-
  	ret = smu_smc_hw_cleanup(smu);
  	if (ret)
  		return ret;
#2 lore raw

Hi Lijo,

No real issue here.
Thanks for your explanation. :)

Regards,
Ma Jun

Quoted 51 lines · Lijo
Quoted 3 lines · Ma Jun

Set dpm_enabled flag to false only when dpms is
successfully disabled.

This a software flag and we block many services based on this flag status. I think the purpose of setting it early is to block other service calls which could come in between. Did you find any real issue with this?

Thanks,
Lijo

Quoted 36 lines
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -4
index 1b9896001172..4bb86315e8c1 100644
@@ -1740,6 +1740,8 @@ static int smu_smc_hw_cleanup(struct smu_context *smu)
  		return ret;
  	}
 
+	adev->pm.dpm_enabled = false;
+
  	return 0;
  }
 
@@ -1762,8 +1764,6 @@ static int smu_hw_fini(void *handle)
  	if (!smu->pm_enabled)
  		return 0;
 
-	adev->pm.dpm_enabled = false;
-
  	return smu_smc_hw_cleanup(smu);
  }
 
@@ -1808,8 +1808,6 @@ static int smu_suspend(void *handle)
  	if (!smu->pm_enabled)
  		return 0;
 
-	adev->pm.dpm_enabled = false;
-
  	ret = smu_smc_hw_cleanup(smu);
  	if (ret)
  		return ret;