AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] drm/amd/pm: Add missing mutex for pp_get_power_profile_mode
@ 2021-11-01 21:28 Mario Limonciello
  2021-11-01 21:28 ` [PATCH v3 2/3] drm/amd/pm: Adjust returns when power_profile_mode is not supported Mario Limonciello
  2021-11-01 21:28 ` [PATCH v3 3/3] drm/amdgpu/pm: Don't show pp_power_profile_mode for unsupported devices Mario Limonciello
  0 siblings, 2 replies; 4+ messages in thread
From: Mario Limonciello @ 2021-11-01 21:28 UTC (permalink / raw)
  To: amd-gfx; +Cc: Mario Limonciello

Prevent possible issues from set and get being called simultaneously.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Changes from v2->v3:
 * New patch
 drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
index 321215003643..978007664e71 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
@@ -875,6 +875,7 @@ pp_dpm_get_vce_clock_state(void *handle, unsigned idx)
 static int pp_get_power_profile_mode(void *handle, char *buf)
 {
 	struct pp_hwmgr *hwmgr = handle;
+	int ret;
 
 	if (!hwmgr || !hwmgr->pm_en || !buf)
 		return -EINVAL;
@@ -884,7 +885,10 @@ static int pp_get_power_profile_mode(void *handle, char *buf)
 		return snprintf(buf, PAGE_SIZE, "\n");
 	}
 
-	return hwmgr->hwmgr_func->get_power_profile_mode(hwmgr, buf);
+	mutex_lock(&hwmgr->smu_lock);
+	ret = hwmgr->hwmgr_func->get_power_profile_mode(hwmgr, buf);
+	mutex_unlock(&hwmgr->smu_lock);
+	return ret;
 }
 
 static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-02  8:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-01 21:28 [PATCH v3 1/3] drm/amd/pm: Add missing mutex for pp_get_power_profile_mode Mario Limonciello
2021-11-01 21:28 ` [PATCH v3 2/3] drm/amd/pm: Adjust returns when power_profile_mode is not supported Mario Limonciello
2021-11-01 21:28 ` [PATCH v3 3/3] drm/amdgpu/pm: Don't show pp_power_profile_mode for unsupported devices Mario Limonciello
2021-11-02  8:17   ` Lazar, Lijo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox