Skip to contentSkip to conversation

drm/amdgpu/pm: Add notification function for no DC support

PATCH Superseded Bokun Zhang 4 participants 9 messages Aug 15, 2023 – Aug 16, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/pm: Add notification function for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5 ++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7 +++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..274c6ba534b3 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 		return ret;
 	}
 
+	if (!amdgpu_device_has_dc_support(adev)) {
+		ret = smu_notify_no_dc(smu);
+		if (ret)
+			dev_warn(adev->dev, "Failed to notify no dal support, driver may not reach best performance\n");
+	}
+
 	/*
 	 * Set min deep sleep dce fclk with bootup value from vbios via
 	 * SetMinDeepSleepDcefclk MSG.
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
 	 * @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
 	 */
 	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @notify_no_dal: Notify SMU that there is no display and SMU should control DPM
+	 */
+	int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h +4 -1
index 10cff75b44d5..e2ee855c7748 100644
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
 	MSG_MAP(AllowGpo,			PPSMC_MSG_SetGpoAllow,           0),
 	MSG_MAP(AllowIHHostInterrupt,		PPSMC_MSG_AllowIHHostInterrupt,       0),
 	MSG_MAP(ReenableAcDcInterrupt,		PPSMC_MSG_ReenableAcDcInterrupt,       0),
+	MSG_MAP(DALNotPresent,		PPSMC_MSG_DALNotPresent,       0),
 };
 
 static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+	return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent, NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
 	.set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag,
 	.gpo_control = smu_v13_0_gpo_control,
 	.get_ecc_info = smu_v13_0_0_get_ecc_info,
+	.notify_no_dc = smu_v13_0_0_notify_no_dc,
 };
 
 void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)	smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
 #define smu_set_config_table(smu, config_table)				smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)					smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)						smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
Signature · 1 line
2.25.1
#1 lore raw

Hi Bokun,

Quoted 20 lines · Bokun Zhang

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
  .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5 ++++-
  drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7 +++++++
  drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
  6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index f005a90c35af..274c6ba534b3 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_smc_hw_setup(struct smu_context *smu) · line 1416

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -0
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
  		return ret;
  	}
 
+	if (!amdgpu_device_has_dc_support(adev)) {
+		ret = smu_notify_no_dc(smu);
+		if (ret)
+			dev_warn(adev->dev, "Failed to notify no dal support, driver may not reach best performance\n");

Can you replace all instances of dal with DC (i.e. s/dal/DC and s/DAL/DC)?

Quoted 95 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -0
+	}
+
  	/*
  	 * Set min deep sleep dce fclk with bootup value from vbios via
  	 * SetMinDeepSleepDcefclk MSG.
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
  	 * @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
  	 */
  	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @notify_no_dal: Notify SMU that there is no display and SMU should control DPM
+	 */
+	int (*notify_no_dc)(struct smu_context *smu);
  };
 
  typedef enum {
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h +4 -1
index 10cff75b44d5..e2ee855c7748 100644
@@ -138,7 +138,10 @@
  #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
  #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
  #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
  //Debug Dump Message
  #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
  #undef __SMU_DUMMY_MAP
  #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
  	MSG_MAP(AllowGpo,			PPSMC_MSG_SetGpoAllow,           0),
  	MSG_MAP(AllowIHHostInterrupt,		PPSMC_MSG_AllowIHHostInterrupt,       0),
  	MSG_MAP(ReenableAcDcInterrupt,		PPSMC_MSG_ReenableAcDcInterrupt,       0),
+	MSG_MAP(DALNotPresent,		PPSMC_MSG_DALNotPresent,       0),
  };
 
  static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu,
  	return ret;
  }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+	return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent, NULL);
+}
+
  static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
  	.get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
  	.set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
  	.send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag,
  	.gpo_control = smu_v13_0_gpo_control,
  	.get_ecc_info = smu_v13_0_0_get_ecc_info,
+	.notify_no_dc = smu_v13_0_0_notify_no_dc,
  };
 
  void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
  #define smu_get_default_config_table_settings(smu, config_table)	smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
  #define smu_set_config_table(smu, config_table)				smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
  #define smu_init_pptable_microcode(smu)					smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)						smu_ppt_funcs(notify_no_dc, 0, smu)
 
  #endif
  #endif
