Skip to content

Commit f71cee9

Browse files
Asad Kamalalexdeucher
authored andcommitted
drm/amd/pm: Use gpu_metrics_v1_5 for SMUv13.0.6
Use gpu_metrics_v1_5 for SMUv13.0.6 to fill gpu metric info Signed-off-by: Asad Kamal <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Reviewed-by: Le Ma <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 43d7e8b commit f71cee9

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static int smu_v13_0_6_tables_init(struct smu_context *smu)
344344
return -ENOMEM;
345345
smu_table->metrics_time = 0;
346346

347-
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_4);
347+
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_5);
348348
smu_table->gpu_metrics_table =
349349
kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
350350
if (!smu_table->gpu_metrics_table) {
@@ -2029,10 +2029,10 @@ static int smu_v13_0_6_get_current_pcie_link_speed(struct smu_context *smu)
20292029
static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table)
20302030
{
20312031
struct smu_table_context *smu_table = &smu->smu_table;
2032-
struct gpu_metrics_v1_4 *gpu_metrics =
2033-
(struct gpu_metrics_v1_4 *)smu_table->gpu_metrics_table;
2032+
struct gpu_metrics_v1_5 *gpu_metrics =
2033+
(struct gpu_metrics_v1_5 *)smu_table->gpu_metrics_table;
20342034
struct amdgpu_device *adev = smu->adev;
2035-
int ret = 0, xcc_id, inst, i;
2035+
int ret = 0, xcc_id, inst, i, j;
20362036
MetricsTableX_t *metrics_x;
20372037
MetricsTableA_t *metrics_a;
20382038
u16 link_width_level;
@@ -2046,7 +2046,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
20462046

20472047
metrics_a = (MetricsTableA_t *)metrics_x;
20482048

2049-
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 4);
2049+
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 5);
20502050

20512051
gpu_metrics->temperature_hotspot =
20522052
SMUQ10_ROUND(GET_METRIC_FIELD(MaxSocketTemperature));
@@ -2113,6 +2113,10 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
21132113
metrics_x->PCIenReplayAAcc;
21142114
gpu_metrics->pcie_replay_rover_count_acc =
21152115
metrics_x->PCIenReplayARolloverCountAcc;
2116+
gpu_metrics->pcie_nak_sent_count_acc =
2117+
metrics_x->PCIeNAKSentCountAcc;
2118+
gpu_metrics->pcie_nak_rcvd_count_acc =
2119+
metrics_x->PCIeNAKReceivedCountAcc;
21162120
}
21172121

21182122
gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
@@ -2129,6 +2133,21 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
21292133
SMUQ10_ROUND(GET_METRIC_FIELD(XgmiWriteDataSizeAcc)[i]);
21302134
}
21312135

2136+
for (i = 0; i < adev->jpeg.num_jpeg_inst; ++i) {
2137+
inst = GET_INST(JPEG, i);
2138+
for (j = 0; j < adev->jpeg.num_jpeg_rings; ++j) {
2139+
gpu_metrics->jpeg_activity[(i * adev->jpeg.num_jpeg_rings) + j] =
2140+
SMUQ10_ROUND(GET_METRIC_FIELD(JpegBusy)
2141+
[(inst * adev->jpeg.num_jpeg_rings) + j]);
2142+
}
2143+
}
2144+
2145+
for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
2146+
inst = GET_INST(VCN, i);
2147+
gpu_metrics->vcn_activity[i] =
2148+
SMUQ10_ROUND(GET_METRIC_FIELD(VcnBusy)[inst]);
2149+
}
2150+
21322151
gpu_metrics->xgmi_link_width = SMUQ10_ROUND(GET_METRIC_FIELD(XgmiWidth));
21332152
gpu_metrics->xgmi_link_speed = SMUQ10_ROUND(GET_METRIC_FIELD(XgmiBitrate));
21342153

0 commit comments

Comments
 (0)