All of lore.kernel.org
 help / color / mirror / Atom feed
From: Graham Sider <Graham.Sider@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harish.Kasiviswanathan@amd.com,
	Graham Sider <Graham.Sider@amd.com>,
	Elena.Sakhnovitch@amd.com
Subject: [PATCH v2 7/8] drm/amd/pm: Add renoir throttler translation
Date: Fri, 28 May 2021 15:58:14 -0400	[thread overview]
Message-ID: <20210528195815.2615-7-Graham.Sider@amd.com> (raw)
In-Reply-To: <20210528195815.2615-1-Graham.Sider@amd.com>

Perform dependent to independent throttle status translation
for renoir.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
---
 .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c   | 50 +++++++++++++++++--
 1 file changed, 45 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 1c399c4ab4dc..50c03fc413de 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -153,7 +153,7 @@ static int renoir_init_smc_tables(struct smu_context *smu)
 	if (!smu_table->watermarks_table)
 		goto err2_out;
 
-	smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_1);
+	smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
 	smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
 	if (!smu_table->gpu_metrics_table)
 		goto err3_out;
@@ -170,6 +170,44 @@ static int renoir_init_smc_tables(struct smu_context *smu)
 	return -ENOMEM;
 }
 
+static uint64_t renoir_get_indep_throttler_status(
+					uint32_t dep_status)
+{
+	if (dep_status == 0)
+		return 0;
+
+	uint64_t indep_status = 0;
+
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_SPL_BIT, THROTTLER_STATUS_BIT_SPL);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_FPPT_BIT, THROTTLER_STATUS_BIT_FPPT);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_SPPT_BIT, THROTTLER_STATUS_BIT_SPPT);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_SPPT_APU_BIT, THROTTLER_STATUS_BIT_SPPT_APU);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_TEMP_CORE_BIT, THROTTLER_STATUS_BIT_THM_CORE);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_TEMP_VR_GFX_BIT, THROTTLER_STATUS_BIT_THM_GFX);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_TEMP_VR_SOC_BIT, THROTTLER_STATUS_BIT_THM_SOC);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_TDC_VDD_BIT, THROTTLER_STATUS_BIT_TDC_VDD);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_TDC_SOC_BIT, THROTTLER_STATUS_BIT_TDC_SOC);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_PROCHOT_CPU_BIT, THROTTLER_STATUS_BIT_PROCHOT_CPU);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_PROCHOT_GFX_BIT, THROTTLER_STATUS_BIT_PROCHOT_GFX);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_EDC_CPU_BIT, THROTTLER_STATUS_BIT_EDC_CPU);
+	indep_status |= smu_u64_throttler_bit(dep_status,
+			SMU_THROTTLER_EDC_GFX_BIT, THROTTLER_STATUS_BIT_EDC_GFX);
+
+	return indep_status;
+}
+
 /*
  * This interface just for getting uclk ultimate freq and should't introduce
  * other likewise function result in overmuch callback.
@@ -1264,8 +1302,8 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
 				      void **table)
 {
 	struct smu_table_context *smu_table = &smu->smu_table;
-	struct gpu_metrics_v2_1 *gpu_metrics =
-		(struct gpu_metrics_v2_1 *)smu_table->gpu_metrics_table;
+	struct gpu_metrics_v2_2 *gpu_metrics =
+		(struct gpu_metrics_v2_2 *)smu_table->gpu_metrics_table;
 	SmuMetrics_t metrics;
 	int ret = 0;
 
@@ -1273,7 +1311,7 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
 	if (ret)
 		return ret;
 
-	smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 1);
+	smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 2);
 
 	gpu_metrics->temperature_gfx = metrics.GfxTemperature;
 	gpu_metrics->temperature_soc = metrics.SocTemperature;
@@ -1311,6 +1349,8 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
 	gpu_metrics->current_l3clk[1] = metrics.L3Frequency[1];
 
 	gpu_metrics->throttle_status = metrics.ThrottlerStatus;
+	gpu_metrics->indep_throttle_status =
+		renoir_get_indep_throttler_status(metrics.ThrottlerStatus);
 
 	gpu_metrics->fan_pwm = metrics.FanPwm;
 
@@ -1318,7 +1358,7 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
 
 	*table = (void *)gpu_metrics;
 
-	return sizeof(struct gpu_metrics_v2_1);
+	return sizeof(struct gpu_metrics_v2_2);
 }
 
 static int renoir_gfx_state_change_set(struct smu_context *smu, uint32_t state)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2021-05-28 20:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 19:58 [PATCH v2 1/8] drm/amd/pm: Add u64 throttler status field to gpu_metrics Graham Sider
2021-05-28 19:58 ` [PATCH v2 2/8] drm/amd/pm: Add ASIC independent throttle bits Graham Sider
2021-05-28 19:58 ` [PATCH v2 3/8] drm/amd/pm: Add arcturus throttler translation Graham Sider
2021-05-28 19:58 ` [PATCH v2 4/8] drm/amd/pm: Add navi1x " Graham Sider
2021-05-31  5:12   ` Lazar, Lijo
2021-05-31 13:29     ` Sider, Graham
2021-05-28 19:58 ` [PATCH v2 5/8] drm/amd/pm: Add sienna cichlid " Graham Sider
2021-05-28 19:58 ` [PATCH v2 6/8] drm/amd/pm: Add vangogh " Graham Sider
2021-05-28 19:58 ` Graham Sider [this message]
2021-05-28 19:58 ` [PATCH v2 8/8] drm/amd/pm: Add aldebaran " Graham Sider
2021-05-31  4:37 ` [PATCH v2 1/8] drm/amd/pm: Add u64 throttler status field to gpu_metrics Lazar, Lijo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528195815.2615-7-Graham.Sider@amd.com \
    --to=graham.sider@amd.com \
    --cc=Elena.Sakhnovitch@amd.com \
    --cc=Harish.Kasiviswanathan@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.