AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] drm/amd/pm: minor cleanups
  2020-08-24  8:03 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections Evan Quan
@ 2020-08-24  8:03 ` Evan Quan
  0 siblings, 0 replies; 11+ messages in thread
From: Evan Quan @ 2020-08-24  8:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Evan Quan

Drop unneeded "ret".

Change-Id: If5eabb1e96153133a833d0e5b1dca9c0f0928891
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 22 +++++--------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index a83b3635df40..e4d333d1b9ca 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1172,12 +1172,10 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
 int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
 				     uint32_t pstate)
 {
-	int ret = 0;
-	ret = smu_cmn_send_smc_msg_with_param(smu,
-					  SMU_MSG_SetXgmiMode,
-					  pstate ? XGMI_MODE_PSTATE_D0 : XGMI_MODE_PSTATE_D3,
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_SetXgmiMode,
+					       pstate ? XGMI_MODE_PSTATE_D0 : XGMI_MODE_PSTATE_D3,
 					  NULL);
-	return ret;
 }
 
 static int smu_v11_0_set_irq_state(struct amdgpu_device *adev,
@@ -1408,11 +1406,7 @@ int smu_v11_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
 
 int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)
 {
-	int ret = 0;
-
-	ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BacoAudioD3PME, NULL);
-
-	return ret;
+	return smu_cmn_send_smc_msg(smu, SMU_MSG_BacoAudioD3PME, NULL);
 }
 
 static int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu, enum smu_v11_0_baco_seq baco_seq)
@@ -1511,13 +1505,7 @@ int smu_v11_0_baco_enter(struct smu_context *smu)
 
 int smu_v11_0_baco_exit(struct smu_context *smu)
 {
-	int ret = 0;
-
-	ret = smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
 }
 
 int smu_v11_0_mode1_reset(struct smu_context *smu)
-- 
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
@ 2020-08-25  7:49 Evan Quan
  2020-08-25  7:49 ` [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex " Evan Quan
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Evan Quan @ 2020-08-25  7:49 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Evan Quan

As these operations are performed in hardware setup and there
is actually no race conditions during this period considering:
1. the hardware setup is serial and cannnot be in parallel
2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 09dc5303762b..b7cad8ef6153 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -361,20 +361,16 @@ static int smu_get_driver_allowed_feature_mask(struct smu_context *smu)
 	int ret = 0;
 	uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
 
-	mutex_lock(&feature->mutex);
 	bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
-	mutex_unlock(&feature->mutex);
 
 	ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
 					     SMU_FEATURE_MAX/32);
 	if (ret)
 		return ret;
 
-	mutex_lock(&feature->mutex);
 	bitmap_or(feature->allowed, feature->allowed,
 		      (unsigned long *)allowed_feature_mask,
 		      feature->feature_num);
-	mutex_unlock(&feature->mutex);
 
 	return ret;
 }
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 548db1edd352..28a19ffd22a1 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 	int ret = 0;
 	uint32_t feature_mask[2];
 
-	mutex_lock(&feature->mutex);
 	if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64)
 		goto failed;
 
@@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 		goto failed;
 
 failed:
-	mutex_unlock(&feature->mutex);
 	return ret;
 }
 
-- 
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex lock protections(V2)
  2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
@ 2020-08-25  7:49 ` Evan Quan
  2020-08-27  5:12   ` Quan, Evan
  2020-08-25  7:49 ` [PATCH 3/4] drm/amd/pm: drop unnecessary table existence and dpm enablement check Evan Quan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Evan Quan @ 2020-08-25  7:49 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Evan Quan

As these operations are performed in hardware setup and there
is actually no race conditions during this period considering:
1. the hardware setup is serial and cannnot be in parallel
2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Change-Id: I7078ac26ae71eb6c7cbf918a127adfc2f56acf7d
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c       | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c          | 7 +------
 4 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index 8347b1f2509f..4195b5b9e8e5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -386,11 +386,9 @@ static int arcturus_check_powerplay_table(struct smu_context *smu)
 		table_context->power_play_table;
 	struct smu_baco_context *smu_baco = &smu->smu_baco;
 
-	mutex_lock(&smu_baco->mutex);
 	if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_BACO ||
 	    powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_MACO)
 		smu_baco->platform_support = true;
-	mutex_unlock(&smu_baco->mutex);
 
 	table_context->thermal_controller_type =
 		powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 72f3d68691d8..f4b26399b413 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -347,11 +347,9 @@ static int navi10_check_powerplay_table(struct smu_context *smu)
 	if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_HARDWAREDC)
 		smu->dc_controlled_by_gpio = true;
 
-	mutex_lock(&smu_baco->mutex);
 	if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_BACO ||
 	    powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_MACO)
 		smu_baco->platform_support = true;
-	mutex_unlock(&smu_baco->mutex);
 
 	table_context->thermal_controller_type =
 		powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index 66d655958a78..c19f526c5a22 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -296,11 +296,9 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu)
 		table_context->power_play_table;
 	struct smu_baco_context *smu_baco = &smu->smu_baco;
 
-	mutex_lock(&smu_baco->mutex);
 	if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_BACO ||
 	    powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_MACO)
 		smu_baco->platform_support = true;
-	mutex_unlock(&smu_baco->mutex);
 
 	table_context->thermal_controller_type =
 		powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 28a19ffd22a1..005673bedc2f 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1434,13 +1434,8 @@ static int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu, enum smu_v
 bool smu_v11_0_baco_is_support(struct smu_context *smu)
 {
 	struct smu_baco_context *smu_baco = &smu->smu_baco;
-	bool baco_support;
 
-	mutex_lock(&smu_baco->mutex);
-	baco_support = smu_baco->platform_support;
-	mutex_unlock(&smu_baco->mutex);
-
-	if (!baco_support)
+	if (!smu_baco->platform_support)
 		return false;
 
 	/* Arcturus does not support this bit mask */
-- 
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH 3/4] drm/amd/pm: drop unnecessary table existence and dpm enablement check
  2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
  2020-08-25  7:49 ` [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex " Evan Quan
@ 2020-08-25  7:49 ` Evan Quan
  2020-08-25  7:49 ` [PATCH 4/4] drm/amd/pm: minor cleanups Evan Quan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Evan Quan @ 2020-08-25  7:49 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Evan Quan

Either this was already performed in parent API. Or the table is
confirmed to exist.

Change-Id: Ie6778a5035749221e0f9d5ad977a0e56392771dd
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h       |  1 -
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 16 ----------------
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++---------------
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 +
 4 files changed, 5 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
index 4c5c041af4ee..1888776deccb 100644
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
@@ -701,7 +701,6 @@ int smu_set_fan_speed_percent(struct smu_context *smu, uint32_t speed);
 int smu_get_fan_speed_rpm(struct smu_context *smu, uint32_t *speed);
 
 int smu_set_deep_sleep_dcefclk(struct smu_context *smu, int clk);
-int smu_set_active_display_count(struct smu_context *smu, uint32_t count);
 
 int smu_get_clock_by_type(struct smu_context *smu,
 			  enum amd_pp_clock_type type,
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index b7cad8ef6153..8a42d976a930 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -572,9 +572,6 @@ static int smu_fini_fb_allocations(struct smu_context *smu)
 	struct smu_table *tables = smu_table->tables;
 	struct smu_table *driver_table = &(smu_table->driver_table);
 
-	if (!tables)
-		return 0;
-
 	if (tables[SMU_TABLE_PMSTATUSLOG].mc_address)
 		amdgpu_bo_free_kernel(&tables[SMU_TABLE_PMSTATUSLOG].bo,
 				      &tables[SMU_TABLE_PMSTATUSLOG].mc_address,
@@ -2252,19 +2249,6 @@ int smu_set_deep_sleep_dcefclk(struct smu_context *smu, int clk)
 	return ret;
 }
 
-int smu_set_active_display_count(struct smu_context *smu, uint32_t count)
-{
-	int ret = 0;
-
-	if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled)
-		return -EOPNOTSUPP;
-
-	if (smu->ppt_funcs->set_active_display_count)
-		ret = smu->ppt_funcs->set_active_display_count(smu, count);
-
-	return ret;
-}
-
 int smu_get_clock_by_type(struct smu_context *smu,
 			  enum amd_pp_clock_type type,
 			  struct amd_pp_clocks *clocks)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 005673bedc2f..a83b3635df40 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -453,9 +453,6 @@ int smu_v11_0_init_power(struct smu_context *smu)
 {
 	struct smu_power_context *smu_power = &smu->smu_power;
 
-	if (smu_power->power_context || smu_power->power_context_size != 0)
-		return -EINVAL;
-
 	smu_power->power_context = kzalloc(sizeof(struct smu_11_0_dpm_context),
 					   GFP_KERNEL);
 	if (!smu_power->power_context)
@@ -469,9 +466,6 @@ int smu_v11_0_fini_power(struct smu_context *smu)
 {
 	struct smu_power_context *smu_power = &smu->smu_power;
 
-	if (!smu_power->power_context || smu_power->power_context_size == 0)
-		return -EINVAL;
-
 	kfree(smu_power->power_context);
 	smu_power->power_context = NULL;
 	smu_power->power_context_size = 0;
@@ -700,18 +694,16 @@ int smu_v11_0_set_tool_table_location(struct smu_context *smu)
 
 int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count)
 {
-	int ret = 0;
 	struct amdgpu_device *adev = smu->adev;
 
 	/* Navy_Flounder do not support to change display num currently */
 	if (adev->asic_type == CHIP_NAVY_FLOUNDER)
 		return 0;
 
-	if (!smu->pm_enabled)
-		return ret;
-
-	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, count, NULL);
-	return ret;
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_NumOfDisplays,
+					       count,
+					       NULL);
 }
 
 
@@ -773,9 +765,6 @@ int smu_v11_0_notify_display_change(struct smu_context *smu)
 {
 	int ret = 0;
 
-	if (!smu->pm_enabled)
-		return ret;
-
 	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_UCLK_BIT) &&
 	    smu->adev->gmc.vram_type == AMDGPU_VRAM_TYPE_HBM)
 		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetUclkFastSwitch, 1, NULL);
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h
index c88f8fab1bae..5c8bb7314675 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_internal.h
@@ -42,6 +42,7 @@
 #define smu_check_fw_version(smu)					smu_ppt_funcs(check_fw_version, 0, smu)
 #define smu_write_pptable(smu)						smu_ppt_funcs(write_pptable, 0, smu)
 #define smu_set_min_dcef_deep_sleep(smu, clk)				smu_ppt_funcs(set_min_dcef_deep_sleep, 0, smu, clk)
+#define smu_set_active_display_count(smu, count)			smu_ppt_funcs(set_active_display_count, 0, smu, count)
 #define smu_set_driver_table_location(smu)				smu_ppt_funcs(set_driver_table_location, 0, smu)
 #define smu_set_tool_table_location(smu)				smu_ppt_funcs(set_tool_table_location, 0, smu)
 #define smu_notify_memory_pool_location(smu)				smu_ppt_funcs(notify_memory_pool_location, 0, smu)
-- 
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* [PATCH 4/4] drm/amd/pm: minor cleanups
  2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
  2020-08-25  7:49 ` [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex " Evan Quan
  2020-08-25  7:49 ` [PATCH 3/4] drm/amd/pm: drop unnecessary table existence and dpm enablement check Evan Quan
