-----Original Message-----
From: Lazar, Lijo <Lijo.Lazar@xxxxxxx>
Sent: Thursday, March 23, 2023 4:29 PM
To: Yang, WenYou <WenYou.Yang@xxxxxxx>; Deucher, Alexander
<Alexander.Deucher@xxxxxxx>; Koenig, Christian
<Christian.Koenig@xxxxxxx>; Pan, Xinhui <Xinhui.Pan@xxxxxxx>
Cc: Yuan, Perry <Perry.Yuan@xxxxxxx>; Li, Ying <YING.LI@xxxxxxx>; amd-
gfx@xxxxxxxxxxxxxxxxxxxxx; Liu, Kun <Kun.Liu2@xxxxxxx>; Liang, Richard qi
<Richardqi.Liang@xxxxxxx>
Subject: Re: [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable
message to pmfw
On 3/22/2023 2:46 PM, Wenyou Yang wrote:
When the CPU SMT status change in the fly, sent the SMT-enable message
to pmfw to notify it that the SMT status changed.
Signed-off-by: Wenyou Yang <WenYou.Yang@xxxxxxx>
---
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(+)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index b5d64749990e..5cd85a9d149d 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -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);
+
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.