mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
drm/admgpu: Update metrics_table for SMU15
Use multi param based get op for metrics_table Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
ce1598f018
commit
a0562828d1
|
|
@ -246,6 +246,36 @@ static int smu_v15_0_0_system_features_control(struct smu_context *smu, bool en)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int smu_v15_0_0_get_metrics_table(struct smu_context *smu,
|
||||
void *metrics_table,
|
||||
bool bypass_cache)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
uint32_t table_size =
|
||||
smu_table->tables[SMU_TABLE_SMU_METRICS].size;
|
||||
int ret;
|
||||
|
||||
if (bypass_cache ||
|
||||
!smu_table->metrics_time ||
|
||||
time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(1))) {
|
||||
ret = smu_v15_0_0_update_table(smu,
|
||||
SMU_TABLE_SMU_METRICS,
|
||||
0,
|
||||
smu_table->metrics_table,
|
||||
false);
|
||||
if (ret) {
|
||||
dev_info(smu->adev->dev, "Failed to export SMU15_0_0 metrics table!\n");
|
||||
return ret;
|
||||
}
|
||||
smu_table->metrics_time = jiffies;
|
||||
}
|
||||
|
||||
if (metrics_table)
|
||||
memcpy(metrics_table, smu_table->metrics_table, table_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu,
|
||||
MetricsMember_t member,
|
||||
uint32_t *value)
|
||||
|
|
@ -255,7 +285,7 @@ static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu,
|
|||
SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;
|
||||
int ret = 0;
|
||||
|
||||
ret = smu_cmn_get_metrics_table(smu, NULL, false);
|
||||
ret = smu_v15_0_0_get_metrics_table(smu, NULL, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -530,7 +560,7 @@ static ssize_t smu_v15_0_0_get_gpu_metrics(struct smu_context *smu,
|
|||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
ret = smu_cmn_get_metrics_table(smu, &metrics, true);
|
||||
ret = smu_v15_0_0_get_metrics_table(smu, &metrics, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user