From 86b0dbe18974dbbc6ca62a8c7405529b4616cbfc Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:00:57 +0000 Subject: drm/amd/pm: correct the pcie link state check for SMU13 (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-111-drm-amd-pm-correct-the-pcie-link-state-check-f.patch b/patches.kernel.org/6.2.12-111-drm-amd-pm-correct-the-pcie-link-state-check-f.patch new file mode 100644 index 0000000..696837a --- /dev/null +++ b/patches.kernel.org/6.2.12-111-drm-amd-pm-correct-the-pcie-link-state-check-f.patch @@ -0,0 +1,74 @@ +From: Evan Quan +Date: Fri, 7 Apr 2023 17:12:15 +0800 +Subject: [PATCH] drm/amd/pm: correct the pcie link state check for SMU13 +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: b9a24d8bd51e2db425602fa82d7f4c06aa3db852 + +commit b9a24d8bd51e2db425602fa82d7f4c06aa3db852 upstream. + +Update the driver implementations to fit those data exposed +by PMFW. + +Signed-off-by: Evan Quan +Acked-by: Alex Deucher +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org # 6.1.x +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 6 ++++++ + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 4 ++-- + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 4 ++-- + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +index bffa6247..61210053 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h ++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +@@ -61,6 +61,12 @@ + #define CTF_OFFSET_HOTSPOT 5 + #define CTF_OFFSET_MEM 5 + ++static const int pmfw_decoded_link_speed[5] = {1, 2, 3, 4, 5}; ++static const int pmfw_decoded_link_width[7] = {0, 1, 2, 4, 8, 12, 16}; ++ ++#define DECODE_GEN_SPEED(gen_speed_idx) (pmfw_decoded_link_speed[gen_speed_idx]) ++#define DECODE_LANE_WIDTH(lane_width_idx) (pmfw_decoded_link_width[lane_width_idx]) ++ + struct smu_13_0_max_sustainable_clocks { + uint32_t display_clock; + uint32_t phy_clock; +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +index 508e3925..9431f2cb 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +@@ -1125,8 +1125,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 - 1) == pcie_table->pcie_gen[i]) && +- (lane_width == link_width[pcie_table->pcie_lane[i]]) ? ++ (gen_speed == DECODE_GEN_SPEED(pcie_table->pcie_gen[i])) && ++ (lane_width == DECODE_LANE_WIDTH(link_width[pcie_table->pcie_lane[i]])) ? + "*" : ""); + break; + +diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +index 9e1967d8..8432357e 100644 +--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c ++++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +@@ -1074,8 +1074,8 @@ static int smu_v13_0_7_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 == DECODE_GEN_SPEED(pcie_table->pcie_gen[i])) && ++ (lane_width == DECODE_LANE_WIDTH(pcie_table->pcie_lane[i])) ? + "*" : ""); + break; + +-- +2.35.3 + diff --git a/series.conf b/series.conf index 8dc1241..9a50566 100644 --- a/series.conf +++ b/series.conf @@ -2338,6 +2338,7 @@ patches.kernel.org/6.2.12-108-net-phy-nxp-c45-tja11xx-fix-unsigned-long-mult.patch patches.kernel.org/6.2.12-109-scsi-ses-Handle-enclosure-with-just-a-primary-.patch patches.kernel.org/6.2.12-110-thermal-intel-Avoid-updating-unsupported-THERM.patch + patches.kernel.org/6.2.12-111-drm-amd-pm-correct-the-pcie-link-state-check-f.patch ######################################################## # Build fixes that apply to the vanilla kernel too.