Skip to contentSkip to conversation

send message to pmfw when SMT changes

PATCH RESEND Superseded Wenyou Yang 4 participants 14 messages Mar 22, 2023 – Mar 24, 2023

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover send message to pmfw when SMT changes

When the CPU SMT changes on the fly, send the message to pmfw to notify the SMT status changed.

Wenyou Yang (3):
cpu/smt: add a notifier to notify the SMT changes drm/amd/pm: send the SMT-enable message to pmfw drm/amd/pm: vangogh: support to send SMT enable message

 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41 +++++++++++++++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 +-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 +++++++++
 include/linux/cpu.h                           |  5 +++
 kernel/cpu.c                                  | 11 ++++-
 7 files changed, 84 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH RESEND 1/3 cpu/smt: add a notifier to notify the SMT changes

Add the notifier chain to notify the cpu SMT status changes

---
 include/linux/cpu.h |  5 +++++
 kernel/cpu.c        | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
include/linux/cpu.h +5 -0
index 314802f98b9d..9a842317fe2d 100644
@@ -213,6 +213,11 @@ enum cpuhp_smt_control {
 	CPU_SMT_NOT_IMPLEMENTED,
 };
 
+enum cpuhp_smt_status {
+	SMT_ENABLED,
+	SMT_DISABLED,
+};
+
 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
 extern enum cpuhp_smt_control cpu_smt_control;
 extern void cpu_smt_disable(bool force);
kernel/cpu.c +10 -1
index 6c0a92ca6bb5..accae0fa9868 100644
@@ -89,6 +89,9 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = {
 cpumask_t cpus_booted_once_mask;
 #endif
 
+RAW_NOTIFIER_HEAD(smt_notifier_head);
+EXPORT_SYMBOL(smt_notifier_head);
+
 #if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP)
 static struct lockdep_map cpuhp_state_up_map =
 	STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map);
@@ -2281,8 +2284,10 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
 		 */
 		cpuhp_offline_cpu_device(cpu);
 	}
-	if (!ret)
+	if (!ret) {
 		cpu_smt_control = ctrlval;
+		raw_notifier_call_chain(&smt_notifier_head, SMT_DISABLED, NULL);
+	}
 	cpu_maps_update_done();
 	return ret;
 }
@@ -2303,7 +2308,11 @@ int cpuhp_smt_enable(void)
 		/* See comment in cpuhp_smt_disable() */
 		cpuhp_online_cpu_device(cpu);
 	}
+	if (!ret)
+		raw_notifier_call_chain(&smt_notifier_head, SMT_ENABLED, NULL);
+
 	cpu_maps_update_done();
+
 	return ret;
 }
 #endif
Signature · 1 line
2.39.2
#2 lore raw

PATCH RESEND 2/3 drm/amd/pm: send the SMT-enable message to pmfw

In reply to Wenyou Yang

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41 +++++++++++++++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
 2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +41 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
 #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
 #include <linux/firmware.h>
 #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle, uint32_t speed);
 static int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
 static int smu_set_mp1_state(void *handle, enum pp_mp1_state mp1_state);
 
+static int smt_notifier_callback(struct notifier_block *nb, unsigned long action, void *data);
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback,
+};
+
 static int smu_sys_get_pp_feature_mask(void *handle,
 				       char *buf)
 {
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device *adev)
 	return 0;
 }
 
+static struct smu_context *current_smu;
+
 static int smu_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -645,6 +656,7 @@ static int smu_early_init(void *handle)
 	mutex_init(&smu->message_lock);
 
 	adev->powerplay.pp_handle = smu;
+	current_smu = smu;
 	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
 	r = smu_set_funcs(adev);
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
 	if (!smu->ppt_funcs->get_fan_control_mode)
 		smu->adev->pm.no_fan = true;
 
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
 	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct smu_context *smu, uint32_t size)
 
 	return ret;
 }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool enable)
+{
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data)
+{
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
index 09469c750a96..7c6594bba796 100644
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
 	 * @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
 	 */
 	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
 };
 
 typedef enum {
Signature · 1 line
2.39.2
#3 lore raw

RE: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

[AMD Official Use Only - General]

Quoted 39 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenyou Yang
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>; amd- [email protected]; Yang, WenYou <[email protected]>; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41
+++++++++++++++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
 2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
 #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
 #include <linux/firmware.h>
 #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle,
 uint32_t speed);
 static int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
 static int smu_set_mp1_state(void *handle, enum pp_mp1_state

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_fan_speed_rpm(void *handle, · line 82

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +7 -0
 mp1_state);
 
+static int smt_notifier_callback(struct notifier_block *nb, unsigned long
 action, void *data);
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback,
+};

By embedding smt_notifier into "struct smu_context" structure, you do not need this smt_notifer and current_smu below. You can refer to omap_dma_busy_notifier().

BR
Evan

Quoted 90 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
+

static int smu_sys_get_pp_feature_mask(void *handle,

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
 				       char *buf)
 {
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device
 *adev)
 	return 0;
 }
 
+static struct smu_context *current_smu;
+
 static int smu_early_init(void *handle)
 {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +30 -0
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -645,6 +656,7 @@ static int smu_early_init(void *handle)
 	mutex_init(&smu->message_lock);
 
 	adev->powerplay.pp_handle = smu;
+	current_smu = smu;
 	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
 	r = smu_set_funcs(adev);
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
 	if (!smu->ppt_funcs->get_fan_control_mode)
 		smu->adev->pm.no_fan = true;
 
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
 	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct
 smu_context *smu, uint32_t size)
 
 	return ret;
 }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool enable)
+{
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data)
+{
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 09469c750a96..7c6594bba796 100644
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
 	 * @init_pptable_microcode: Prepare the pptable microcode to

upload via PSP

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -1
 	 */
 	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
 };
 
 typedef enum {
--

2.39.2

#4 lore raw

RE: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

[AMD Official Use Only - General]

Quoted 59 lines

-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Thursday, March 23, 2023 3:17 PM
To: Yang, WenYou <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>; amd- [email protected]; Yang, WenYou <[email protected]>; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: RE: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

[AMD Official Use Only - General]

Quoted 5 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenyou Yang
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig,

Christian

Quoted 2 lines

<[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>;

amd-

Quoted 3 lines

[email protected]; Yang, WenYou <[email protected]>; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable

message

Quoted 30 lines

to pmfw

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41
+++++++++++++++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
 2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
 #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
 #include <linux/firmware.h>
 #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle,
 uint32_t speed);  static int smu_set_gfx_cgpg(struct smu_context *smu,

bool enabled); static int smu_set_mp1_state(void *handle, enum pp_mp1_state mp1_state);

Quoted 11 lines

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_fan_speed_rpm(void *handle, uint32_t speed);

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
+static int smt_notifier_callback(struct notifier_block *nb, unsigned
+long

action, void *data);

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5 -0
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback, };

By embedding smt_notifier into "struct smu_context" structure, you do not need this smt_notifer and current_smu below.
You can refer to omap_dma_busy_notifier().

Accept. Thanks.

Quoted 93 lines

BR
Evan

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device · line 641

Quoted 13 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3 -0
+
 static int smu_sys_get_pp_feature_mask(void *handle,
 				       char *buf)
 {
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device
 *adev)
 	return 0;
 }
 
+static struct smu_context *current_smu;
+
 static int smu_early_init(void *handle)  {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;

@@

Quoted 61 lines

-645,6 +656,7 @@ static int smu_early_init(void *handle)

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +29 -0
 	mutex_init(&smu->message_lock);
 
 	adev->powerplay.pp_handle = smu;
+	current_smu = smu;
 	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
 	r = smu_set_funcs(adev);
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
 	if (!smu->ppt_funcs->get_fan_control_mode)
 		smu->adev->pm.no_fan = true;
 
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
 	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
 	return 0;
 }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct
 smu_context *smu, uint32_t size)
 
 	return ret;
 }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data) {
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 09469c750a96..7c6594bba796 100644

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h struct pptable_funcs { · line 1354

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
 	 * @init_pptable_microcode: Prepare the pptable microcode to

upload

Quoted 13 lines

via PSP

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -1
 	 */
 	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
 };
 
 typedef enum {
--

2.39.2

#5 lore raw

Re: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

In reply to Wenyou Yang
Quoted 54 lines · Wenyou Yang

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41 +++++++++++++++++++
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
  2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
  #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
  #include <linux/firmware.h>
  #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle, uint32_t speed);
  static int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
  static int smu_set_mp1_state(void *handle, enum pp_mp1_state mp1_state);
 
+static int smt_notifier_callback(struct notifier_block *nb, unsigned long action, void *data);
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback,
+};
+
  static int smu_sys_get_pp_feature_mask(void *handle,
  				       char *buf)
  {
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device *adev)
  	return 0;
  }
 
+static struct smu_context *current_smu;
+
  static int smu_early_init(void *handle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -645,6 +656,7 @@ static int smu_early_init(void *handle)
  	mutex_init(&smu->message_lock);
 
  	adev->powerplay.pp_handle = smu;
+	current_smu = smu;
  	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
  	r = smu_set_funcs(adev);

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle) · line 1121

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
  	if (!smu->ppt_funcs->get_fan_control_mode)
  		smu->adev->pm.no_fan = true;
 
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+

It is not required for every dGPU smu to register for and process this notification regardless of the system they are in. It is only applicable for vangogh and hence this and below should be moved to some ppt funcs used in sw_init/sw_fini of amdgpu_smu for vangogh alone.

Thanks,
Lijo

Quoted 57 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +27 -0
  	return 0;
  }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
  	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
  	return 0;
  }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct smu_context *smu, uint32_t size)
 
  	return ret;
  }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool enable)
+{
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data)
+{
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
index 09469c750a96..7c6594bba796 100644
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
  	 * @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
  	 */
  	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
  };
 
  typedef enum {
#6 lore raw

RE: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

[AMD Official Use Only - General]

Quoted 78 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, March 23, 2023 4:29 PM
To: Yang, WenYou <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>; amd- [email protected]; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: Re: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

Quoted 6 lines · Wenyou Yang

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41

+++++++++++++++++++

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_fan_speed_rpm(void *handle,

Quoted 17 lines
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
  2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
  #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
  #include <linux/firmware.h>
  #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle,

uint32_t speed);

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device

Quoted 16 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +8 -0
  static int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
  static int smu_set_mp1_state(void *handle, enum pp_mp1_state
 mp1_state);
 
+static int smt_notifier_callback(struct notifier_block *nb, unsigned
+long action, void *data);
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback, };
+
  static int smu_sys_get_pp_feature_mask(void *handle,
  				       char *buf)
  {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device *adev) · line 641

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
  	return 0;
  }
 
+static struct smu_context *current_smu;
+
  static int smu_early_init(void *handle)
  {
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;

@@

Quoted 12 lines

-645,6 +656,7 @@ static int smu_early_init(void *handle)
mutex_init(&smu->message_lock);

  	adev->powerplay.pp_handle = smu;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
+	current_smu = smu;
  	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
  	r = smu_set_funcs(adev);
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
  	if (!smu->ppt_funcs->get_fan_control_mode)
  		smu->adev->pm.no_fan = true;
 
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle) · line 1121

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+

It is not required for every dGPU smu to register for and process this notification regardless of the system they are in. It is only applicable for vangogh and hence this and below should be moved to some ppt funcs used in sw_init/sw_fini of amdgpu_smu for vangogh alone.

The fixed issue is common, it is possible to keep this interface for others. So I think it is better to put the common code here.

Quoted 63 lines

Thanks,
Lijo

