AMD-GFX Archive on 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 4/6] drm/amd/pm: Add sienna cichlid throttler translation
Date: Thu, 20 May 2021 10:29:28 -0400	[thread overview]
Message-ID: <20210520142930.8369-4-Graham.Sider@amd.com> (raw)
In-Reply-To: <20210520142930.8369-1-Graham.Sider@amd.com>

Perform dependent to independent throttle status translation for
sienna cichlid.
---
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 48 ++++++++++++++++++-
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
index 75acdb80c499..023b10306c3e 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
@@ -453,6 +453,49 @@ static int sienna_cichlid_tables_init(struct smu_context *smu)
 	return -ENOMEM;
 }
 
+static uint32_t sienna_cichlid_get_indep_throttler_status(
+					unsigned long dep_throttler_status)
+{
+	unsigned long indep_throttler_status = 0;
+
+	__assign_bit(INDEP_THROTTLER_TEMP_EDGE_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_EDGE_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_HOTSPOT_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_HOTSPOT_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_MEM_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_MEM_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_VR_GFX_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_VR_GFX_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_VR_MEM_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_VR_MEM0_BIT, &dep_throttler_status) ||
+		  test_bit(THROTTLER_TEMP_VR_MEM1_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_VR_SOC_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_VR_SOC_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TEMP_LIQUID_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TEMP_LIQUID0_BIT, &dep_throttler_status) ||
+		  test_bit(THROTTLER_TEMP_LIQUID1_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TDC_GFX_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TDC_GFX_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_TDC_SOC_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_TDC_SOC_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_PPT0_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_PPT0_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_PPT1_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_PPT1_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_PPT2_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_PPT2_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_PPT3_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_PPT3_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_FIT_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_FIT_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_PPM_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_PPM_BIT, &dep_throttler_status));
+	__assign_bit(INDEP_THROTTLER_APCC_BIT, &indep_throttler_status,
+		  test_bit(THROTTLER_APCC_BIT, &dep_throttler_status));
+
+	return (uint32_t)indep_throttler_status;
+}
+
 static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu,
 					       MetricsMember_t member,
 					       uint32_t *value)
@@ -542,7 +585,7 @@ static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu,
 			SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 		break;
 	case METRICS_THROTTLER_STATUS:
-		*value = metrics->ThrottlerStatus;
+		*value = sienna_cichlid_get_indep_throttler_status(metrics->ThrottlerStatus);
 		break;
 	case METRICS_CURR_FANSPEED:
 		*value = metrics->CurrFanSpeed;
@@ -3666,7 +3709,8 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
 	gpu_metrics->current_vclk1 = metrics->CurrClock[PPCLK_VCLK_1];
 	gpu_metrics->current_dclk1 = metrics->CurrClock[PPCLK_DCLK_1];
 
-	gpu_metrics->throttle_status = metrics->ThrottlerStatus;
+	gpu_metrics->throttle_status =
+			sienna_cichlid_get_indep_throttler_status(metrics->ThrottlerStatus);
 
 	gpu_metrics->current_fan_speed = metrics->CurrFanSpeed;
 
-- 
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-20 14:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 14:29 [PATCH 1/6] drm/amd/pm: Add ASIC independent throttle bits Graham Sider
2021-05-20 14:29 ` [PATCH 2/6] drm/amd/pm: Add arcturus throttler translation Graham Sider
2021-05-21 14:25   ` Kasiviswanathan, Harish
2021-05-21 14:27   ` Alex Deucher
2021-05-21 17:39     ` Sider, Graham
2021-05-21 20:14       ` Alex Deucher
2021-05-21 21:32         ` Sider, Graham
2021-05-21 21:47           ` Alex Deucher
2021-05-21 21:49             ` Alex Deucher
2021-05-21 22:04               ` Sider, Graham
2021-05-20 14:29 ` [PATCH 3/6] drm/amd/pm: Add navi1x " Graham Sider
2021-05-20 14:29 ` Graham Sider [this message]
2021-05-20 14:29 ` [PATCH 5/6] drm/amd/pm: Add vangogh " Graham Sider
2021-05-20 14:29 ` [PATCH 6/6] drm/amd/pm: Add aldebaran " Graham Sider
2021-05-24  6:58 ` [PATCH 1/6] drm/amd/pm: Add ASIC independent throttle bits Lijo Lazar
2021-05-25 16:09   ` Sider, Graham

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=20210520142930.8369-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox