Perform dependent to independent throttle status translation for sienna cichlid.
Signed-off-by: Graham Sider <graham.si...@amd.com> --- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 60 +++++++++++++++++-- 1 file changed, 55 insertions(+), 5 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..21c2fa4af64e 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 @@ -434,7 +434,7 @@ static int sienna_cichlid_tables_init(struct smu_context *smu) goto err0_out; smu_table->metrics_time = 0; - smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_1); + smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_3); smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL); if (!smu_table->gpu_metrics_table) goto err1_out; @@ -453,6 +453,54 @@ static int sienna_cichlid_tables_init(struct smu_context *smu) return -ENOMEM; } +static uint64_t sienna_cichlid_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_TEMP_EDGE_BIT, THROTTLER_TEMP_EDGE_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_HOTSPOT_BIT, THROTTLER_TEMP_HOTSPOT_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_MEM_BIT, THROTTLER_TEMP_MEM_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_VR_GFX_BIT, THROTTLER_TEMP_VR_GFX_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_VR_MEM_BIT, THROTTLER_TEMP_VR_MEM0_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_VR_MEM_BIT, THROTTLER_TEMP_VR_MEM1_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_VR_SOC_BIT, THROTTLER_TEMP_VR_SOC_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_LIQUID_BIT, THROTTLER_TEMP_LIQUID0_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TEMP_LIQUID_BIT, THROTTLER_TEMP_LIQUID1_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TDC_GFX_BIT, THROTTLER_TDC_GFX_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_TDC_SOC_BIT, THROTTLER_TDC_SOC_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_PPT0_BIT, THROTTLER_PPT0_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_PPT1_BIT, THROTTLER_PPT1_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_PPT2_BIT, THROTTLER_PPT2_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_PPT3_BIT, THROTTLER_PPT3_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_FIT_BIT, THROTTLER_FIT_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_PPM_BIT, THROTTLER_PPM_BIT); + indep_status |= smu_u64_throttler_bit(dep_status, + SMU_THROTTLER_APCC_BIT, THROTTLER_APCC_BIT); + + return indep_status; +} + static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu, MetricsMember_t member, uint32_t *value) @@ -3617,8 +3665,8 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, void **table) { struct smu_table_context *smu_table = &smu->smu_table; - struct gpu_metrics_v1_1 *gpu_metrics = - (struct gpu_metrics_v1_1 *)smu_table->gpu_metrics_table; + struct gpu_metrics_v1_3 *gpu_metrics = + (struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table; SmuMetricsExternal_t metrics_external; SmuMetrics_t *metrics = &(metrics_external.SmuMetrics); @@ -3632,7 +3680,7 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, if (ret) return ret; - smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 1); + smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3); gpu_metrics->temperature_edge = metrics->TemperatureEdge; gpu_metrics->temperature_hotspot = metrics->TemperatureHotspot; @@ -3667,6 +3715,8 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, gpu_metrics->current_dclk1 = metrics->CurrClock[PPCLK_DCLK_1]; gpu_metrics->throttle_status = metrics->ThrottlerStatus; + gpu_metrics->indep_throttle_status = + sienna_cichlid_get_indep_throttler_status(metrics->ThrottlerStatus); gpu_metrics->current_fan_speed = metrics->CurrFanSpeed; @@ -3689,7 +3739,7 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, *table = (void *)gpu_metrics; - return sizeof(struct gpu_metrics_v1_1); + return sizeof(struct gpu_metrics_v1_3); } static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu) -- 2.17.1 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx