[PATCH 6/6] drm/amd/pm: Add aldebaran throttler translation
Graham Sider
Graham.Sider at amd.com
Thu May 20 14:29:30 UTC 2021
Perform dependent to independent throttle status translation for
aldebaran.
---
.../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 44 ++++++++++++++++---
1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index fb744f3e17d7..1281c74980b7 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -511,6 +511,37 @@ static int aldebaran_freqs_in_same_level(int32_t frequency1,
return (abs(frequency1 - frequency2) <= EPSILON);
}
+static uint32_t aldebaran_get_indep_throttler_status(
+ unsigned long dep_throttler_status)
+{
+ unsigned long indep_throttler_status = 0;
+
+ __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_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_TDC_HBM_BIT, &indep_throttler_status,
+ test_bit(THROTTLER_TDC_HBM_BIT, &dep_throttler_status));
+ __assign_bit(INDEP_THROTTLER_TEMP_GPU_BIT, &indep_throttler_status,
+ test_bit(THROTTLER_TEMP_GPU_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_SOC_BIT, &indep_throttler_status,
+ test_bit(THROTTLER_TEMP_VR_SOC_BIT, &dep_throttler_status));
+ __assign_bit(INDEP_THROTTLER_TEMP_VR_MEM_BIT, &indep_throttler_status,
+ test_bit(THROTTLER_TEMP_VR_MEM_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 aldebaran_get_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
@@ -591,7 +622,7 @@ static int aldebaran_get_smu_metrics_data(struct smu_context *smu,
SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
break;
case METRICS_THROTTLER_STATUS:
- *value = metrics->ThrottlerStatus;
+ *value = aldebaran_get_indep_throttler_status(metrics->ThrottlerStatus);
break;
default:
*value = UINT_MAX;
@@ -1645,10 +1676,10 @@ static const struct throttling_logging_label {
uint32_t feature_mask;
const char *label;
} logging_label[] = {
- {(1U << THROTTLER_TEMP_MEM_BIT), "HBM"},
- {(1U << THROTTLER_TEMP_VR_GFX_BIT), "VR of GFX rail"},
- {(1U << THROTTLER_TEMP_VR_MEM_BIT), "VR of HBM rail"},
- {(1U << THROTTLER_TEMP_VR_SOC_BIT), "VR of SOC rail"},
+ {(1U << INDEP_THROTTLER_TEMP_MEM_BIT), "HBM"},
+ {(1U << INDEP_THROTTLER_TEMP_VR_GFX_BIT), "VR of GFX rail"},
+ {(1U << INDEP_THROTTLER_TEMP_VR_MEM_BIT), "VR of HBM rail"},
+ {(1U << INDEP_THROTTLER_TEMP_VR_SOC_BIT), "VR of SOC rail"},
};
static void aldebaran_log_thermal_throttling_event(struct smu_context *smu)
{
@@ -1745,7 +1776,8 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
gpu_metrics->current_vclk0 = metrics.CurrClock[PPCLK_VCLK];
gpu_metrics->current_dclk0 = metrics.CurrClock[PPCLK_DCLK];
- gpu_metrics->throttle_status = metrics.ThrottlerStatus;
+ gpu_metrics->throttle_status =
+ aldebaran_get_indep_throttler_status(metrics.ThrottlerStatus);
gpu_metrics->current_fan_speed = 0;
--
2.17.1
More information about the amd-gfx
mailing list