aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>2019-02-05 14:05:11 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-02-07 14:03:18 -0500
commit9d18c131ee67d005ffe7e9d2ac192b4218ba6476 (patch)
tree80b8a8f01a22eb9b5c49d9e7fef54fb430b2f1a5 /drivers/gpu/drm
parentc53134577c185533ca7e0b958bafc77539d41fd9 (diff)
drm/amd/powerplay: add override pcie parameters for Vega20 (v2)
v2: Fix SMU message format Send override message after SMU enable features Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index da022ca79b56..0769b1ec562b 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -771,40 +771,47 @@ static int vega20_init_smc_table(struct pp_hwmgr *hwmgr)
771 return 0; 771 return 0;
772} 772}
773 773
774/*
775 * Override PCIe link speed and link width for DPM Level 1. PPTable entries
776 * reflect the ASIC capabilities and not the system capabilities. For e.g.
777 * Vega20 board in a PCI Gen3 system. In this case, when SMU's tries to switch
778 * to DPM1, it fails as system doesn't support Gen4.
779 */
774static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) 780static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr)
775{ 781{
776 struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev); 782 struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
777 uint32_t pcie_speed = 0, pcie_width = 0, pcie_arg; 783 uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg;
778 int ret; 784 int ret;
779 785
780 if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4) 786 if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
781 pcie_speed = 16; 787 pcie_gen = 3;
782 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) 788 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
783 pcie_speed = 8; 789 pcie_gen = 2;
784 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2) 790 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
785 pcie_speed = 5; 791 pcie_gen = 1;
786 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1) 792 else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)
787 pcie_speed = 2; 793 pcie_gen = 0;
788 794
789 if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X32) 795 if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
790 pcie_width = 32; 796 pcie_width = 6;
791 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
792 pcie_width = 16;
793 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12) 797 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)
794 pcie_width = 12; 798 pcie_width = 5;
795 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8) 799 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)
796 pcie_width = 8;
797 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
798 pcie_width = 4; 800 pcie_width = 4;
801 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
802 pcie_width = 3;
799 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2) 803 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)
800 pcie_width = 2; 804 pcie_width = 2;
801 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1) 805 else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)
802 pcie_width = 1; 806 pcie_width = 1;
803 807
804 pcie_arg = pcie_width | (pcie_speed << 8); 808 /* Bit 31:16: LCLK DPM level. 0 is DPM0, and 1 is DPM1
805 809 * Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4
810 * Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32
811 */
812 smu_pcie_arg = (1 << 16) | (pcie_gen << 8) | pcie_width;
806 ret = smum_send_msg_to_smc_with_parameter(hwmgr, 813 ret = smum_send_msg_to_smc_with_parameter(hwmgr,
807 PPSMC_MSG_OverridePcieParameters, pcie_arg); 814 PPSMC_MSG_OverridePcieParameters, smu_pcie_arg);
808 PP_ASSERT_WITH_CODE(!ret, 815 PP_ASSERT_WITH_CODE(!ret,
809 "[OverridePcieParameters] Attempt to override pcie params failed!", 816 "[OverridePcieParameters] Attempt to override pcie params failed!",
810 return ret); 817 return ret);
@@ -1611,11 +1618,6 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
1611 "[EnableDPMTasks] Failed to initialize SMC table!", 1618 "[EnableDPMTasks] Failed to initialize SMC table!",
1612 return result); 1619 return result);
1613 1620
1614 result = vega20_override_pcie_parameters(hwmgr);
1615 PP_ASSERT_WITH_CODE(!result,
1616 "[EnableDPMTasks] Failed to override pcie parameters!",
1617 return result);
1618
1619 result = vega20_run_btc(hwmgr); 1621 result = vega20_run_btc(hwmgr);
1620 PP_ASSERT_WITH_CODE(!result, 1622 PP_ASSERT_WITH_CODE(!result,
1621 "[EnableDPMTasks] Failed to run btc!", 1623 "[EnableDPMTasks] Failed to run btc!",
@@ -1631,6 +1633,11 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
1631 "[EnableDPMTasks] Failed to enable all smu features!", 1633 "[EnableDPMTasks] Failed to enable all smu features!",
1632 return result); 1634 return result);
1633 1635
1636 result = vega20_override_pcie_parameters(hwmgr);
1637 PP_ASSERT_WITH_CODE(!result,
1638 "[EnableDPMTasks] Failed to override pcie parameters!",
1639 return result);
1640
1634 result = vega20_notify_smc_display_change(hwmgr); 1641 result = vega20_notify_smc_display_change(hwmgr);
1635 PP_ASSERT_WITH_CODE(!result, 1642 PP_ASSERT_WITH_CODE(!result,
1636 "[EnableDPMTasks] Failed to notify smc display change!", 1643 "[EnableDPMTasks] Failed to notify smc display change!",