From 3006cbeeaaadd7f73475dd99de096065f973531c Mon Sep 17 00:00:00 2001 From: Asad Kamal Date: Wed, 11 Mar 2026 18:38:30 +0800 Subject: [PATCH] drm/amd/pm: Add mem temp to gpu metrics for smu_v15_0_8 Add mem temp to gpu metrics as maximum hbm stack temperature for smu_v15_0_8 Signed-off-by: Asad Kamal Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher --- .../gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c index 288fab5ee5e5..e62494810b80 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c @@ -1696,17 +1696,23 @@ static ssize_t smu_v15_0_8_get_gpu_metrics(struct smu_context *smu, void **table if (adev->umc.active_mask) { u64 mask = adev->umc.active_mask; int out_idx = 0; + u16 max_hbm_temp = 0; int stack_idx; - if (unlikely(hweight64(mask)/4 > SMU_15_0_8_MAX_HBM_STACKS)) + if (unlikely(hweight64(mask) / 4 > SMU_15_0_8_MAX_HBM_STACKS)) { dev_warn(adev->dev, "Invalid umc mask %lld\n", mask); - else { + } else { for_each_hbm_stack(stack_idx, mask) { + u16 temp; + if (!hbm_stack_mask_valid(mask)) continue; - gpu_metrics->temperature_hbm[out_idx++] = - SMUQ10_ROUND(metrics->HbmTemperature[stack_idx]); + temp = SMUQ10_ROUND(metrics->HbmTemperature[stack_idx]); + gpu_metrics->temperature_hbm[out_idx++] = temp; + if (temp > max_hbm_temp) + max_hbm_temp = temp; } + gpu_metrics->temperature_mem = max_hbm_temp; } }