Signature · 1 line
Hamza
#2 lore raw

PATCH v2 1/1 drm/amdgpu/pm: Add notification function for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5 ++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7 +++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..c65bebdbec11 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct smu_context *smu)
 		return ret;
 	}
 
+	if (!amdgpu_device_has_dc_support(adev)) {
+		ret = smu_notify_no_dc(smu);
+		if (ret)
+			dev_warn(adev->dev, "Failed to notify no dc support, driver may not reach best performance\n");
+	}
+
 	/*
 	 * Set min deep sleep dce fclk with bootup value from vbios via
 	 * SetMinDeepSleepDcefclk MSG.
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
 	 * @init_pptable_microcode: Prepare the pptable microcode to upload via PSP
 	 */
 	int (*init_pptable_microcode)(struct smu_context *smu);
+
+	/**
+	 * @notify_no_dal: Notify SMU that there is no display and SMU should control DPM
+	 */
+	int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h +4 -1
index 10cff75b44d5..e2ee855c7748 100644
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
 	MSG_MAP(AllowGpo,			PPSMC_MSG_SetGpoAllow,           0),
 	MSG_MAP(AllowIHHostInterrupt,		PPSMC_MSG_AllowIHHostInterrupt,       0),
 	MSG_MAP(ReenableAcDcInterrupt,		PPSMC_MSG_ReenableAcDcInterrupt,       0),
+	MSG_MAP(DALNotPresent,		PPSMC_MSG_DALNotPresent,       0),
 };
 
 static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+	return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent, NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
 	.set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag,
 	.gpo_control = smu_v13_0_gpo_control,
 	.get_ecc_info = smu_v13_0_0_get_ecc_info,
+	.notify_no_dc = smu_v13_0_0_notify_no_dc,
 };
 
 void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -0
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)	smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
 #define smu_set_config_table(smu, config_table)				smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)					smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)						smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
Signature · 1 line
2.25.1
maintainer Reviewed-by on v2 1/1
#3 lore raw

[Public]

Quoted 60 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bokun Zhang
Sent: Tuesday, August 15, 2023 11:50 AM
To: [email protected]
Cc: Zhang, Bokun <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5
++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7
+++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..c65bebdbec11 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct
 smu_context *smu)
              return ret;
      }
 
+     if (!amdgpu_device_has_dc_support(adev)) {
+             ret = smu_notify_no_dc(smu);
+             if (ret)
+                     dev_warn(adev->dev, "Failed to notify no dc support,
 driver may not reach best performance\n");
+     }
+
      /*

* Set min deep sleep dce fclk with bootup value from vbios via
* SetMinDeepSleepDcefclk MSG.

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
       * @init_pptable_microcode: Prepare the pptable microcode to upload

via PSP

       */
      int (*init_pptable_microcode)(struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +3 -0
+
+     /**
+      * @notify_no_dal: Notify SMU that there is no display and SMU
Quoted 1 line

should control DPM

Fix the function name in the kernel doc comment here. With that fixed, patch is:

Quoted 104 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
+      */
+     int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..e2ee855c7748 100644
---
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
+++
b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +4 -1
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping

smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow,
0),
MSG_MAP(AllowIHHostInterrupt,
PPSMC_MSG_AllowIHHostInterrupt, 0),
MSG_MAP(ReenableAcDcInterrupt,
PPSMC_MSG_ReenableAcDcInterrupt, 0),
+ MSG_MAP(DALNotPresent,
PPSMC_MSG_DALNotPresent, 0),
};

static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
{

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5 -0
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct
 smu_context *smu,
      return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+     return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent,
 NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {

.get_allowed_feature_mask =
smu_v13_0_0_get_allowed_feature_mask,

      .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs
 smu_v13_0_0_ppt_funcs = {
      .send_hbm_bad_channel_flag =
 smu_v13_0_0_send_bad_mem_channel_flag,
      .gpo_control = smu_v13_0_gpo_control,
      .get_ecc_info = smu_v13_0_0_get_ecc_info,
+     .notify_no_dc = smu_v13_0_0_notify_no_dc,
 };

void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)
      smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP,
 smu, config_table)
 #define smu_set_config_table(smu, config_table)
      smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)
      smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)
      smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
--

2.25.1

Reviewed-by Alex Deucher
#4 lore raw

[Public]

There's already another smu callback - notify_display. This can be accommodated there, no need to add another callback.

Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]> on behalf of Deucher, Alexander <[email protected]>
Sent: Tuesday, August 15, 2023 11:13:14 PM
To: Zhang, Bokun <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Bokun <[email protected]>; Quan, Evan <[email protected]>
Subject: RE: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

[Public]

Quoted 60 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bokun Zhang
Sent: Tuesday, August 15, 2023 11:50 AM
To: [email protected]
Cc: Zhang, Bokun <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5
++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7
+++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..c65bebdbec11 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct
 smu_context *smu)
              return ret;
      }
 
+     if (!amdgpu_device_has_dc_support(adev)) {
+             ret = smu_notify_no_dc(smu);
+             if (ret)
+                     dev_warn(adev->dev, "Failed to notify no dc support,
 driver may not reach best performance\n");
+     }
+
      /*

* Set min deep sleep dce fclk with bootup value from vbios via
* SetMinDeepSleepDcefclk MSG.

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
       * @init_pptable_microcode: Prepare the pptable microcode to upload

via PSP

       */
      int (*init_pptable_microcode)(struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +3 -0
+
+     /**
+      * @notify_no_dal: Notify SMU that there is no display and SMU
Quoted 1 line

should control DPM

Fix the function name in the kernel doc comment here. With that fixed, patch is:

Quoted 104 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
+      */
+     int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..e2ee855c7748 100644
---
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
+++
b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +4 -1
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping

smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow,
0),
MSG_MAP(AllowIHHostInterrupt,
PPSMC_MSG_AllowIHHostInterrupt, 0),
MSG_MAP(ReenableAcDcInterrupt,
PPSMC_MSG_ReenableAcDcInterrupt, 0),
+ MSG_MAP(DALNotPresent,
PPSMC_MSG_DALNotPresent, 0),
};

static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
{

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5 -0
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct
 smu_context *smu,
      return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+     return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent,
 NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {

.get_allowed_feature_mask =
smu_v13_0_0_get_allowed_feature_mask,

      .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs
 smu_v13_0_0_ppt_funcs = {
      .send_hbm_bad_channel_flag =
 smu_v13_0_0_send_bad_mem_channel_flag,
      .gpo_control = smu_v13_0_gpo_control,
      .get_ecc_info = smu_v13_0_0_get_ecc_info,
+     .notify_no_dc = smu_v13_0_0_notify_no_dc,
 };

void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)
      smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP,
 smu, config_table)
 #define smu_set_config_table(smu, config_table)
      smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)
      smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)
      smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
--

2.25.1

author Reviewed-by Alex Deucher
#5 lore raw

[Public]

Hey Lijo,
I have considered to combine the function. However notify_display_change() may serve for another purpose as mentioned in the comment:

/**
* @notify_display_change: Enable fast memory clock switching. *
* Allows for fine grained memory clock switching but has more stringent
* timing requirements.
*/

This function is implemented as smu_v13_0_notify_display_change() for SMU 13, but not included in smu_v13_0_0_ppt_funcs struct and therefore not called at the moment.
I am not completely sure about the purpose of smu_v13_0_notify_display_change().
If it makes sense to combine them, I can make the change accordingly. But I would like to know if I should add a new function smu_v13_0_0_notify_display_change, or extend smu_v13_0_notify_display_change() and add it to smu_v13_0_0_ppt_funcs.

Thanks!

From: Lazar, Lijo <[email protected]>
Sent: Tuesday, August 15, 2023 2:03 PM
To: Deucher, Alexander <[email protected]>; Zhang, Bokun <[email protected]>; [email protected]
Cc: Zhang, Bokun <[email protected]>; Quan, Evan <[email protected]>
Subject: Re: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

There's already another smu callback - notify_display. This can be accommodated there, no need to add another callback.

Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Deucher, Alexander <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 15, 2023 11:13:14 PM
To: Zhang, Bokun <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Bokun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

[Public]

Quoted 60 lines

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Bokun Zhang
Sent: Tuesday, August 15, 2023 11:50 AM
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Bokun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC
support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5
++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7
+++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..c65bebdbec11 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct
 smu_context *smu)
              return ret;
      }
 