@ 2020-08-25  7:49 ` Evan Quan
  2020-08-27  5:12 ` [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Quan, Evan
  2020-08-27  6:39 ` Nirmoy
  4 siblings, 0 replies; 11+ messages in thread
From: Evan Quan @ 2020-08-25  7:49 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Evan Quan

Drop unneeded "ret".

Change-Id: If5eabb1e96153133a833d0e5b1dca9c0f0928891
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 22 +++++--------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index a83b3635df40..e4d333d1b9ca 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1172,12 +1172,10 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
 int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
 				     uint32_t pstate)
 {
-	int ret = 0;
-	ret = smu_cmn_send_smc_msg_with_param(smu,
-					  SMU_MSG_SetXgmiMode,
-					  pstate ? XGMI_MODE_PSTATE_D0 : XGMI_MODE_PSTATE_D3,
+	return smu_cmn_send_smc_msg_with_param(smu,
+					       SMU_MSG_SetXgmiMode,
+					       pstate ? XGMI_MODE_PSTATE_D0 : XGMI_MODE_PSTATE_D3,
 					  NULL);
-	return ret;
 }
 
 static int smu_v11_0_set_irq_state(struct amdgpu_device *adev,
@@ -1408,11 +1406,7 @@ int smu_v11_0_get_max_sustainable_clocks_by_dc(struct smu_context *smu,
 
 int smu_v11_0_set_azalia_d3_pme(struct smu_context *smu)
 {
-	int ret = 0;
-
-	ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BacoAudioD3PME, NULL);
-
-	return ret;
+	return smu_cmn_send_smc_msg(smu, SMU_MSG_BacoAudioD3PME, NULL);
 }
 
 static int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu, enum smu_v11_0_baco_seq baco_seq)
@@ -1511,13 +1505,7 @@ int smu_v11_0_baco_enter(struct smu_context *smu)
 
 int smu_v11_0_baco_exit(struct smu_context *smu)
 {
-	int ret = 0;
-
-	ret = smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
-	if (ret)
-		return ret;
-
-	return ret;
+	return smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
 }
 
 int smu_v11_0_mode1_reset(struct smu_context *smu)
-- 
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
                   ` (2 preceding siblings ...)
  2020-08-25  7:49 ` [PATCH 4/4] drm/amd/pm: minor cleanups Evan Quan
@ 2020-08-27  5:12 ` Quan, Evan
  2020-08-27  6:39 ` Nirmoy
  4 siblings, 0 replies; 11+ messages in thread
From: Quan, Evan @ 2020-08-27  5:12 UTC (permalink / raw)
  To: amd-gfx@lists.freedesktop.org; +Cc: Deucher, Alexander

[AMD Official Use Only - Internal Distribution Only]

Ping..

-----Original Message-----
From: Quan, Evan <Evan.Quan@amd.com>
Sent: Tuesday, August 25, 2020 3:49 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com>
Subject: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)

As these operations are performed in hardware setup and there is actually no race conditions during this period considering:
1. the hardware setup is serial and cannnot be in parallel 2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
 2 files changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 09dc5303762b..b7cad8ef6153 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -361,20 +361,16 @@ static int smu_get_driver_allowed_feature_mask(struct smu_context *smu)
 int ret = 0;
 uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];

-mutex_lock(&feature->mutex);
 bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
-mutex_unlock(&feature->mutex);

 ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
      SMU_FEATURE_MAX/32);
 if (ret)
 return ret;

-mutex_lock(&feature->mutex);
 bitmap_or(feature->allowed, feature->allowed,
       (unsigned long *)allowed_feature_mask,
       feature->feature_num);
-mutex_unlock(&feature->mutex);

 return ret;
 }
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 548db1edd352..28a19ffd22a1 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 int ret = 0;
 uint32_t feature_mask[2];

-mutex_lock(&feature->mutex);
 if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64)
 goto failed;

@@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 goto failed;

 failed:
-mutex_unlock(&feature->mutex);
 return ret;
 }

--
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex lock protections(V2)
  2020-08-25  7:49 ` [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex " Evan Quan
@ 2020-08-27  5:12   ` Quan, Evan
  0 siblings, 0 replies; 11+ messages in thread
From: Quan, Evan @ 2020-08-27  5:12 UTC (permalink / raw)
  To: amd-gfx@lists.freedesktop.org; +Cc: Deucher, Alexander

[AMD Official Use Only - Internal Distribution Only]

Ping..

-----Original Message-----
From: Quan, Evan <Evan.Quan@amd.com>
Sent: Tuesday, August 25, 2020 3:49 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com>
Subject: [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex lock protections(V2)

As these operations are performed in hardware setup and there is actually no race conditions during this period considering:
1. the hardware setup is serial and cannnot be in parallel 2. all other operations can be performed only after hardware
   setup complete.

V2: rich the commit log description

Change-Id: I7078ac26ae71eb6c7cbf918a127adfc2f56acf7d
Signed-off-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c       | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c         | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 2 --
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c          | 7 +------
 4 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index 8347b1f2509f..4195b5b9e8e5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -386,11 +386,9 @@ static int arcturus_check_powerplay_table(struct smu_context *smu)
 table_context->power_play_table;
 struct smu_baco_context *smu_baco = &smu->smu_baco;

-mutex_lock(&smu_baco->mutex);
 if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_BACO ||
     powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_MACO)
 smu_baco->platform_support = true;
-mutex_unlock(&smu_baco->mutex);

 table_context->thermal_controller_type =
 powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
index 72f3d68691d8..f4b26399b413 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
@@ -347,11 +347,9 @@ static int navi10_check_powerplay_table(struct smu_context *smu)
 if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_HARDWAREDC)
 smu->dc_controlled_by_gpio = true;

-mutex_lock(&smu_baco->mutex);
 if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_BACO ||
     powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_MACO)
 smu_baco->platform_support = true;
-mutex_unlock(&smu_baco->mutex);

 table_context->thermal_controller_type =
 powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index 66d655958a78..c19f526c5a22 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -296,11 +296,9 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu)
 table_context->power_play_table;
 struct smu_baco_context *smu_baco = &smu->smu_baco;

-mutex_lock(&smu_baco->mutex);
 if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_BACO ||
     powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_MACO)
 smu_baco->platform_support = true;
-mutex_unlock(&smu_baco->mutex);

 table_context->thermal_controller_type =
 powerplay_table->thermal_controller_type;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 28a19ffd22a1..005673bedc2f 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1434,13 +1434,8 @@ static int smu_v11_0_baco_set_armd3_sequence(struct smu_context *smu, enum smu_v  bool smu_v11_0_baco_is_support(struct smu_context *smu)  {
 struct smu_baco_context *smu_baco = &smu->smu_baco;
-bool baco_support;

-mutex_lock(&smu_baco->mutex);
-baco_support = smu_baco->platform_support;
-mutex_unlock(&smu_baco->mutex);
-
-if (!baco_support)
+if (!smu_baco->platform_support)
 return false;

 /* Arcturus does not support this bit mask */
--
2.28.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
                   ` (3 preceding siblings ...)
  2020-08-27  5:12 ` [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Quan, Evan
@ 2020-08-27  6:39 ` Nirmoy
  2020-08-28  8:16   ` Christian König
  4 siblings, 1 reply; 11+ messages in thread
From: Nirmoy @ 2020-08-27  6:39 UTC (permalink / raw)
  To: amd-gfx

Series is Acked-by: Nirmoy Das <nirmoy.das@amd.com>


On 8/25/20 9:49 AM, Evan Quan wrote:
> As these operations are performed in hardware setup and there
> is actually no race conditions during this period considering:
> 1. the hardware setup is serial and cannnot be in parallel
> 2. all other operations can be performed only after hardware
>     setup complete.
>
> V2: rich the commit log description
>
> Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
> Signed-off-by: Evan Quan <evan.quan@amd.com>
> ---
>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
>   drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
>   2 files changed, 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 09dc5303762b..b7cad8ef6153 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -361,20 +361,16 @@ static int smu_get_driver_allowed_feature_mask(struct smu_context *smu)
>   	int ret = 0;
>   	uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
>   
> -	mutex_lock(&feature->mutex);
>   	bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
> -	mutex_unlock(&feature->mutex);
>   
>   	ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
>   					     SMU_FEATURE_MAX/32);
>   	if (ret)
>   		return ret;
>   
> -	mutex_lock(&feature->mutex);
>   	bitmap_or(feature->allowed, feature->allowed,
>   		      (unsigned long *)allowed_feature_mask,
>   		      feature->feature_num);
> -	mutex_unlock(&feature->mutex);
>   
>   	return ret;
>   }
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> index 548db1edd352..28a19ffd22a1 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> @@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
>   	int ret = 0;
>   	uint32_t feature_mask[2];
>   
> -	mutex_lock(&feature->mutex);
>   	if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || feature->feature_num < 64)
>   		goto failed;
>   
> @@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
>   		goto failed;
>   
>   failed:
> -	mutex_unlock(&feature->mutex);
>   	return ret;
>   }
>   
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  2020-08-27  6:39 ` Nirmoy
@ 2020-08-28  8:16   ` Christian König
  2020-08-28 14:16     ` Deucher, Alexander
  0 siblings, 1 reply; 11+ messages in thread
From: Christian König @ 2020-08-28  8:16 UTC (permalink / raw)
  To: Nirmoy, amd-gfx

The explanation sounds sane, but since I don't know the affected code at 
all the series is only Acked-by: Christian König <christian.koenig@amd.com>

Maybe wait for Alex to give you an rb if you are unsure, otherwise feel 
free to commit.

Christian.

Am 27.08.20 um 08:39 schrieb Nirmoy:
> Series is Acked-by: Nirmoy Das <nirmoy.das@amd.com>
>
>
> On 8/25/20 9:49 AM, Evan Quan wrote:
>> As these operations are performed in hardware setup and there
>> is actually no race conditions during this period considering:
>> 1. the hardware setup is serial and cannnot be in parallel
>> 2. all other operations can be performed only after hardware
>>     setup complete.
>>
>> V2: rich the commit log description
>>
>> Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
>> Signed-off-by: Evan Quan <evan.quan@amd.com>
>> ---
>>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
>>   drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
>>   2 files changed, 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c 
>> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> index 09dc5303762b..b7cad8ef6153 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> @@ -361,20 +361,16 @@ static int 
>> smu_get_driver_allowed_feature_mask(struct smu_context *smu)
>>       int ret = 0;
>>       uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
>> -    mutex_unlock(&feature->mutex);
>>         ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
>>                            SMU_FEATURE_MAX/32);
>>       if (ret)
>>           return ret;
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_or(feature->allowed, feature->allowed,
>>                 (unsigned long *)allowed_feature_mask,
>>                 feature->feature_num);
>> -    mutex_unlock(&feature->mutex);
>>         return ret;
>>   }
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c 
>> b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> index 548db1edd352..28a19ffd22a1 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> @@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context 
>> *smu)
>>       int ret = 0;
>>       uint32_t feature_mask[2];
>>   -    mutex_lock(&feature->mutex);
>>       if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) || 
>> feature->feature_num < 64)
>>           goto failed;
>>   @@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct 
>> smu_context *smu)
>>           goto failed;
>>     failed:
>> -    mutex_unlock(&feature->mutex);
>>       return ret;
>>   }
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  2020-08-28  8:16   ` Christian König
@ 2020-08-28 14:16     ` Deucher, Alexander
  2020-08-31  7:01       ` Quan, Evan
  0 siblings, 1 reply; 11+ messages in thread
From: Deucher, Alexander @ 2020-08-28 14:16 UTC (permalink / raw)
  To: Das, Nirmoy, amd-gfx@lists.freedesktop.org, Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 4258 bytes --]

[AMD Official Use Only - Internal Distribution Only]

This code gets called during suspend and resume and GPU reset as well.  Are those cases properly covered?

Alex

________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Friday, August 28, 2020 4:16 AM
To: Das, Nirmoy <Nirmoy.Das@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)

The explanation sounds sane, but since I don't know the affected code at
all the series is only Acked-by: Christian König <christian.koenig@amd.com>

Maybe wait for Alex to give you an rb if you are unsure, otherwise feel
free to commit.

Christian.

Am 27.08.20 um 08:39 schrieb Nirmoy:
> Series is Acked-by: Nirmoy Das <nirmoy.das@amd.com>
>
>
> On 8/25/20 9:49 AM, Evan Quan wrote:
>> As these operations are performed in hardware setup and there
>> is actually no race conditions during this period considering:
>> 1. the hardware setup is serial and cannnot be in parallel
>> 2. all other operations can be performed only after hardware
>>     setup complete.
>>
>> V2: rich the commit log description
>>
>> Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
>> Signed-off-by: Evan Quan <evan.quan@amd.com>
>> ---
>>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
>>   drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
>>   2 files changed, 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> index 09dc5303762b..b7cad8ef6153 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> @@ -361,20 +361,16 @@ static int
>> smu_get_driver_allowed_feature_mask(struct smu_context *smu)
>>       int ret = 0;
>>       uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
>> -    mutex_unlock(&feature->mutex);
>>         ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
>>                            SMU_FEATURE_MAX/32);
>>       if (ret)
>>           return ret;
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_or(feature->allowed, feature->allowed,
>>                 (unsigned long *)allowed_feature_mask,
>>                 feature->feature_num);
>> -    mutex_unlock(&feature->mutex);
>>         return ret;
>>   }
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> index 548db1edd352..28a19ffd22a1 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> @@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context
>> *smu)
>>       int ret = 0;
>>       uint32_t feature_mask[2];
>>   -    mutex_lock(&feature->mutex);
>>       if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) ||
>> feature->feature_num < 64)
>>           goto failed;
>>   @@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct
>> smu_context *smu)
>>           goto failed;
>>     failed:
>> -    mutex_unlock(&feature->mutex);
>>       return ret;
>>   }
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Ccad2767c7837431f94f308d84b2ab750%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637341994162774368&amp;sdata=b8PVt6zfQJXYlVunpFMY12knU8ZlJ7UE0ojZjhAWJdY%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Ccad2767c7837431f94f308d84b2ab750%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637341994162774368&amp;sdata=b8PVt6zfQJXYlVunpFMY12knU8ZlJ7UE0ojZjhAWJdY%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 7865 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* RE: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)
  2020-08-28 14:16     ` Deucher, Alexander
@ 2020-08-31  7:01       ` Quan, Evan
  0 siblings, 0 replies; 11+ messages in thread
From: Quan, Evan @ 2020-08-31  7:01 UTC (permalink / raw)
  To: Deucher, Alexander, Das, Nirmoy, amd-gfx@lists.freedesktop.org,
	Koenig, Christian


[-- Attachment #1.1: Type: text/plain, Size: 5965 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Yes.
These two APIs get called only during hw/smu initialization. And although there needs hw initialization also on resume/gpu reset.
They share no race conditions(there cannot be another gpu reset/resume unless current gpu reset/resume done).

BR
Evan
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deucher, Alexander
Sent: Friday, August 28, 2020 10:16 PM
To: Das, Nirmoy <Nirmoy.Das@amd.com>; amd-gfx@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>
Subject: Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)


[AMD Official Use Only - Internal Distribution Only]


[AMD Official Use Only - Internal Distribution Only]

This code gets called during suspend and resume and GPU reset as well.  Are those cases properly covered?

Alex

________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Christian König <ckoenig.leichtzumerken@gmail.com<mailto:ckoenig.leichtzumerken@gmail.com>>
Sent: Friday, August 28, 2020 4:16 AM
To: Das, Nirmoy <Nirmoy.Das@amd.com<mailto:Nirmoy.Das@amd.com>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> <amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>>
Subject: Re: [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2)

The explanation sounds sane, but since I don't know the affected code at
all the series is only Acked-by: Christian König <christian.koenig@amd.com<mailto:christian.koenig@amd.com>>

Maybe wait for Alex to give you an rb if you are unsure, otherwise feel
free to commit.

Christian.

Am 27.08.20 um 08:39 schrieb Nirmoy:
> Series is Acked-by: Nirmoy Das <nirmoy.das@amd.com<mailto:nirmoy.das@amd.com>>
>
>
> On 8/25/20 9:49 AM, Evan Quan wrote:
>> As these operations are performed in hardware setup and there
>> is actually no race conditions during this period considering:
>> 1. the hardware setup is serial and cannnot be in parallel
>> 2. all other operations can be performed only after hardware
>>     setup complete.
>>
>> V2: rich the commit log description
>>
>> Change-Id: I096d7ab0855ff59b0ecb56fd9d6d9946b3605fc8
>> Signed-off-by: Evan Quan <evan.quan@amd.com<mailto:evan.quan@amd.com>>
>> ---
>>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c      | 4 ----
>>   drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 --
>>   2 files changed, 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> index 09dc5303762b..b7cad8ef6153 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
>> @@ -361,20 +361,16 @@ static int
>> smu_get_driver_allowed_feature_mask(struct smu_context *smu)
>>       int ret = 0;
>>       uint32_t allowed_feature_mask[SMU_FEATURE_MAX/32];
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_zero(feature->allowed, SMU_FEATURE_MAX);
>> -    mutex_unlock(&feature->mutex);
>>         ret = smu_get_allowed_feature_mask(smu, allowed_feature_mask,
>>                            SMU_FEATURE_MAX/32);
>>       if (ret)
>>           return ret;
>>   -    mutex_lock(&feature->mutex);
>>       bitmap_or(feature->allowed, feature->allowed,
>>                 (unsigned long *)allowed_feature_mask,
>>                 feature->feature_num);
>> -    mutex_unlock(&feature->mutex);
>>         return ret;
>>   }
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> index 548db1edd352..28a19ffd22a1 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
>> @@ -721,7 +721,6 @@ int smu_v11_0_set_allowed_mask(struct smu_context
>> *smu)
>>       int ret = 0;
>>       uint32_t feature_mask[2];
>>   -    mutex_lock(&feature->mutex);
>>       if (bitmap_empty(feature->allowed, SMU_FEATURE_MAX) ||
>> feature->feature_num < 64)
>>           goto failed;
>>   @@ -738,7 +737,6 @@ int smu_v11_0_set_allowed_mask(struct
>> smu_context *smu)
>>           goto failed;
>>     failed:
>> -    mutex_unlock(&feature->mutex);
>>       return ret;
>>   }
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Ccad2767c7837431f94f308d84b2ab750%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637341994162774368&amp;sdata=b8PVt6zfQJXYlVunpFMY12knU8ZlJ7UE0ojZjhAWJdY%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C9e52b030677540d81cbe08d84b5ced7a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637342209834431339&sdata=Rlb%2B33bxmwO7W5Ke4sQnS8HRsGlrFkf%2F99YWmSW7OWk%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Ccad2767c7837431f94f308d84b2ab750%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637341994162774368&amp;sdata=b8PVt6zfQJXYlVunpFMY12knU8ZlJ7UE0ojZjhAWJdY%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C9e52b030677540d81cbe08d84b5ced7a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637342209834431339&sdata=Rlb%2B33bxmwO7W5Ke4sQnS8HRsGlrFkf%2F99YWmSW7OWk%3D&reserved=0>

[-- Attachment #1.2: Type: text/html, Size: 11644 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2020-08-31  7:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-25  7:49 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Evan Quan
2020-08-25  7:49 ` [PATCH 2/4] drm/amd/pm: drop unnecessary smu_baco->mutex " Evan Quan
2020-08-27  5:12   ` Quan, Evan
2020-08-25  7:49 ` [PATCH 3/4] drm/amd/pm: drop unnecessary table existence and dpm enablement check Evan Quan
2020-08-25  7:49 ` [PATCH 4/4] drm/amd/pm: minor cleanups Evan Quan
2020-08-27  5:12 ` [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections(V2) Quan, Evan
2020-08-27  6:39 ` Nirmoy
2020-08-28  8:16   ` Christian König
2020-08-28 14:16     ` Deucher, Alexander
2020-08-31  7:01       ` Quan, Evan
  -- strict thread matches above, loose matches on Subject: below --
2020-08-24  8:03 [PATCH 1/4] drm/amd/pm: drop unnecessary feature->mutex lock protections Evan Quan
2020-08-24  8:03 ` [PATCH 4/4] drm/amd/pm: minor cleanups Evan Quan

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