drm/amd/pm: use pm mutex to protect ecc info table
authorStanley.Yang <Stanley.Yang@amd.com>
Thu, 10 Mar 2022 13:55:09 +0000 (21:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Mar 2022 18:34:34 +0000 (14:34 -0400)
Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_dpm.c

index 9a892d6d1d7af86d332280fe83c76581ef84b7de..89fbee568be4ac514d5110536928ce379ca33c8f 100644 (file)
@@ -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,