drm/amd/pm: avoid driver getting empty metrics table for the first time
add metrics.AccumulationCouter check to avoid driver getting an empty metrics data since metrics table not updated completely in pmfw side. Signed-off-by: Yang Wang <KevinYang.Wang@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Tested-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@ -325,14 +325,24 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu)
|
|||||||
MetricsTable_t *metrics = (MetricsTable_t *)smu_table->metrics_table;
|
MetricsTable_t *metrics = (MetricsTable_t *)smu_table->metrics_table;
|
||||||
struct PPTable_t *pptable =
|
struct PPTable_t *pptable =
|
||||||
(struct PPTable_t *)smu_table->driver_pptable;
|
(struct PPTable_t *)smu_table->driver_pptable;
|
||||||
int ret;
|
int ret, i, retry = 100;
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Store one-time values in driver PPTable */
|
/* Store one-time values in driver PPTable */
|
||||||
if (!pptable->Init) {
|
if (!pptable->Init) {
|
||||||
ret = smu_v13_0_6_get_metrics_table(smu, NULL, false);
|
while (retry--) {
|
||||||
if (ret)
|
ret = smu_v13_0_6_get_metrics_table(smu, NULL, true);
|
||||||
return ret;
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Ensure that metrics have been updated */
|
||||||
|
if (metrics->AccumulationCounter)
|
||||||
|
break;
|
||||||
|
|
||||||
|
usleep_range(1000, 1100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!retry)
|
||||||
|
return -ETIME;
|
||||||
|
|
||||||
pptable->MaxSocketPowerLimit =
|
pptable->MaxSocketPowerLimit =
|
||||||
SMUQ10_TO_UINT(metrics->MaxSocketPowerLimit);
|
SMUQ10_TO_UINT(metrics->MaxSocketPowerLimit);
|
||||||
|
Reference in New Issue
Block a user