Skip to contentSkip to conversation

drm/amd/pm: update smu_v13_0_6 smu header

PATCH Superseded Yang Wang 2 participants 3 messages Sep 8, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/2 drm/amd/pm: update smu_v13_0_6 smu header

update smu firmware header to support smu mca debug feature.

---
 .../gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h | 3 +++
 drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h   | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_6.h +3 -0
index ca4a5e99ccd1..d0833887c355 100644
@@ -132,6 +132,9 @@ typedef struct {
 #define THROTTLER_THERMAL_VR_BIT        3//VRHOT
 #define THROTTLER_THERMAL_HBM_BIT       4
 
+#define ClearMcaOnRead_UE_FLAG_MASK              0x1
+#define ClearMcaOnRead_CE_POLL_MASK              0x2
+
 // These defines are used with the following messages:
 // SMC_MSG_TransferTableDram2Smu
 // SMC_MSG_TransferTableSmu2Dram
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_6_ppsmc.h +2 -1
index 70a4a717fd3f..4ac4f2dcc203 100644
@@ -87,7 +87,8 @@
 #define PPSMC_MSG_QueryValidMcaCount                0x36
 #define PPSMC_MSG_McaBankDumpDW                     0x37
 #define PPSMC_MSG_GetCTFLimit                       0x38
-#define PPSMC_Message_Count                         0x39
+#define PPSMC_MSG_ClearMcaOnRead                    0x39
+#define PPSMC_Message_Count                         0x40
 
 //PPSMC Reset Types for driver msg argument
 #define PPSMC_RESET_TYPE_DRIVER_MODE_1_RESET        0x1
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 drm/amd/pm: enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled

enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled.

---
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 26 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index ebc789e7a289..f762c01b98a5 100644
@@ -247,7 +247,8 @@
 	__SMU_DUMMY_MAP(Mode2Reset),	\
 	__SMU_DUMMY_MAP(RequestI2cTransaction), \
 	__SMU_DUMMY_MAP(GetMetricsTable), \
-	__SMU_DUMMY_MAP(DALNotPresent),
+	__SMU_DUMMY_MAP(DALNotPresent), \
+	__SMU_DUMMY_MAP(ClearMcaOnRead),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)	SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +26 -0
index ff58ee14a68f..5ecc90e6af10 100644
@@ -133,6 +133,7 @@ static const struct cmn2asic_msg_mapping smu_v13_0_6_message_map[SMU_MSG_MAX_COU
 	MSG_MAP(SetSoftMaxGfxClk,                    PPSMC_MSG_SetSoftMaxGfxClk,                0),
 	MSG_MAP(PrepareMp1ForUnload,                 PPSMC_MSG_PrepareForDriverUnload,          0),
 	MSG_MAP(GetCTFLimit,                         PPSMC_MSG_GetCTFLimit,                     0),
+	MSG_MAP(ClearMcaOnRead,	                     PPSMC_MSG_ClearMcaOnRead,                  0),
 };
 
 static const struct cmn2asic_mapping smu_v13_0_6_clk_map[SMU_CLK_COUNT] = {
@@ -1393,6 +1394,20 @@ static int smu_v13_0_6_notify_unload(struct smu_context *smu)
 	return 0;
 }
 
+static int smu_v13_0_6_mca_set_debug_mode(struct smu_context *smu, bool enable)
+{
+	uint32_t smu_version;
+
+	/* NOTE: this ClearMcaOnRead message is only supported for smu version 85.72.0 or higher */
+	smu_cmn_get_smc_version(smu, NULL, &smu_version);
+	if (smu_version < 0x554800)
+		return 0;
+
+	return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ClearMcaOnRead,
+					       enable ? 0 : ClearMcaOnRead_UE_FLAG_MASK | ClearMcaOnRead_CE_POLL_MASK,
+					       NULL);
+}
+
 static int smu_v13_0_6_system_features_control(struct smu_context *smu,
 					       bool enable)
 {
@@ -2182,6 +2197,16 @@ static int smu_v13_0_6_smu_send_hbm_bad_page_num(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v13_0_6_post_init(struct smu_context *smu)
+{
+	struct amdgpu_device *adev = smu->adev;
+
+	if (!amdgpu_sriov_vf(adev) && (adev->ras_enabled & BIT(AMDGPU_RAS_BLOCK__UMC)))
+		return smu_v13_0_6_mca_set_debug_mode(smu, true);
+
+	return 0;
+}
+
 static const struct pptable_funcs smu_v13_0_6_ppt_funcs = {
 	/* init dpm */
 	.get_allowed_feature_mask = smu_v13_0_6_get_allowed_feature_mask,
@@ -2235,6 +2260,7 @@ static const struct pptable_funcs smu_v13_0_6_ppt_funcs = {
 	.i2c_init = smu_v13_0_6_i2c_control_init,
 	.i2c_fini = smu_v13_0_6_i2c_control_fini,
 	.send_hbm_bad_pages_num = smu_v13_0_6_smu_send_hbm_bad_page_num,
+	.post_init = smu_v13_0_6_post_init,
 };
 
 void smu_v13_0_6_set_ppt_funcs(struct smu_context *smu)
Signature · 1 line
2.34.1
#2 lore raw

RE: [PATCH 2/2] drm/amd/pm: enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled

[AMD Official Use Only - General]

Quoted 79 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Yang Wang
Sent: Friday, September 8, 2023 2:34 PM
To: [email protected]
Cc: Wang, Yang(Kevin) <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amd/pm: enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled

enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled.

---
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  3 ++-
  .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 26
+++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +2 -1
index ebc789e7a289..f762c01b98a5 100644
@@ -247,7 +247,8 @@
      __SMU_DUMMY_MAP(Mode2Reset),    \
      __SMU_DUMMY_MAP(RequestI2cTransaction), \
      __SMU_DUMMY_MAP(GetMetricsTable), \
-     __SMU_DUMMY_MAP(DALNotPresent),
+     __SMU_DUMMY_MAP(DALNotPresent), \
+     __SMU_DUMMY_MAP(ClearMcaOnRead),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)        SMU_MSG_##type
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0 -0
index ff58ee14a68f..5ecc90e6af10 100644
@@ -133,6 +133,7 @@ static const struct cmn2asic_msg_mapping

smu_v13_0_6_message_map[SMU_MSG_MAX_COU
MSG_MAP(SetSoftMaxGfxClk,
PPSMC_MSG_SetSoftMaxGfxClk, 0),
MSG_MAP(PrepareMp1ForUnload,
PPSMC_MSG_PrepareForDriverUnload, 0),
MSG_MAP(GetCTFLimit, PPSMC_MSG_GetCTFLimit,
0),
+ MSG_MAP(ClearMcaOnRead,
PPSMC_MSG_ClearMcaOnRead, 0),
};

static const struct cmn2asic_mapping
smu_v13_0_6_clk_map[SMU_CLK_COUNT] = { @@ -1393,6 +1394,20 @@ static int smu_v13_0_6_notify_unload(struct smu_context *smu)

      return 0;

}

+static int smu_v13_0_6_mca_set_debug_mode(struct smu_context *smu, bool

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -0
+enable) {
+     uint32_t smu_version;
+
+     /* NOTE: this ClearMcaOnRead message is only supported for smu

version 85.72.0 or higher */

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5 -0
+     smu_cmn_get_smc_version(smu, NULL, &smu_version);
+     if (smu_version < 0x554800)
+             return 0;
+
+     return smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_ClearMcaOnRead,
+ enable ? 0 :
ClearMcaOnRead_UE_FLAG_MASK | ClearMcaOnRead_CE_POLL_MASK,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +3 -0
+                                            NULL);
+}
+
 static int smu_v13_0_6_system_features_control(struct smu_context *smu,
                                             bool enable)
 {

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int · line 2205

Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +4 -0
@@ -2182,6 +2197,16 @@ static int
 smu_v13_0_6_smu_send_hbm_bad_page_num(struct smu_context *smu,
      return ret;
 }
 
+static int smu_v13_0_6_post_init(struct smu_context *smu) {
+     struct amdgpu_device *adev = smu->adev;
+
+     if (!amdgpu_sriov_vf(adev) && (adev->ras_enabled &
 BIT(AMDGPU_RAS_BLOCK__UMC)))

[Stanley]: is there any reason only check AMDGPU_RAS_BLOCK__UMC bit? If HBM ECC is not active but SRAM ECC is active, the AMDGPU_RAS_BLOCK__UMC bit is not set, is it necessary to set debug mode for this scenario?

Regards,
Stanley

Quoted 21 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +5 -0
+             return smu_v13_0_6_mca_set_debug_mode(smu, true);
+
+     return 0;
+}
+
 static const struct pptable_funcs smu_v13_0_6_ppt_funcs = {
      /* init dpm */
      .get_allowed_feature_mask =

smu_v13_0_6_get_allowed_feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1 -0
@@ -2235,6 +2260,7 @@ static const struct pptable_funcs
 smu_v13_0_6_ppt_funcs = {
      .i2c_init = smu_v13_0_6_i2c_control_init,
      .i2c_fini = smu_v13_0_6_i2c_control_fini,
      .send_hbm_bad_pages_num =
 smu_v13_0_6_smu_send_hbm_bad_page_num,
+     .post_init = smu_v13_0_6_post_init,
 };

void smu_v13_0_6_set_ppt_funcs(struct smu_context *smu)
--
2.34.1