+     if (!amdgpu_device_has_dc_support(adev)) {
+             ret = smu_notify_no_dc(smu);
+             if (ret)
+                     dev_warn(adev->dev, "Failed to notify no dc support,
 driver may not reach best performance\n");
+     }
+
      /*

* Set min deep sleep dce fclk with bootup value from vbios via
* SetMinDeepSleepDcefclk MSG.

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
       * @init_pptable_microcode: Prepare the pptable microcode to upload

via PSP

       */
      int (*init_pptable_microcode)(struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +3 -0
+
+     /**
+      * @notify_no_dal: Notify SMU that there is no display and SMU
Quoted 1 line

should control DPM

Fix the function name in the kernel doc comment here. With that fixed, patch is:

Quoted 104 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
+      */
+     int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..e2ee855c7748 100644
---
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
+++
b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +4 -1
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping

smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow,
0),
MSG_MAP(AllowIHHostInterrupt,
PPSMC_MSG_AllowIHHostInterrupt, 0),
MSG_MAP(ReenableAcDcInterrupt,
PPSMC_MSG_ReenableAcDcInterrupt, 0),
+ MSG_MAP(DALNotPresent,
PPSMC_MSG_DALNotPresent, 0),
};

static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
{

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5 -0
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct
 smu_context *smu,
      return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+     return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent,
 NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {

.get_allowed_feature_mask =
smu_v13_0_0_get_allowed_feature_mask,

      .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs
 smu_v13_0_0_ppt_funcs = {
      .send_hbm_bad_channel_flag =
 smu_v13_0_0_send_bad_mem_channel_flag,
      .gpo_control = smu_v13_0_gpo_control,
      .get_ecc_info = smu_v13_0_0_get_ecc_info,
+     .notify_no_dc = smu_v13_0_0_notify_no_dc,
 };

void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)
      smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP,
 smu, config_table)
 #define smu_set_config_table(smu, config_table)
      smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)
      smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)
      smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
--

2.25.1

Reviewed-by Alex Deucher
#6 lore raw

[Public]

Hi Bokun,

Originally the call back is meant to enable fast UCLK switching based on display configuration. We can reuse the same interface to notify PMFW for any display related configuration. smu_v13_0_notify_display_change looks to be copied from smuv11, but not really used now. I think the existing implementation can be dropped altogether.

Thanks,
Lijo

From: Zhang, Bokun <[email protected]>
Sent: Tuesday, August 15, 2023 11:52 PM
To: Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]
Cc: Quan, Evan <[email protected]>
Subject: RE: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

Hey Lijo,
I have considered to combine the function. However notify_display_change() may serve for another purpose as mentioned in the comment:

/**
* @notify_display_change: Enable fast memory clock switching. *
* Allows for fine grained memory clock switching but has more stringent
* timing requirements.
*/

This function is implemented as smu_v13_0_notify_display_change() for SMU 13, but not included in smu_v13_0_0_ppt_funcs struct and therefore not called at the moment.
I am not completely sure about the purpose of smu_v13_0_notify_display_change().
If it makes sense to combine them, I can make the change accordingly. But I would like to know if I should add a new function smu_v13_0_0_notify_display_change, or extend smu_v13_0_notify_display_change() and add it to smu_v13_0_0_ppt_funcs.

Thanks!

From: Lazar, Lijo <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 15, 2023 2:03 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Zhang, Bokun <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Zhang, Bokun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

There's already another smu callback - notify_display. This can be accommodated there, no need to add another callback.

Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Deucher, Alexander <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 15, 2023 11:13:14 PM
To: Zhang, Bokun <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Bokun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC support

[Public]

[Public]

Quoted 60 lines

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Bokun Zhang
Sent: Tuesday, August 15, 2023 11:50 AM
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Bokun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>
Subject: [PATCH v2] drm/amdgpu/pm: Add notification function for no DC
support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c                  | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h              | 5 +++++
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   | 5
++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h               | 3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c       | 7
+++++++
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h                | 1 +
 6 files changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index f005a90c35af..c65bebdbec11 100644
@@ -1410,6 +1410,12 @@ static int smu_smc_hw_setup(struct
 smu_context *smu)
              return ret;
      }
 
+     if (!amdgpu_device_has_dc_support(adev)) {
+             ret = smu_notify_no_dc(smu);
+             if (ret)
+                     dev_warn(adev->dev, "Failed to notify no dc support,
 driver may not reach best performance\n");
+     }
+
      /*

* Set min deep sleep dce fclk with bootup value from vbios via
* SetMinDeepSleepDcefclk MSG.

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
index 6e2069dcb6b9..c8fdc3d0aa25 100644
@@ -1356,6 +1356,11 @@ struct pptable_funcs {
       * @init_pptable_microcode: Prepare the pptable microcode to upload

via PSP

       */
      int (*init_pptable_microcode)(struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +3 -0
+
+     /**
+      * @notify_no_dal: Notify SMU that there is no display and SMU
Quoted 1 line

should control DPM

Fix the function name in the kernel doc comment here. With that fixed, patch is:

Quoted 104 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
+      */
+     int (*notify_no_dc)(struct smu_context *smu);
 };
 
 typedef enum {

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..e2ee855c7748 100644
---
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
+++
b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +4 -1
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
index 48b03524a52d..41412cf891a7 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping

smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow,
0),
MSG_MAP(AllowIHHostInterrupt,
PPSMC_MSG_AllowIHHostInterrupt, 0),
MSG_MAP(ReenableAcDcInterrupt,
PPSMC_MSG_ReenableAcDcInterrupt, 0),
+ MSG_MAP(DALNotPresent,
PPSMC_MSG_DALNotPresent, 0),
};

static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
{

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +5 -0
@@ -2601,6 +2602,11 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct
 smu_context *smu,
      return ret;
 }
 
+static int smu_v13_0_0_notify_no_dc(struct smu_context *smu)
+{
+     return smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent,
 NULL);
+}
+
 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {

.get_allowed_feature_mask =
smu_v13_0_0_get_allowed_feature_mask,

      .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +1 -0
@@ -2680,6 +2686,7 @@ static const struct pptable_funcs
 smu_v13_0_0_ppt_funcs = {
      .send_hbm_bad_channel_flag =
 smu_v13_0_0_send_bad_mem_channel_flag,
      .gpo_control = smu_v13_0_gpo_control,
      .get_ecc_info = smu_v13_0_0_get_ecc_info,
+     .notify_no_dc = smu_v13_0_0_notify_no_dc,
 };

void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index bcc42abfc768..9b9a13fdcef8 100644
@@ -97,6 +97,7 @@
 #define smu_get_default_config_table_settings(smu, config_table)
      smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP,
 smu, config_table)
 #define smu_set_config_table(smu, config_table)
      smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)
      smu_ppt_funcs(init_pptable_microcode, 0, smu)
+#define smu_notify_no_dc(smu)
      smu_ppt_funcs(notify_no_dc, 0, smu)
 
 #endif
 #endif
--

2.25.1

#7 lore raw

PATCH v3 1/1 drm/amdgpu/pm: Add notification for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

- Reuse smu_v13_0_notify_display_change() for this purpose

---
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h          |  5 +----
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   |  5 ++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h           |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c         | 10 ++++------
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c   |  2 ++
 5 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +1 -4
index 6e2069dcb6b9..a719ad9f7bd0 100644
@@ -1043,10 +1043,7 @@ struct pptable_funcs {
 						   enum smu_feature_mask mask);
 
 	/**
-	 * @notify_display_change: Enable fast memory clock switching.
-	 *
-	 * Allows for fine grained memory clock switching but has more stringent
-	 * timing requirements.
+	 * @notify_display_change: General interface call to let SMU know about DC change
 	 */
 	int (*notify_display_change)(struct smu_context *smu);
 
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h +4 -1
index 10cff75b44d5..e2ee855c7748 100644
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +4 -6
index 895cda8e6934..4b8842fc9574 100644
@@ -838,12 +838,10 @@ int smu_v13_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);
+	if (!amdgpu_device_has_dc_support(smu->adev))
+	{
+		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_DALNotPresent, NULL);
+	}
 
 	return ret;
 }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 -0
index 48b03524a52d..d75f500b50ee 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
 	MSG_MAP(AllowGpo,			PPSMC_MSG_SetGpoAllow,           0),
 	MSG_MAP(AllowIHHostInterrupt,		PPSMC_MSG_AllowIHHostInterrupt,       0),
 	MSG_MAP(ReenableAcDcInterrupt,		PPSMC_MSG_ReenableAcDcInterrupt,       0),
