Skip to contentSkip to conversation

drm/amd/pm: use pm mutex to protect ecc info table

PATCH In review Stanley.Yang 2 participants 2 messages Mar 10, 2022

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

PATCH 1/1 drm/amd/pm: use pm mutex to protect ecc info table

Change-Id I6afe0332cbb20528648c38665264930d6b091c2f
---
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +6 -1
index 9a892d6d1d7a..89fbee568be4 100644
@@ -643,11 +643,16 @@ int amdgpu_dpm_get_ecc_info(struct amdgpu_device *adev,
 			    void *umc_ecc)
 {
 	struct smu_context *smu = adev->powerplay.pp_handle;
+	int ret = 0;
 
 	if (!is_support_sw_smu(adev))
 		return -EOPNOTSUPP;
 
-	return smu_get_ecc_info(smu, umc_ecc);
+	mutex_lock(&adev->pm.mutex);
+	ret = smu_get_ecc_info(smu, umc_ecc);
+	mutex_unlock(&adev->pm.mutex);
+
+	return ret;
 }
 
 struct amd_vce_state *amdgpu_dpm_get_vce_clock_state(struct amdgpu_device *adev,
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

Quoted 43 lines

-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Thursday, March 10, 2022 10:02 PM
To: [email protected]; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Quan, Evan <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amd/pm: use pm mutex to protect ecc info table

Change-Id I6afe0332cbb20528648c38665264930d6b091c2f
---
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +6 -1
index 9a892d6d1d7a..89fbee568be4 100644
@@ -643,11 +643,16 @@ int amdgpu_dpm_get_ecc_info(struct
 amdgpu_device *adev,
 			    void *umc_ecc)
 {
 	struct smu_context *smu = adev->powerplay.pp_handle;
+	int ret = 0;
 
 	if (!is_support_sw_smu(adev))
 		return -EOPNOTSUPP;
 
-	return smu_get_ecc_info(smu, umc_ecc);
+	mutex_lock(&adev->pm.mutex);
+	ret = smu_get_ecc_info(smu, umc_ecc);
+	mutex_unlock(&adev->pm.mutex);
+
+	return ret;
 }
 

struct amd_vce_state *amdgpu_dpm_get_vce_clock_state(struct
amdgpu_device *adev,
--
2.17.1