Perform dependent to independent throttle status translation for navi1x (navi10, navi12). --- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 63 ++++++++++++++++--- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c index 78fe13183e8b..8d216c46d057 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c @@ -524,6 +524,49 @@ static int navi10_tables_init(struct smu_context *smu) return -ENOMEM; } +static uint32_t navi1x_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 navi10_get_legacy_smu_metrics_data(struct smu_context *smu, MetricsMember_t member, uint32_t *value) @@ -601,7 +644,7 @@ static int navi10_get_legacy_smu_metrics_data(struct smu_context *smu, SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; break; case METRICS_THROTTLER_STATUS: - *value = metrics->ThrottlerStatus; + *value = navi1x_get_indep_throttler_status(metrics->ThrottlerStatus); break; case METRICS_CURR_FANSPEED: *value = metrics->CurrFanSpeed; @@ -696,7 +739,7 @@ static int navi10_get_smu_metrics_data(struct smu_context *smu, SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; break; case METRICS_THROTTLER_STATUS: - *value = metrics->ThrottlerStatus; + *value = navi1x_get_indep_throttler_status(metrics->ThrottlerStatus); break; case METRICS_CURR_FANSPEED: *value = metrics->CurrFanSpeed; @@ -788,7 +831,7 @@ static int navi12_get_legacy_smu_metrics_data(struct smu_context *smu, SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; break; case METRICS_THROTTLER_STATUS: - *value = metrics->ThrottlerStatus; + *value = navi1x_get_indep_throttler_status(metrics->ThrottlerStatus); break; case METRICS_CURR_FANSPEED: *value = metrics->CurrFanSpeed; @@ -883,7 +926,7 @@ static int navi12_get_smu_metrics_data(struct smu_context *smu, SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; break; case METRICS_THROTTLER_STATUS: - *value = metrics->ThrottlerStatus; + *value = navi1x_get_indep_throttler_status(metrics->ThrottlerStatus); break; case METRICS_CURR_FANSPEED: *value = metrics->CurrFanSpeed; @@ -2672,7 +2715,8 @@ static ssize_t navi10_get_legacy_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 = + navi1x_get_indep_throttler_status(metrics.ThrottlerStatus); gpu_metrics->current_fan_speed = metrics.CurrFanSpeed; @@ -2749,7 +2793,8 @@ static ssize_t navi10_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 = + navi1x_get_indep_throttler_status(metrics.ThrottlerStatus); gpu_metrics->current_fan_speed = metrics.CurrFanSpeed; @@ -2825,7 +2870,8 @@ static ssize_t navi12_get_legacy_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 = + navi1x_get_indep_throttler_status(metrics.ThrottlerStatus); gpu_metrics->current_fan_speed = metrics.CurrFanSpeed; @@ -2907,7 +2953,8 @@ static ssize_t navi12_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 = + navi1x_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