+	MSG_MAP(DALNotPresent,		PPSMC_MSG_DALNotPresent,       0),
 };
 
 static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = {
@@ -2680,6 +2681,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.send_hbm_bad_channel_flag = smu_v13_0_0_send_bad_mem_channel_flag,
 	.gpo_control = smu_v13_0_gpo_control,
 	.get_ecc_info = smu_v13_0_0_get_ecc_info,
+	.notify_display_change = smu_v13_0_notify_display_change,
 };
 
 void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 1/1
#8 lore raw

RE: [PATCH v3] drm/amdgpu/pm: Add notification for no DC support

[AMD Official Use Only - General]

Quoted 97 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bokun Zhang
Sent: Wednesday, August 16, 2023 2:07 PM
To: [email protected]
Cc: Zhang, Bokun <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH v3] drm/amdgpu/pm: Add notification for no DC support

- There is a DPM issue where if DC is not present, FCLK will stay at low level.
We need to send a SMU message to configure the DPM

- Reuse smu_v13_0_notify_display_change() for this purpose

---
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h          |  5 +----
 .../drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h   |  5 ++++-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h           |  3 ++-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c         | 10 ++++------
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c   |  2 ++
 5 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -3
index 6e2069dcb6b9..a719ad9f7bd0 100644
@@ -1043,10 +1043,7 @@ struct pptable_funcs {
                                                 enum smu_feature_mask
 mask);
 
      /**
-      * @notify_display_change: Enable fast memory clock switching.
-      *
-      * Allows for fine grained memory clock switching but has more

stringent

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -1
-      * timing requirements.
+      * @notify_display_change: General interface call to let SMU know
+about DC change
       */
      int (*notify_display_change)(struct smu_context *smu);

diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..e2ee855c7748 100644
---
a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h
+++
b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +4 -1
@@ -138,7 +138,10 @@
 #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
 #define PPSMC_MSG_SetPriorityDeltaGain           0x4B
 #define PPSMC_MSG_AllowIHHostInterrupt           0x4C
-#define PPSMC_Message_Count                      0x4D
+
+#define PPSMC_MSG_DALNotPresent                  0x4E
+
+#define PPSMC_Message_Count                      0x4F
 
 //Debug Dump Message
 #define DEBUGSMC_MSG_TestMessage                    0x1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index 297b70b9388f..f71fc99447f2 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(DALNotPresent),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -4
index 895cda8e6934..4b8842fc9574 100644
@@ -838,12 +838,10 @@ int smu_v13_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) &&

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -2
-         smu->adev->gmc.vram_type == AMDGPU_VRAM_TYPE_HBM)
-             ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_SetUclkFastSwitch, 1, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_notify_display_change(struct smu_context *smu) · line 842

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -0
+     if (!amdgpu_device_has_dc_support(smu->adev))
+     {

Kernel coding style checkers will complain about this. Please move the { onto the same line as the if statement or you can drop them altogether since it's only a single line. With that fixed:

Quoted 36 lines

+ ret = smu_cmn_send_smc_msg(smu,
SMU_MSG_DALNotPresent, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+     }
 
      return ret;
 }
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
index 48b03524a52d..d75f500b50ee 100644
@@ -160,6 +160,7 @@ static struct cmn2asic_msg_mapping

smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] =
MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow,
0),
MSG_MAP(AllowIHHostInterrupt,
PPSMC_MSG_AllowIHHostInterrupt, 0),
MSG_MAP(ReenableAcDcInterrupt,
PPSMC_MSG_ReenableAcDcInterrupt, 0),
+ MSG_MAP(DALNotPresent,
PPSMC_MSG_DALNotPresent, 0),
};

static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] =
{ @@ -2680,6 +2681,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
.send_hbm_bad_channel_flag =
smu_v13_0_0_send_bad_mem_channel_flag,

      .gpo_control = smu_v13_0_gpo_control,
      .get_ecc_info = smu_v13_0_0_get_ecc_info,

+ .notify_display_change = smu_v13_0_notify_display_change,
};

void smu_v13_0_0_set_ppt_funcs(struct smu_context *smu)
--
2.25.1