Skip to contentSkip to conversation

drm/amdgpu: Load TA ucode for PSP 15_0_0

PATCH Superseded Pratik Vishwakarma 1 participant 11 messages Feb 6

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/11 drm/amdgpu: Load TA ucode for PSP 15_0_0

TOC and TA both are required

---
 drivers/gpu/drm/amd/amdgpu/psp_v15_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/psp_v15_0.c +4 -0
index 3aca293e2f0c..723ddae17644 100644
@@ -45,6 +45,10 @@ static int psp_v15_0_0_init_microcode(struct psp_context *psp)
 	if (err)
 		return err;
 
+	err = psp_init_ta_microcode(psp, ucode_prefix);
+	if (err)
+		return err;
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH v4 2/11 drm/amd/swsmu: Add new param regs for SMU15

Some SMU messages have changed to multi reg read/write Initialize during smu_early_init

---
 drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +9 -1
index c3f22844ba2f..d58b0bc2bf78 100644
@@ -52,6 +52,12 @@
 #define mmMP1_SMN_C2PMSG_32			0x0060
 #define mmMP1_SMN_C2PMSG_32_BASE_IDX		    1
 
+#define mmMP1_SMN_C2PMSG_33                   0x0061
+#define mmMP1_SMN_C2PMSG_33_BASE_IDX                  1
+
+#define mmMP1_SMN_C2PMSG_34                   0x0062
+#define mmMP1_SMN_C2PMSG_34_BASE_IDX                  1
+
 /* MALLPowerController message arguments (Defines for the Cache mode control) */
 #define SMU_MALL_PMFW_CONTROL 0
 #define SMU_MALL_DRIVER_CONTROL 1
@@ -1347,7 +1353,9 @@ static void smu_v15_0_0_init_msg_ctl(struct smu_context *smu)
 	ctl->config.msg_reg = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_30);
 	ctl->config.resp_reg = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_31);
 	ctl->config.arg_regs[0] = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_32);
-	ctl->config.num_arg_regs = 1;
+	ctl->config.arg_regs[1] = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_33);
+	ctl->config.arg_regs[2] = SOC15_REG_OFFSET(MP1, 0, mmMP1_SMN_C2PMSG_34);
+	ctl->config.num_arg_regs = 3;
 	ctl->ops = &smu_msg_v1_ops;
 	ctl->default_timeout = adev->usec_timeout * 20;
 	ctl->message_map = smu_v15_0_0_message_map;
Signature · 1 line
2.43.0
#2 lore raw

PATCH v4 3/11 drm/amdgpu: Add support for update_table for SMU15

In reply to Pratik Vishwakarma

Add update_table for SMU 15_0_0

---
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h  |  5 ++
 .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c    | 61 +++++++++++++++++++
 .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c  | 38 ++++++++++++
 3 files changed, 104 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v15_0.h +5 -0
index 14e8d8c7a80a..af87c31ca9a4 100644
@@ -241,5 +241,10 @@ int smu_v15_0_enable_thermal_alert(struct smu_context *smu);
 
 int smu_v15_0_disable_thermal_alert(struct smu_context *smu);
 
+int smu_v15_0_0_update_table(struct smu_context *smu,
+			 enum smu_table_id table_index,
+			 int argument, void *table_data,
+			 bool drv2smu);
+
 #endif
 #endif
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +61 -0

67 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +38 -0
index d58b0bc2bf78..9a2e2c2f4e06 100644
@@ -190,11 +190,38 @@ static int smu_v15_0_0_init_smc_tables(struct smu_context *smu)
 	if (!smu_table->metrics_table)
 		goto err0_out;
 	smu_table->metrics_time = 0;
