[AMD Official Use Only] Hi Graham, This patch series looks good. Please add "Signed-off-by" to all the commit messages. One additional comment inline below. -----Original Message----- From: Sider, Graham <Graham.Sider@xxxxxxx> Sent: Thursday, May 20, 2021 10:29 AM To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx Cc: Kasiviswanathan, Harish <Harish.Kasiviswanathan@xxxxxxx>; Sakhnovitch, Elena (Elen) <Elena.Sakhnovitch@xxxxxxx>; Sider, Graham <Graham.Sider@xxxxxxx> Subject: [PATCH 2/6] drm/amd/pm: Add arcturus throttler translation Perform dependent to independent throttle status translation for arcturus. --- .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 62 ++++++++++++++++--- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c index 1735a96dd307..7c01c0bf2073 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c @@ -540,6 +540,49 @@ static int arcturus_freqs_in_same_level(int32_t frequency1, return (abs(frequency1 - frequency2) <= EPSILON); } +static uint32_t arcturus_get_indep_throttler_status( + unsigned long dep_throttler_status) +{ + unsigned long indep_throttler_status = 0; + [HK] You can a simple optimization here. During most of the time throttler_status would be 0. So if (dep_throttler_status == 0) you could just return here. You can add this to other commits too. + __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_MEM_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_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_PPM_BIT, &indep_throttler_status, + test_bit(THROTTLER_PPM_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_APCC_BIT, &indep_throttler_status, + test_bit(THROTTLER_APCC_BIT, &dep_throttler_status)); + __assign_bit(INDEP_THROTTLER_VRHOT0_BIT, &indep_throttler_status, + test_bit(THROTTLER_VRHOT0_BIT, &dep_throttler_status)); + __assign_bit(INDEP_THROTTLER_VRHOT1_BIT, &indep_throttler_status, + test_bit(THROTTLER_VRHOT1_BIT, &dep_throttler_status)); + + return (uint32_t)indep_throttler_status; +} + static int arcturus_get_smu_metrics_data(struct smu_context *smu, MetricsMember_t member, uint32_t *value) @@ -629,7 +672,7 @@ static int arcturus_get_smu_metrics_data(struct smu_context *smu, SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; break; case METRICS_THROTTLER_STATUS: - *value = metrics->ThrottlerStatus; + *value = arcturus_get_indep_throttler_status(metrics->ThrottlerStatus); break; case METRICS_CURR_FANSPEED: *value = metrics->CurrFanSpeed; @@ -2213,13 +2256,13 @@ static const struct throttling_logging_label { uint32_t feature_mask; const char *label; } logging_label[] = { - {(1U << THROTTLER_TEMP_HOTSPOT_BIT), "GPU"}, - {(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 << THROTTLER_VRHOT0_BIT), "VR0 HOT"}, - {(1U << THROTTLER_VRHOT1_BIT), "VR1 HOT"}, + {(1U << INDEP_THROTTLER_TEMP_HOTSPOT_BIT), "GPU"}, + {(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"}, + {(1U << INDEP_THROTTLER_VRHOT0_BIT), "VR0 HOT"}, + {(1U << INDEP_THROTTLER_VRHOT1_BIT), "VR1 HOT"}, }; static void arcturus_log_thermal_throttling_event(struct smu_context *smu) { @@ -2314,7 +2357,8 @@ static ssize_t arcturus_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 = + arcturus_get_indep_throttler_status(metrics.ThrottlerStatus); gpu_metrics->current_fan_speed = metrics.CurrFanSpeed; -- 2.17.1 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx