[PATCH] drm/amd: Move IMU enable pm mutex call a level lower
Mario Limonciello
mario.limonciello at amd.com
Fri Dec 15 20:26:48 UTC 2023
smu_set_gfx_power_up_by_imu() is called by both
smu_set_gfx_imu_enable() and amdgpu_dpm_set_gfx_power_up_by_imu()
but only uses a mutex in amdgpu_dpm_set_gfx_power_up_by_imu().
Move the mutex use into smu_set_gfx_imu_enable() to protect multiple
simultaneous calls.
Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
---
drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 6 +-----
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 ++
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
index 6627ee07d52d..54906be6e15b 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
@@ -113,11 +113,7 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block
int amdgpu_dpm_set_gfx_power_up_by_imu(struct amdgpu_device *adev)
{
struct smu_context *smu = adev->powerplay.pp_handle;
- int ret = -EOPNOTSUPP;
-
- mutex_lock(&adev->pm.mutex);
- ret = smu_set_gfx_power_up_by_imu(smu);
- mutex_unlock(&adev->pm.mutex);
+ int ret = smu_set_gfx_power_up_by_imu(smu);
msleep(10);
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 59d67cbd98a0..5eb46b6bad43 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -168,7 +168,9 @@ int smu_set_gfx_power_up_by_imu(struct smu_context *smu)
struct amdgpu_device *adev = smu->adev;
if (smu->ppt_funcs->set_gfx_power_up_by_imu) {
+ mutex_lock(&adev->pm.mutex);
ret = smu->ppt_funcs->set_gfx_power_up_by_imu(smu);
+ mutex_unlock(&adev->pm.mutex);
if (ret)
dev_err(adev->dev, "Failed to enable gfx imu!\n");
}
--
2.34.1
More information about the amd-gfx
mailing list