+	if (tables[SMU_TABLE_SMU_METRICS].size) {
+		ret = amdgpu_bo_create_kernel(smu->adev,
+					      tables[SMU_TABLE_SMU_METRICS].size,
+					      tables[SMU_TABLE_SMU_METRICS].align,
+					      tables[SMU_TABLE_SMU_METRICS].domain,
+					      &tables[SMU_TABLE_SMU_METRICS].bo,
+					      &tables[SMU_TABLE_SMU_METRICS].mc_address,
+					      &tables[SMU_TABLE_SMU_METRICS].cpu_addr);
+		if (ret) {
+			dev_err(smu->adev->dev, "VRAM allocation for Metrics table failed!\n");
+			goto err0_out;
+		}
+	}
 
 	smu_table->clocks_table = kzalloc(sizeof(DpmClocks_t), GFP_KERNEL);
 	if (!smu_table->clocks_table)
 		goto err1_out;
 
+	if (tables[SMU_TABLE_DPMCLOCKS].size) {
+		ret = amdgpu_bo_create_kernel(smu->adev,
+					      tables[SMU_TABLE_DPMCLOCKS].size,
+					      tables[SMU_TABLE_DPMCLOCKS].align,
+					      tables[SMU_TABLE_DPMCLOCKS].domain,
+					      &tables[SMU_TABLE_DPMCLOCKS].bo,
+					      &tables[SMU_TABLE_DPMCLOCKS].mc_address,
+					      &tables[SMU_TABLE_DPMCLOCKS].cpu_addr);
+		if (ret) {
+			dev_err(smu->adev->dev, "VRAM allocation for DPM table failed!\n");
+			goto err1_out;
+		}
+	}
+
 	smu_table->watermarks_table = kzalloc(sizeof(Watermarks_t), GFP_KERNEL);
 	if (!smu_table->watermarks_table)
 		goto err2_out;
@@ -220,6 +247,7 @@ static int smu_v15_0_0_init_smc_tables(struct smu_context *smu)
 static int smu_v15_0_0_fini_smc_tables(struct smu_context *smu)
 {
 	struct smu_table_context *smu_table = &smu->smu_table;
+	struct smu_table *tables = smu_table->tables;
 
 	kfree(smu_table->clocks_table);
 	smu_table->clocks_table = NULL;
@@ -232,6 +260,16 @@ static int smu_v15_0_0_fini_smc_tables(struct smu_context *smu)
 
 	smu_driver_table_fini(smu, SMU_DRIVER_TABLE_GPU_METRICS);
 
+	if (tables[SMU_TABLE_DPMCLOCKS].mc_address)
+		amdgpu_bo_free_kernel(&tables[SMU_TABLE_DPMCLOCKS].bo,
+					&tables[SMU_TABLE_DPMCLOCKS].mc_address,
+					&tables[SMU_TABLE_DPMCLOCKS].cpu_addr);
+	if (tables[SMU_TABLE_SMU_METRICS].mc_address)
+		amdgpu_bo_free_kernel(&tables[SMU_TABLE_SMU_METRICS].bo,
+					&tables[SMU_TABLE_SMU_METRICS].mc_address,
+					&tables[SMU_TABLE_SMU_METRICS].cpu_addr);
+
+
 	return 0;
 }
 
Signature · 1 line
2.43.0
#3 lore raw

PATCH v4 4/11 drm/admgpu: Update metrics_table for SMU15

In reply to Pratik Vishwakarma

Use multi param based get op for metrics_table

---
 .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c  | 34 +++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +32 -2
index 9a2e2c2f4e06..c07cf438e4c0 100644
@@ -284,6 +284,36 @@ static int smu_v15_0_0_system_features_control(struct smu_context *smu, bool en)
 	return ret;
 }
 