Quoted 47 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +26 -0
  	return 0;
  }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
  	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
  	return 0;
  }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct
 smu_context *smu, uint32_t size)
 
  	return ret;
  }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data) {
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 09469c750a96..7c6594bba796 100644

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h struct pptable_funcs { · line 1354

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
  	 * @init_pptable_microcode: Prepare the pptable microcode to

upload via PSP

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
  	 */
  	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
  };
 
  typedef enum {
#7 lore raw

Re: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

Quoted 90 lines · WenYou

[AMD Official Use Only - General]

Quoted 78 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, March 23, 2023 4:29 PM
To: Yang, WenYou <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>; amd- [email protected]; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: Re: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw

Quoted 6 lines · Wenyou Yang

When the CPU SMT status change in the fly, sent the SMT-enable message to pmfw to notify it that the SMT status changed.

---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 41

+++++++++++++++++++

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_fan_speed_rpm(void *handle,

Quoted 17 lines
   drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 +++
   2 files changed, 46 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
index b5d64749990e..5cd85a9d149d 100644
@@ -22,6 +22,7 @@
 
   #define SWSMU_CODE_LAYER_L1
 
+#include <linux/cpu.h>
   #include <linux/firmware.h>
   #include <linux/pci.h>
 
@@ -69,6 +70,14 @@ static int smu_set_fan_speed_rpm(void *handle,

uint32_t speed);

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device

Quoted 16 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +8 -0
   static int smu_set_gfx_cgpg(struct smu_context *smu, bool enabled);
   static int smu_set_mp1_state(void *handle, enum pp_mp1_state
 mp1_state);
 
+static int smt_notifier_callback(struct notifier_block *nb, unsigned
+long action, void *data);
+
+extern struct raw_notifier_head smt_notifier_head;
+
+static struct notifier_block smt_notifier = {
+	.notifier_call = smt_notifier_callback, };
+
   static int smu_sys_get_pp_feature_mask(void *handle,
   				       char *buf)
   {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
@@ -625,6 +634,8 @@ static int smu_set_funcs(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_set_funcs(struct amdgpu_device *adev) · line 641

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
   	return 0;
   }
 
+static struct smu_context *current_smu;
+
   static int smu_early_init(void *handle)
   {
   	struct amdgpu_device *adev = (struct amdgpu_device *)handle;

@@

Quoted 12 lines

-645,6 +656,7 @@ static int smu_early_init(void *handle)
mutex_init(&smu->message_lock);

   	adev->powerplay.pp_handle = smu;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -0
+	current_smu = smu;
   	adev->powerplay.pp_funcs = &swsmu_pm_funcs;
 
   	r = smu_set_funcs(adev);
@@ -1105,6 +1117,8 @@ static int smu_sw_init(void *handle)
   	if (!smu->ppt_funcs->get_fan_control_mode)
   		smu->adev->pm.no_fan = true;
 
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle) · line 1121

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
+	raw_notifier_chain_register(&smt_notifier_head, &smt_notifier);
+

It is not required for every dGPU smu to register for and process this notification regardless of the system they are in. It is only applicable for vangogh and hence this and below should be moved to some ppt funcs used in sw_init/sw_fini of amdgpu_smu for vangogh alone.

Quoted 2 lines

The fixed issue is common, it is possible to keep this interface for others. So I think it is better to put the common code here.

No, this is not common at all. A Navi10 card sitting on an Intel system or a Renoir platform is not bothered about an smt change and doesn't need to register any notification callback.

All you have to do is to register for this notifier inside, say vangogh_set_ppt_funcs or some other callback which happen during sw_init of amdgpu_smu.

For unregister, you may keep it in smu_sw_fini call like below.

if (smu->nb.notifier != NULL)
unregister

Also, other/future APUs may be able handle the change internally (by propagating through HW itself) without driver needing to notify the FW.

Thanks,
Lijo

Quoted 63 lines
Quoted 63 lines

Thanks,
Lijo

Quoted 47 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +26 -0
   	return 0;
   }
 
@@ -1122,6 +1136,8 @@ static int smu_sw_fini(void *handle)
 
   	smu_fini_microcode(smu);
 
+	raw_notifier_chain_unregister(&smt_notifier_head, &smt_notifier);
+
   	return 0;
   }
 
@@ -3241,3 +3257,28 @@ int smu_send_hbm_bad_channel_flag(struct
 smu_context *smu, uint32_t size)
 
   	return ret;
   }
+
+static int smu_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = -EINVAL;
+
+	if (smu->ppt_funcs && smu->ppt_funcs->set_cpu_smt_enable)
+		ret = smu->ppt_funcs->set_cpu_smt_enable(smu, enable);
+
+	return ret;
+}
+
+static int smt_notifier_callback(struct notifier_block *nb,
+				 unsigned long action, void *data) {
+	struct smu_context *smu = current_smu;
+	int ret = NOTIFY_OK;
+
+	ret = (action == SMT_ENABLED) ?
+				smu_set_cpu_smt_enable(smu, true) :
+				smu_set_cpu_smt_enable(smu, false);
+	if (ret)
+		ret = NOTIFY_BAD;
+
+	return ret;
+}
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 09469c750a96..7c6594bba796 100644

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h struct pptable_funcs { · line 1354

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
@@ -1354,6 +1354,11 @@ struct pptable_funcs {
   	 * @init_pptable_microcode: Prepare the pptable microcode to

upload via PSP

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
   	 */
   	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @set_cpu_smt_enable: Set the CPU SMT status
+	 */
+	int (*set_cpu_smt_enable)(struct smu_context *smu, bool enable);
   };
 
   typedef enum {
#8 lore raw

PATCH RESEND 3/3 drm/amd/pm: vangogh: support to send SMT enable message

In reply to Wenyou Yang

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to pmfw for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
index 7471e2df2828..2b182dbc6f9c 100644
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset
 enum {
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..820812d910bf 100644
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +19 -0
index 7433dcaa16e0..f0eeb42df96b 100644
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,		    PPSMC_MSG_GetGfxOffStatus,						0),
 	MSG_MAP(GetGfxOffEntryCount,		    PPSMC_MSG_GetGfxOffEntryCount,					0),
 	MSG_MAP(LogGfxOffResidency,		    PPSMC_MSG_LogGfxOffResidency,					0),
+	MSG_MAP(SetCClkSMTEnable,		    PPSMC_MSG_SetCClkSMTEnable,						0),
 };
 
 static struct cmn2asic_mapping vangogh_feature_mask_map[SMU_FEATURE_COUNT] = {
@@ -2428,6 +2429,23 @@ static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool enable)
+{
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+						      SMU_MSG_SetCClkSMTEnable,
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+						      SMU_MSG_SetCClkSMTEnable,
+						      0, NULL);
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status,
@@ -2474,6 +2492,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,
 };
 
 void vangogh_set_ppt_funcs(struct smu_context *smu)
