drm/amd/pm: correct the check for current link status
authorEvan Quan <evan.quan@amd.com>
Wed, 27 Apr 2022 15:16:50 +0000 (23:16 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 10 May 2022 21:53:10 +0000 (17:53 -0400)
The output from metrics table for current link status changed.
We need to update our driver accordingly.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

index e3d3cf4..3fd0ab9 100644 (file)
@@ -886,6 +886,7 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
        struct smu_13_0_dpm_context *dpm_context = smu_dpm->dpm_context;
        struct smu_13_0_dpm_table *single_dpm_table;
        struct smu_13_0_pcie_table *pcie_table;
+       const int link_width[] = {0, 1, 2, 4, 8, 12, 16};
        uint32_t gen_speed, lane_width;
        int i, curr_freq, size = 0;
        int ret = 0;
@@ -999,8 +1000,8 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
                                        (pcie_table->pcie_lane[i] == 5) ? "x12" :
                                        (pcie_table->pcie_lane[i] == 6) ? "x16" : "",
                                        pcie_table->clk_freq[i],
-                                       (gen_speed == pcie_table->pcie_gen[i]) &&
-                                       (lane_width == pcie_table->pcie_lane[i]) ?
+                                       ((gen_speed - 1) == pcie_table->pcie_gen[i]) &&
+                                       (lane_width == link_width[pcie_table->pcie_lane[i]]) ?
                                        "*" : "");
                break;