+static int smu_v15_0_0_get_metrics_table(struct smu_context *smu,
+							void *metrics_table,
+							bool bypass_cache)
+{
+	struct smu_table_context *smu_table = &smu->smu_table;
+	uint32_t table_size =
+			smu_table->tables[SMU_TABLE_SMU_METRICS].size;
+	int ret = 0;
+
+	if (bypass_cache ||
+		!smu_table->metrics_time ||
+		time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(1))) {
+		ret = smu_v15_0_0_update_table(smu,
+						SMU_TABLE_SMU_METRICS,
+						0,
+						smu_table->metrics_table,
+						false);
+		if (ret) {
+			dev_info(smu->adev->dev, "Failed to export SMU15_0_0 metrics table!\n");
+			return ret;
+		}
+		smu_table->metrics_time = jiffies;
+	}
+
+	if (metrics_table)
+		memcpy(metrics_table, smu_table->metrics_table, table_size);
+
+	return 0;
+}
+
 static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu,
 					    MetricsMember_t member,
 					    uint32_t *value)
@@ -293,7 +323,7 @@ static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu,
 	SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;
 	int ret = 0;
 
-	ret = smu_cmn_get_metrics_table(smu, NULL, false);
+	ret = smu_v15_0_0_get_metrics_table(smu, NULL, false);
 	if (ret)
 		return ret;
 
@@ -568,7 +598,7 @@ static ssize_t smu_v15_0_0_get_gpu_metrics(struct smu_context *smu,
 	SmuMetrics_t metrics;
 	int ret = 0;
 
-	ret = smu_cmn_get_metrics_table(smu, &metrics, true);
+	ret = smu_v15_0_0_get_metrics_table(smu, &metrics, true);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.43.0
#4 lore raw

PATCH v4 5/11 drm/amdgpu: Fix set_default_dpm_tables

In reply to Pratik Vishwakarma

Use smu_v15_0_0_update_table instead of common api

---
 drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0.c +1 -1
index 7ab6cf2367df..f5902319c056 100644
@@ -1791,7 +1791,7 @@ int smu_v15_0_set_default_dpm_tables(struct smu_context *smu)
 {
 	struct smu_table_context *smu_table = &smu->smu_table;
 
-	return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0,
+	return smu_v15_0_0_update_table(smu, SMU_TABLE_DPMCLOCKS, 0,
 				    smu_table->clocks_table, false);
 }
 
Signature · 1 line
2.43.0
#5 lore raw

PATCH v4 6/11 drm/amdgpu: Fix is_dpm_running

In reply to Pratik Vishwakarma

Use multi args for get_enabled_mask to fix is_dpm_running

---
 .../drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c  | 35 +++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +33 -2
index c07cf438e4c0..0a8cafc84435 100644
@@ -517,12 +517,43 @@ static int smu_v15_0_0_read_sensor(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v15_0_0_get_enabled_mask(struct smu_context *smu,
+					struct smu_feature_bits *feature_mask)
+{
+	uint32_t *feature_mask_high;
+	uint32_t *feature_mask_low;
+	int ret = 0;
+	struct smu_msg_ctl *ctl = &smu->msg_ctl;
+
+	if (!feature_mask)
+		return -EINVAL;
+
+	feature_mask_low = &((uint32_t *)feature_mask)[0];
+	feature_mask_high = &((uint32_t *)feature_mask)[1];
+
+	struct smu_msg_args args = {
+		.msg = SMU_MSG_GetEnabledSmuFeatures,
+		.num_args = 0,
+		.num_out_args = 2,
+	};
+
+	ret = ctl->ops->send_msg(ctl, &args);
+
+	if (ret)
+		return ret;
+
+	*feature_mask_low = args.out_args[0];
+	*feature_mask_high = args.out_args[1];
+
+	return ret;
+}
+
 static bool smu_v15_0_0_is_dpm_running(struct smu_context *smu)
 {
 	int ret = 0;
 	struct smu_feature_bits feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
+	ret = smu_v15_0_0_get_enabled_mask(smu, &feature_enabled);
 
 	if (ret)
 		return false;
@@ -1394,7 +1425,7 @@ static const struct pptable_funcs smu_v15_0_0_ppt_funcs = {
 	.is_dpm_running = smu_v15_0_0_is_dpm_running,
 	.set_watermarks_table = smu_v15_0_0_set_watermarks_table,
 	.get_gpu_metrics = smu_v15_0_0_get_gpu_metrics,
-	.get_enabled_mask = smu_cmn_get_enabled_mask,
+	.get_enabled_mask = smu_v15_0_0_get_enabled_mask,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_driver_table_location = smu_v15_0_set_driver_table_location,
 	.gfx_off_control = smu_v15_0_gfx_off_control,
Signature · 1 line
2.43.0
#6 lore raw

PATCH v4 7/11 drm/amdgpu: Drop unsupported function

In reply to Pratik Vishwakarma

drop set_driver_table_location

---
 drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +0 -1
index 0a8cafc84435..ba90626e5447 100644
@@ -1427,7 +1427,6 @@ static const struct pptable_funcs smu_v15_0_0_ppt_funcs = {
 	.get_gpu_metrics = smu_v15_0_0_get_gpu_metrics,
 	.get_enabled_mask = smu_v15_0_0_get_enabled_mask,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
-	.set_driver_table_location = smu_v15_0_set_driver_table_location,
 	.gfx_off_control = smu_v15_0_gfx_off_control,
 	.mode2_reset = smu_v15_0_0_mode2_reset,
 	.get_dpm_ultimate_freq = smu_v15_0_common_get_dpm_ultimate_freq,
Signature · 1 line
2.43.0
#7 lore raw

PATCH v4 8/11 drm/amd: Drop MALL

In reply to Pratik Vishwakarma

Not supported on SMU 15_0_0

---
 .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c    | 13 -------------
 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +0 -13
index ba90626e5447..0a5f25c8e4bb 100644
@@ -58,19 +58,6 @@
 #define mmMP1_SMN_C2PMSG_34                   0x0062
 #define mmMP1_SMN_C2PMSG_34_BASE_IDX                  1
 
-/* MALLPowerController message arguments (Defines for the Cache mode control) */
-#define SMU_MALL_PMFW_CONTROL 0
-#define SMU_MALL_DRIVER_CONTROL 1
-
-/*
- * MALLPowerState message arguments
- * (Defines for the Allocate/Release Cache mode if in driver mode)
- */
-#define SMU_MALL_EXIT_PG 0
-#define SMU_MALL_ENTER_PG 1
-
-#define SMU_MALL_PG_CONFIG_DEFAULT SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON
-
 #define SMU_15_0_UMD_PSTATE_GFXCLK 700
 #define SMU_15_0_UMD_PSTATE_SOCCLK 678
 #define SMU_15_0_UMD_PSTATE_FCLK 1800
Signature · 1 line
2.43.0
#8 lore raw

PATCH v4 9/11 drm/amdgpu: enable mode2 reset for SMU IP v15.0.0

In reply to Pratik Vishwakarma

Set the default reset method to mode2 for SMU 15.0.0.

---
 drivers/gpu/drm/amd/amdgpu/soc21.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -0
index d9cc649d81ad..79d132fc8ca9 100644
@@ -422,6 +422,7 @@ soc21_asic_reset_method(struct amdgpu_device *adev)
 	case IP_VERSION(14, 0, 1):
 	case IP_VERSION(14, 0, 4):
 	case IP_VERSION(14, 0, 5):
+	case IP_VERSION(15, 0, 0):
 		return AMD_RESET_METHOD_MODE2;
 	default:
 		if (amdgpu_dpm_is_baco_supported(adev))
Signature · 1 line
2.43.0
#9 lore raw

PATCH v4 10/11 drm/amd: Add CG/PG flags for GC 11.5.4

In reply to Pratik Vishwakarma

Enable GFXOff for GC 11.5.4

---
 drivers/gpu/drm/amd/amdgpu/soc21.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +21 -2
index 79d132fc8ca9..8122a5cacf07 100644
@@ -839,9 +839,28 @@ static int soc21_common_early_init(struct amdgpu_ip_block *ip_block)
 		break;
 	case IP_VERSION(11, 5, 4):
 		adev->cg_flags = AMD_CG_SUPPORT_VCN_MGCG |
-			AMD_CG_SUPPORT_JPEG_MGCG;
+			AMD_CG_SUPPORT_JPEG_MGCG |
+			AMD_CG_SUPPORT_GFX_CGCG |
+			AMD_CG_SUPPORT_GFX_CGLS |
+			AMD_CG_SUPPORT_GFX_MGCG |
+			AMD_CG_SUPPORT_GFX_FGCG |
+			AMD_CG_SUPPORT_REPEATER_FGCG |
+			AMD_CG_SUPPORT_GFX_PERF_CLK |
+			AMD_CG_SUPPORT_GFX_3D_CGCG |
+			AMD_CG_SUPPORT_GFX_3D_CGLS |
+			AMD_CG_SUPPORT_MC_MGCG |
+			AMD_CG_SUPPORT_MC_LS |
+			AMD_CG_SUPPORT_HDP_LS |
+			AMD_CG_SUPPORT_HDP_DS |
+			AMD_CG_SUPPORT_HDP_SD |
+			AMD_CG_SUPPORT_ATHUB_MGCG |
+			AMD_CG_SUPPORT_ATHUB_LS |
+			AMD_CG_SUPPORT_IH_CG |
+			AMD_CG_SUPPORT_BIF_MGCG |
+			AMD_CG_SUPPORT_BIF_LS;
 		adev->pg_flags = AMD_PG_SUPPORT_VCN |
-			AMD_PG_SUPPORT_JPEG;
+			AMD_PG_SUPPORT_JPEG |
+			AMD_PG_SUPPORT_GFX_PG;
 		adev->external_rev_id = adev->rev_id + 0x1;
                break;
 	default:
Signature · 1 line
2.43.0
#10 lore raw

PATCH v4 11/11 drm/amd/smu: Fix User mode stable P-states SMU15

In reply to Pratik Vishwakarma

SMU 15_0_0 exports only soft limits for CLKs
Use correct messages

---
 .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c  | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c +5 -10
index 0a5f25c8e4bb..c3d1be9dc0db 100644
@@ -1071,26 +1071,21 @@ static int smu_v15_0_0_set_soft_freq_limited_range(struct smu_context *smu,
 	switch (clk_type) {
 	case SMU_GFXCLK:
 	case SMU_SCLK:
-		msg_set_min = SMU_MSG_SetHardMinGfxClk;
+		msg_set_min = SMU_MSG_SetSoftMinGfxclk;
 		msg_set_max = SMU_MSG_SetSoftMaxGfxClk;
 		break;
 	case SMU_FCLK:
-		msg_set_min = SMU_MSG_SetHardMinFclkByFreq;
+		msg_set_min = SMU_MSG_SetSoftMinFclk;
 		msg_set_max = SMU_MSG_SetSoftMaxFclkByFreq;
 		break;
 	case SMU_SOCCLK:
-		msg_set_min = SMU_MSG_SetHardMinSocclkByFreq;
+		msg_set_min = SMU_MSG_SetSoftMinSocclkByFreq;
 		msg_set_max = SMU_MSG_SetSoftMaxSocclkByFreq;
 		break;
 	case SMU_VCLK:
 	case SMU_DCLK:
-		msg_set_min = SMU_MSG_SetHardMinVcn0;
-		msg_set_max = SMU_MSG_SetSoftMaxVcn0;
-		break;
-	case SMU_VCLK1:
-	case SMU_DCLK1:
-		msg_set_min = SMU_MSG_SetHardMinVcn1;
-		msg_set_max = SMU_MSG_SetSoftMaxVcn1;
+		msg_set_min = SMU_MSG_SetSoftMinVcn;
+		msg_set_max = SMU_MSG_SetSoftMaxVcn;
 		break;
 	default:
 		return -EINVAL;
Signature · 1 line
2.43.0