Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Pratik Vishwakarma and committed by
Alex Deucher
a0562828 ce1598f0

+32 -2
+32 -2
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_0_ppt.c
··· 246 246 return ret; 247 247 } 248 248 249 + static int smu_v15_0_0_get_metrics_table(struct smu_context *smu, 250 + void *metrics_table, 251 + bool bypass_cache) 252 + { 253 + struct smu_table_context *smu_table = &smu->smu_table; 254 + uint32_t table_size = 255 + smu_table->tables[SMU_TABLE_SMU_METRICS].size; 256 + int ret; 257 + 258 + if (bypass_cache || 259 + !smu_table->metrics_time || 260 + time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(1))) { 261 + ret = smu_v15_0_0_update_table(smu, 262 + SMU_TABLE_SMU_METRICS, 263 + 0, 264 + smu_table->metrics_table, 265 + false); 266 + if (ret) { 267 + dev_info(smu->adev->dev, "Failed to export SMU15_0_0 metrics table!\n"); 268 + return ret; 269 + } 270 + smu_table->metrics_time = jiffies; 271 + } 272 + 273 + if (metrics_table) 274 + memcpy(metrics_table, smu_table->metrics_table, table_size); 275 + 276 + return 0; 277 + } 278 + 249 279 static int smu_v15_0_0_get_smu_metrics_data(struct smu_context *smu, 250 280 MetricsMember_t member, 251 281 uint32_t *value) ··· 285 255 SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table; 286 256 int ret = 0; 287 257 288 - ret = smu_cmn_get_metrics_table(smu, NULL, false); 258 + ret = smu_v15_0_0_get_metrics_table(smu, NULL, false); 289 259 if (ret) 290 260 return ret; 291 261 ··· 560 530 SmuMetrics_t metrics; 561 531 int ret = 0; 562 532 563 - ret = smu_cmn_get_metrics_table(smu, &metrics, true); 533 + ret = smu_v15_0_0_get_metrics_table(smu, &metrics, false); 564 534 if (ret) 565 535 return ret; 566 536