[PATCH 34/89] drm/amdgpu/pm: add gfx_off_control for yellow carp

Alex Deucher alexander.deucher at amd.com
Wed Jun 2 16:48:13 UTC 2021


From: Aaron Liu <aaron.liu at amd.com>

This patch implements gfx_off_control.

Signed-off-by: Aaron Liu <aaron.liu at amd.com>
Reviewed-by: Huang Rui <ray.huang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h      |  2 ++
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c  | 21 +++++++++++++++++++
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  1 +
 3 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h
index 9339c39c78fe..065f3d27b2b8 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h
@@ -49,5 +49,7 @@ int smu_v13_0_1_fini_smc_tables(struct smu_context *smu);
 int smu_v13_0_1_set_default_dpm_tables(struct smu_context *smu);
 
 int smu_v13_0_1_set_driver_table_location(struct smu_context *smu);
+
+int smu_v13_0_1_gfx_off_control(struct smu_context *smu, bool enable);
 #endif
 #endif
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c
index 4e41c026a2e6..dfbb527b25cb 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c
@@ -152,3 +152,24 @@ int smu_v13_0_1_set_driver_table_location(struct smu_context *smu)
 
 	return ret;
 }
+
+int smu_v13_0_1_gfx_off_control(struct smu_context *smu, bool enable)
+{
+	int ret = 0;
+	struct amdgpu_device *adev = smu->adev;
+
+	switch (adev->asic_type) {
+	case CHIP_YELLOW_CARP:
+		if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
+			return 0;
+		if (enable)
+			ret = smu_cmn_send_smc_msg(smu, SMU_MSG_AllowGfxOff, NULL);
+		else
+			ret = smu_cmn_send_smc_msg(smu, SMU_MSG_DisallowGfxOff, NULL);
+		break;
+	default:
+		break;
+	}
+
+	return ret;
+}
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
index cfe086658ce5..af3db91d609e 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
@@ -152,6 +152,7 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = {
 	.get_enabled_mask = smu_cmn_get_enabled_32_bits_mask,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_driver_table_location = smu_v13_0_1_set_driver_table_location,
+	.gfx_off_control = smu_v13_0_1_gfx_off_control,
 };
 
 void yellow_carp_set_ppt_funcs(struct smu_context *smu)
-- 
2.31.1



More information about the amd-gfx mailing list