Signature · 1 line
2.39.2
#9 lore raw

RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

[AMD Official Use Only - General]

Quoted 100 lines

-----Original Message-----
From: Wenyou Yang <[email protected]>
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Liang, Richard qi <[email protected]>; Li, Ying <[email protected]>; Liu, Kun <[email protected]>; [email protected]; Yang, WenYou <[email protected]>
Subject: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to pmfw for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19
+++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
index 7471e2df2828..2b182dbc6f9c 100644
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 297b70b9388f..820812d910bf 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
index 7433dcaa16e0..f0eeb42df96b 100644
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,						0),
 	MSG_MAP(GetGfxOffEntryCount,
 PPSMC_MSG_GetGfxOffEntryCount,					0),
 	MSG_MAP(LogGfxOffResidency,

PPSMC_MSG_LogGfxOffResidency, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	MSG_MAP(SetCClkSMTEnable,

PPSMC_MSG_SetCClkSMTEnable,

	0),

};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2428,6 +2429,23 @@ static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +7 -0
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
+						      0, NULL);
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status, @@ -2474,6 +2492,7

@@ static const struct pptable_funcs vangogh_ppt_funcs = {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static const struct pptable_funcs vangogh_ppt_funcs = { · line 2495

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,

Maybe we can rename the function with cclk dpm string? For example,
.set_cclk_pd_limit = vangogh_set_cpu_smt_enable,

Perry.

Quoted 5 lines

};

void vangogh_set_ppt_funcs(struct smu_context *smu)
--
2.39.2

#10 lore raw

RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

[AMD Official Use Only - General]

Quoted 123 lines

-----Original Message-----
From: Yuan, Perry <[email protected]>
Sent: Thursday, March 23, 2023 10:21 AM
To: Yang, WenYou <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Liang, Richard qi <[email protected]>; Li, Ying <[email protected]>; Liu, Kun <[email protected]>; amd- [email protected]; Yang, WenYou <[email protected]>
Subject: RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

[AMD Official Use Only - General]

Quoted 4 lines

-----Original Message-----
From: Wenyou Yang <[email protected]>
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig,

Christian

Quoted 9 lines

<[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Liang, Richard qi <[email protected]>; Li, Ying <[email protected]>; Liu, Kun <[email protected]>; [email protected]; Yang, WenYou <[email protected]>
Subject: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to

pmfw

Quoted 10 lines

for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19
+++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 6 lines

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..2b182dbc6f9c 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h
+++

b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h

Quoted 30 lines
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 297b70b9388f..820812d910bf 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
index 7433dcaa16e0..f0eeb42df96b 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static struct cmn2asic_msg_mapping · line 143

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,
	0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static struct cmn2asic_msg_mapping · line 145

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
 	MSG_MAP(GetGfxOffEntryCount,
 PPSMC_MSG_GetGfxOffEntryCount,
	0),
Quoted 28 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
 	MSG_MAP(LogGfxOffResidency,

PPSMC_MSG_LogGfxOffResidency, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	MSG_MAP(SetCClkSMTEnable,

PPSMC_MSG_SetCClkSMTEnable,

	0),

};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2428,6 +2429,23 @@ static u32 vangogh_get_gfxoff_entrycount(struct +smu_context
*smu, uint64_t *entr

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +7 -0
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr

Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
+						      0, NULL);
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status, @@ -2474,6

+2492,7 @@

Quoted 9 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static const struct pptable_funcs vangogh_ppt_funcs = { · line 2495

Quoted 5 lines

static const struct pptable_funcs vangogh_ppt_funcs = {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,

Maybe we can rename the function with cclk dpm string? For example,
.set_cclk_pd_limit = vangogh_set_cpu_smt_enable,

This interface is only to send the smt status to pmfw, it is not used for configuring the Cclk_PD_Data_Limut value.

Quoted 8 lines

Perry.

Quoted 5 lines

};

void vangogh_set_ppt_funcs(struct smu_context *smu)
--
2.39.2

#11 lore raw

RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

In reply to Yuan, Perry

[AMD Official Use Only - General]

Quoted 123 lines

-----Original Message-----
From: Yuan, Perry <[email protected]>
Sent: Thursday, March 23, 2023 10:21 AM
To: Yang, WenYou <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Liang, Richard qi <[email protected]>; Li, Ying <[email protected]>; Liu, Kun <[email protected]>; amd- [email protected]; Yang, WenYou <[email protected]>
Subject: RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

[AMD Official Use Only - General]

Quoted 4 lines

-----Original Message-----
From: Wenyou Yang <[email protected]>
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig,

Christian

Quoted 9 lines

<[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Liang, Richard qi <[email protected]>; Li, Ying <[email protected]>; Liu, Kun <[email protected]>; [email protected]; Yang, WenYou <[email protected]>
Subject: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to

pmfw

Quoted 10 lines

for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19
+++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 6 lines

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..2b182dbc6f9c 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h
+++

b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h

Quoted 30 lines
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54
 
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 297b70b9388f..820812d910bf 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
index 7433dcaa16e0..f0eeb42df96b 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static struct cmn2asic_msg_mapping · line 143

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,
	0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static struct cmn2asic_msg_mapping · line 145

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
 	MSG_MAP(GetGfxOffEntryCount,
 PPSMC_MSG_GetGfxOffEntryCount,
	0),
Quoted 28 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
 	MSG_MAP(LogGfxOffResidency,

PPSMC_MSG_LogGfxOffResidency, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	MSG_MAP(SetCClkSMTEnable,

PPSMC_MSG_SetCClkSMTEnable,

	0),

};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2428,6 +2429,23 @@ static u32 vangogh_get_gfxoff_entrycount(struct +smu_context
*smu, uint64_t *entr

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +7 -0
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool
+enable) {
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr

Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
+						      0, NULL);
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status, @@ -2474,6

+2492,7 @@

Quoted 9 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static const struct pptable_funcs vangogh_ppt_funcs = { · line 2495

Quoted 5 lines

static const struct pptable_funcs vangogh_ppt_funcs = {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,

Maybe we can rename the function with cclk dpm string? For example,
.set_cclk_pd_limit = vangogh_set_cpu_smt_enable,

Having second thought, renaming is needed.

Thanks
Wenyou

Quoted 8 lines

Perry.

Quoted 5 lines

};

void vangogh_set_ppt_funcs(struct smu_context *smu)
--
2.39.2

#12 lore raw

RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

In reply to Wenyou Yang

[AMD Official Use Only - General]

Quoted 31 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenyou Yang
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>; amd- [email protected]; Yang, WenYou <[email protected]>; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to pmfw
for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19
+++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..2b182dbc6f9c 100644

drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h line 115

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54

This seems not right. The message count should be bigger than the index of any other message. That is PPSMC_Message_Count should be 0x59 or bigger.

Quoted 58 lines
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +0 -0
 //Argument for PPSMC_MSG_GfxDeviceDriverReset
 enum {
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..820812d910bf 100644
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
index 7433dcaa16e0..f0eeb42df96b 100644
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,
 	0),
 	MSG_MAP(GetGfxOffEntryCount,
 PPSMC_MSG_GetGfxOffEntryCount,					0),
 	MSG_MAP(LogGfxOffResidency,

PPSMC_MSG_LogGfxOffResidency, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	MSG_MAP(SetCClkSMTEnable,

PPSMC_MSG_SetCClkSMTEnable,

	0),

};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -2428,6 +2429,23 @@ static u32 vangogh_get_gfxoff_entrycount(struct

smu_context *smu, uint64_t *entr

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool

enable)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
+{
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr · line 2446

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      0, NULL);
+	}
+
+	return ret;

It seems the whole bunch of chunks can be simplified as
"return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetCClkSMTEnable, enable ? 1 : 0, NULL);"

BR
Evan

Quoted 16 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -0
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status,
@@ -2474,6 +2492,7 @@ static const struct pptable_funcs
 vangogh_ppt_funcs = {
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,
 };
 

void vangogh_set_ppt_funcs(struct smu_context *smu)
--
2.39.2

#13 lore raw

RE: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

[AMD Official Use Only - General]

Thanks Evan.

Quoted 33 lines
Quoted 5 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wenyou Yang
Sent: Wednesday, March 22, 2023 5:16 PM
To: Deucher, Alexander <[email protected]>; Koenig,

Christian

Quoted 2 lines

<[email protected]>; Pan, Xinhui <[email protected]>
Cc: Yuan, Perry <[email protected]>; Li, Ying <[email protected]>;

amd-

Quoted 6 lines

[email protected]; Yang, WenYou <[email protected]>; Liu, Kun <[email protected]>; Liang, Richard qi <[email protected]>
Subject: [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message

Add the support to PPSMC_MSG_SetCClkSMTEnable(0x58) message to

pmfw

Quoted 10 lines

for vangogh.

---
 .../pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h    |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19
+++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)
Quoted 6 lines

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h index 7471e2df2828..2b182dbc6f9c 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h
+++

b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h

Quoted 10 lines

drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h line 115

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v11_5_ppsmc.h +2 -1
@@ -111,7 +111,8 @@
 #define PPSMC_MSG_GetGfxOffStatus		       0x50
 #define PPSMC_MSG_GetGfxOffEntryCount		       0x51
 #define PPSMC_MSG_LogGfxOffResidency		       0x52
-#define PPSMC_Message_Count                            0x53
+#define PPSMC_MSG_SetCClkSMTEnable		       0x58
+#define PPSMC_Message_Count                            0x54

This seems not right. The message count should be bigger than the index of any other message.
That is PPSMC_Message_Count should be 0x59 or bigger.

Accept. Will change in v2.

Quoted 58 lines
Quoted 23 lines
(quoted diff) +0 -0
 //Argument for PPSMC_MSG_GfxDeviceDriverReset  enum { diff --git

a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
index 297b70b9388f..820812d910bf 100644

drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
@@ -245,7 +245,8 @@
 	__SMU_DUMMY_MAP(AllowGpo),	\
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
-	__SMU_DUMMY_MAP(GetMetricsTable),
+	__SMU_DUMMY_MAP(GetMetricsTable), \
+	__SMU_DUMMY_MAP(SetCClkSMTEnable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
index 7433dcaa16e0..f0eeb42df96b 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static struct cmn2asic_msg_mapping · line 146

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -141,6 +141,7 @@ static struct cmn2asic_msg_mapping
 vangogh_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(GetGfxOffStatus,
 PPSMC_MSG_GetGfxOffStatus,
 	0),
 	MSG_MAP(GetGfxOffEntryCount,
 PPSMC_MSG_GetGfxOffEntryCount,
	0),
Quoted 9 lines

MSG_MAP(LogGfxOffResidency,
PPSMC_MSG_LogGfxOffResidency, 0),

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	MSG_MAP(SetCClkSMTEnable,

PPSMC_MSG_SetCClkSMTEnable,

	0),

};

static struct cmn2asic_mapping
vangogh_feature_mask_map[SMU_FEATURE_COUNT] = { @@ -2428,6

+2429,23 @@

Quoted 18 lines

static u32 vangogh_get_gfxoff_entrycount(struct
smu_context *smu, uint64_t *entr

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
 	return ret;
 }
 
+static int vangogh_set_cpu_smt_enable(struct smu_context *smu, bool

enable)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
+{
+	int ret = 0;
+
+	if (enable) {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      1, NULL);
+	} else {
+		ret = smu_cmn_send_smc_msg_with_param(smu,
+
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr · line 2446

Quoted 5 lines

SMU_MSG_SetCClkSMTEnable,

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +4 -0
+						      0, NULL);
+	}
+
+	return ret;

It seems the whole bunch of chunks can be simplified as "return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetCClkSMTEnable, enable ? 1 : 0, NULL);"

Yes. Will change it in v2.

Quoted 19 lines

BR
Evan

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static u32 vangogh_get_gfxoff_entrycount(struct smu_context *smu, uint64_t *entr

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +2 -0
+}
+
 static const struct pptable_funcs vangogh_ppt_funcs = {
 
 	.check_fw_status = smu_v11_0_check_fw_status, @@ -2474,6

+2492,7 @@

Quoted 10 lines

static const struct pptable_funcs vangogh_ppt_funcs = {

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -1
 	.get_power_limit = vangogh_get_power_limit,
 	.set_power_limit = vangogh_set_power_limit,
 	.get_vbios_bootup_values = smu_v11_0_get_vbios_bootup_values,
+	.set_cpu_smt_enable = vangogh_set_cpu_smt_enable,
 };
 
 void vangogh_set_ppt_funcs(struct smu_context *smu)
--

2.39.2