Skip to contentSkip to conversation

drm/amdgpu: add mmhub powergating set by smu

PATCH In review Eric Huang 2 participants 7 messages Feb 6, 2018 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Eric Huang

author
#0 lore raw

PATCH 1/3 drm/amdgpu: add mmhub powergating set by smu

PSP will disable legacy mmhub PG setting that is programming registers, and drive will use SMC message to
set it up.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h        | 4 ++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c        | 3 +++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4 -0
index c489c69..bd745a4 100644
@@ -375,6 +375,10 @@ enum amdgpu_pcie_gen {
 		((adev)->powerplay.pp_funcs->odn_edit_dpm_table(\
 			(adev)->powerplay.pp_handle, type, parameter, size))
 
+#define amdgpu_dpm_set_mmhub_powergating_by_smu(adev) \
+		((adev)->powerplay.pp_funcs->set_mmhub_powergating_by_smu( \
+		(adev)->powerplay.pp_handle))
+
 struct amdgpu_dpm {
 	struct amdgpu_ps        *ps;
 	/* number of valid power states */
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +3 -0
index 82f8bc8..d0ade9f 100644
@@ -471,6 +471,9 @@ void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev,
 						RENG_EXECUTE_ON_REG_UPDATE, 1);
 		WREG32_SOC15(MMHUB, 0, mmPCTL1_RENG_EXECUTE, pctl1_reng_execute);
 
+		if (adev->powerplay.pp_funcs->set_mmhub_powergating_by_smu)
+			amdgpu_dpm_set_mmhub_powergating_by_smu(adev);
+
 	} else {
 		pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,
 						PCTL0_RENG_EXECUTE,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 1fc995b..4f69fe8 100644
@@ -310,6 +310,7 @@ struct amd_pm_funcs {
 	int (*get_power_profile_mode)(void *handle, char *buf);
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
+	int (*set_mmhub_powergating_by_smu)(void *handle);
 };
 
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1517949689-9339-1-git-send-email-JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/3 drm/amd/powerplay: add mmhub powergating by smu in powerplay

---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 22 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h     |  1 +
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +22 -0
index c571f8e..7c4b88a 100644
@@ -1475,6 +1475,27 @@ static int pp_get_display_mode_validation_clocks(void *handle,
 	return ret;
 }
 
+static int pp_set_mmhub_powergating_by_smu(void *handle)
+{
+	struct pp_hwmgr *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	if (hwmgr->hwmgr_func->set_mmhub_powergating_by_smu == NULL) {
+		pr_info("%s was not implemented.\n", __func__);
+		return 0;
+	}
+
+	return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu(hwmgr);
+}
+
 const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1521,4 +1542,5 @@ const struct amd_pm_funcs pp_dpm_funcs = {
 	.set_watermarks_for_clocks_ranges = pp_set_watermarks_for_clocks_ranges,
 	.display_clock_voltage_request = pp_display_clock_voltage_request,
 	.get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks,
+	.set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu,
 };
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 5512dc2..47a1083 100644
@@ -347,6 +347,7 @@ struct pp_hwmgr_func {
 	int (*odn_edit_dpm_table)(struct pp_hwmgr *hwmgr,
 					enum PP_OD_DPM_TABLE_COMMAND type,
 					long *input, uint32_t size);
+	int (*set_mmhub_powergating_by_smu)(struct pp_hwmgr *hwmgr);
 };
 
 struct pp_table_func {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1517949689-9339-2-git-send-email-JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

RE: [PATCH 2/3] drm/amd/powerplay: add mmhub powergating by smu in powerplay

Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Eric Huang
Sent: Tuesday, February 6, 2018 3:41 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>
Subject: [PATCH 2/3] drm/amd/powerplay: add mmhub powergating by smu in powerplay

Please add a basic patch description. With that fixed:

Quoted 65 lines
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 22
++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h     |  1 +
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +20 -0
index c571f8e..7c4b88a 100644
@@ -1475,6 +1475,27 @@ static int
 pp_get_display_mode_validation_clocks(void *handle,
 	return ret;
 }
 
+static int pp_set_mmhub_powergating_by_smu(void *handle) {
+	struct pp_hwmgr *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	if (hwmgr->hwmgr_func->set_mmhub_powergating_by_smu ==
 NULL) {
+		pr_info("%s was not implemented.\n", __func__);
+		return 0;
+	}
+
+	return hwmgr->hwmgr_func-
 >set_mmhub_powergating_by_smu(hwmgr);
+}
+
 const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1521,4 +1542,5 @@ const struct amd_pm_funcs pp_dpm_funcs = {
 	.set_watermarks_for_clocks_ranges =
 pp_set_watermarks_for_clocks_ranges,
 	.display_clock_voltage_request =
 pp_display_clock_voltage_request,
 	.get_display_mode_validation_clocks =

pp_get_display_mode_validation_clocks,

drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -0
+	.set_mmhub_powergating_by_smu =

pp_set_mmhub_powergating_by_smu,
};

drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 5512dc2..47a1083 100644
@@ -347,6 +347,7 @@ struct pp_hwmgr_func {
 	int (*odn_edit_dpm_table)(struct pp_hwmgr *hwmgr,
 					enum
 PP_OD_DPM_TABLE_COMMAND type,
 					long *input, uint32_t size);
+	int (*set_mmhub_powergating_by_smu)(struct pp_hwmgr
 *hwmgr);
 };
Quoted 8 lines

struct pp_table_func {
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw

PATCH 3/3 drm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 6 ++++++
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h   | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +6 -0
index 409a56b..8ddfb78 100644
@@ -1026,6 +1026,11 @@ static int rv_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 	return ret;
 }
 
+static int rv_set_mmhub_powergating_by_smu(struct pp_hwmgr *hwmgr)
+{
+	return smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PowerGateMmHub);
+}
+
 static const struct pp_hwmgr_func rv_hwmgr_funcs = {
 	.backend_init = rv_hwmgr_backend_init,
 	.backend_fini = rv_hwmgr_backend_fini,
@@ -1059,6 +1064,7 @@ static const struct pp_hwmgr_func rv_hwmgr_funcs = {
 	.asic_setup = rv_setup_asic_task,
 	.power_state_set = rv_set_power_state_tasks,
 	.dynamic_state_management_disable = rv_disable_dpm_tasks,
+	.set_mmhub_powergating_by_smu = rv_set_mmhub_powergating_by_smu,
 };
 
 int rv_init_function_pointers(struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h +2 -1
index f15f4df..426bff2 100644
@@ -80,7 +80,8 @@
 #define PPSMC_MSG_SetSoftMaxSocclkByFreq        0x32
 #define PPSMC_MSG_SetSoftMaxFclkByFreq          0x33
 #define PPSMC_MSG_SetSoftMaxVcn                 0x34
-#define PPSMC_Message_Count                     0x35
+#define PPSMC_MSG_PowerGateMmHub                0x35
+#define PPSMC_Message_Count                     0x36
 
 
 typedef uint16_t PPSMC_Result;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1517949689-9339-3-git-send-email-JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Alex Deucher
#7 lore raw

RE: [PATCH 3/3] drm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven

Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Eric Huang
Sent: Tuesday, February 6, 2018 3:41 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>
Subject: [PATCH 3/3] drm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven

Please add a basic patch description. With that fixed:

Quoted 51 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 6 ++++++
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h   | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +3 -0
index 409a56b..8ddfb78 100644
@@ -1026,6 +1026,11 @@ static int rv_read_sensor(struct pp_hwmgr
 *hwmgr, int idx,
 	return ret;
 }
 
+static int rv_set_mmhub_powergating_by_smu(struct pp_hwmgr *hwmgr)
 {
+	return smum_send_msg_to_smc(hwmgr,
 PPSMC_MSG_PowerGateMmHub); }
+
 static const struct pp_hwmgr_func rv_hwmgr_funcs = {
 	.backend_init = rv_hwmgr_backend_init,
 	.backend_fini = rv_hwmgr_backend_fini, @@ -1059,6 +1064,7 @@

static const struct pp_hwmgr_func rv_hwmgr_funcs = {

drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c +1 -0
 	.asic_setup = rv_setup_asic_task,
 	.power_state_set = rv_set_power_state_tasks,
 	.dynamic_state_management_disable = rv_disable_dpm_tasks,
+	.set_mmhub_powergating_by_smu =

rv_set_mmhub_powergating_by_smu,
};

int rv_init_function_pointers(struct pp_hwmgr *hwmgr) diff --git
a/drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h b/drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h
index f15f4df..426bff2 100644

drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h +2 -2
@@ -80,7 +80,8 @@
 #define PPSMC_MSG_SetSoftMaxSocclkByFreq        0x32
 #define PPSMC_MSG_SetSoftMaxFclkByFreq          0x33
 #define PPSMC_MSG_SetSoftMaxVcn                 0x34
-#define PPSMC_Message_Count                     0x35
+#define PPSMC_MSG_PowerGateMmHub                0x35
+#define PPSMC_Message_Count                     0x36
 
 
 typedef uint16_t PPSMC_Result;
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Alex Deucher
#8 lore raw
In reply to a message not in the archive
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Eric Huang
Sent: Tuesday, February 6, 2018 3:41 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: add mmhub powergating set by smu

PSP will disable legacy mmhub PG setting that is programming registers, and drive will use SMC message to set it up.

Split this into two patches, one to add the new dpm interface, and one to add the change to mmhub_v1_0.c. I guess presumably there's no way to disable it once it's been enabled?

With the above addressed:

Quoted 60 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h        | 4 ++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c        | 3 +++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4 -0
index c489c69..bd745a4 100644
@@ -375,6 +375,10 @@ enum amdgpu_pcie_gen {
 		((adev)->powerplay.pp_funcs->odn_edit_dpm_table(\
 			(adev)->powerplay.pp_handle, type, parameter,
 size))
 
+#define amdgpu_dpm_set_mmhub_powergating_by_smu(adev) \
+		((adev)->powerplay.pp_funcs-
 >set_mmhub_powergating_by_smu( \
+		(adev)->powerplay.pp_handle))
+
 struct amdgpu_dpm {
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +0 -0
 	struct amdgpu_ps        *ps;
 	/* number of valid power states */
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -0
index 82f8bc8..d0ade9f 100644
@@ -471,6 +471,9 @@ void mmhub_v1_0_update_power_gating(struct
 amdgpu_device *adev,
 
 	RENG_EXECUTE_ON_REG_UPDATE, 1);
 		WREG32_SOC15(MMHUB, 0, mmPCTL1_RENG_EXECUTE,
 pctl1_reng_execute);
 
+		if (adev->powerplay.pp_funcs-
Quoted 1 line

set_mmhub_powergating_by_smu)

+

	amdgpu_dpm_set_mmhub_powergating_by_smu(adev);
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -0
+
 	} else {
 		pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,
 						PCTL0_RENG_EXECUTE,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 1fc995b..4f69fe8 100644
@@ -310,6 +310,7 @@ struct amd_pm_funcs {
 	int (*get_power_profile_mode)(void *handle, char *buf);
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t
 size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input,
 uint32_t size);
+	int (*set_mmhub_powergating_by_smu)(void *handle);
 };
Quoted 8 lines

#endif
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB165221B257BD806DEF70C236F7FD0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#10 lore raw

Yes. SMU only provides enabling message.

Thanks,
Eric

Quoted 74 lines · Alexander
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Eric Huang
Sent: Tuesday, February 6, 2018 3:41 PM
To: [email protected]
Cc: Huang, JinHuiEric <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: add mmhub powergating set by smu

PSP will disable legacy mmhub PG setting that is programming registers, and drive will use SMC message to set it up.

Split this into two patches, one to add the new dpm interface, and one to add the change to mmhub_v1_0.c. I guess presumably there's no way to disable it once it's been enabled?

With the above addressed:

Quoted 59 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h        | 4 ++++
  drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c        | 3 +++
  drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 +
  3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4 -0
index c489c69..bd745a4 100644
@@ -375,6 +375,10 @@ enum amdgpu_pcie_gen {
  		((adev)->powerplay.pp_funcs->odn_edit_dpm_table(\
  			(adev)->powerplay.pp_handle, type, parameter,
 size))
 
+#define amdgpu_dpm_set_mmhub_powergating_by_smu(adev) \
+		((adev)->powerplay.pp_funcs-
 > set_mmhub_powergating_by_smu( \
+		(adev)->powerplay.pp_handle))
+
  struct amdgpu_dpm {

struct amdgpu_ps *ps;
/* number of valid power states */

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -0
index 82f8bc8..d0ade9f 100644
@@ -471,6 +471,9 @@ void mmhub_v1_0_update_power_gating(struct
 amdgpu_device *adev,
 
 	RENG_EXECUTE_ON_REG_UPDATE, 1);
  		WREG32_SOC15(MMHUB, 0, mmPCTL1_RENG_EXECUTE,
 pctl1_reng_execute);
 
+		if (adev->powerplay.pp_funcs-
Quoted 1 line

set_mmhub_powergating_by_smu)

+

	amdgpu_dpm_set_mmhub_powergating_by_smu(adev);
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 -0
+
  	} else {
  		pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,
  						PCTL0_RENG_EXECUTE,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
index 1fc995b..4f69fe8 100644
@@ -310,6 +310,7 @@ struct amd_pm_funcs {
  	int (*get_power_profile_mode)(void *handle, char *buf);
  	int (*set_power_profile_mode)(void *handle, long *input, uint32_t
 size);
  	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input,
 uint32_t size);
+	int (*set_mmhub_powergating_by_smu)(void *handle);
  };
Quoted 8 lines
Quoted 8 lines

#endif
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx