drm/amd: Disable PP_PCIE_DPM_MASK when dynamic speed switching not supported
Subsystems (3)
PATCH 1/3 drm/amd: Disable PP_PCIE_DPM_MASK when dynamic speed switching not supported
Rather than individual ASICs checking for the quirk, set the quirk at the driver level.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 4 +--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -2315,6 +2315,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) adev->pm.pp_feature &= ~PP_GFXOFF_MASK ;if (amdgpu_sriov_vf (adev) && adev->asic_type ==CHIP_SIENNA_CICHLID ) adev->pm.pp_feature &= ~PP_OVERDRIVE_MASK ; +if (!amdgpu_device_pcie_dynamic_switching_supported ()) + adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK ; total = true;for (i =0 ; i < adev->num_ip_blocks; i++) {
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +1 -3
@@ -1823,9 +1823,7 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) data->mclk_dpm_key_disabled = hwmgr->feature_mask &PP_MCLK_DPM_MASK ? false : true; data->sclk_dpm_key_disabled = hwmgr->feature_mask &PP_SCLK_DPM_MASK ? false : true; - data->pcie_dpm_key_disabled = - !amdgpu_device_pcie_dynamic_switching_supported () || - !(hwmgr->feature_mask &PP_PCIE_DPM_MASK ); + data->pcie_dpm_key_disabled = !(hwmgr->feature_mask &PP_PCIE_DPM_MASK );/* need to set voltage control types before EVV patching */ data->voltage_control =SMU7_VOLTAGE_CONTROL_NONE ; data->vddci_control =SMU7_VOLTAGE_CONTROL_NONE ;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -1
@@ -2115,7 +2115,7 @@ static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, min_lane_width = min_lane_width > max_lane_width ? max_lane_width : min_lane_width; -if (!amdgpu_device_pcie_dynamic_switching_supported ()) { +if (!(smu->adev->pm.pp_feature &PP_PCIE_DPM_MASK )) { pcie_table->pcie_gen[0 ] = max_gen_speed; pcie_table->pcie_lane[0 ] = max_lane_width; }else {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -1
@@ -2437,7 +2437,7 @@ int smu_v13_0_update_pcie_parameters(struct smu_context *smu,uint32_t smu_pcie_arg;int ret, i; -if (!amdgpu_device_pcie_dynamic_switching_supported ()) { +if (!(smu->adev->pm.pp_feature &PP_PCIE_DPM_MASK )) {if (pcie_table->pcie_gen[num_of_levels -1 ] < pcie_gen_cap) pcie_gen_cap = pcie_table->pcie_gen[num_of_levels -1 ];
Signature · 1 line
2.34.1
PATCH 2/3 drm/amd: Move AMD_IS_APU check for ASPM into top level function
There is no need for every ASIC driver to perform the same check. Move the duplicated code into amdgpu_device_should_use_aspm().
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++ drivers/gpu/drm/amd/amdgpu/cik.c | 4 ---- drivers/gpu/drm/amd/amdgpu/nv.c | 3 +-- drivers/gpu/drm/amd/amdgpu/si.c | 2 -- drivers/gpu/drm/amd/amdgpu/soc15.c | 3 +-- drivers/gpu/drm/amd/amdgpu/soc21.c | 3 +-- drivers/gpu/drm/amd/amdgpu/vi.c | 3 +-- 7 files changed, 6 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
@@ -1496,6 +1496,8 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)default :return false; } +if (adev->flags &AMD_IS_APU ) +return false;return pcie_aspm_enabled (adev->pdev); }
drivers/gpu/drm/amd/amdgpu/cik.c +0 -4
@@ -1725,10 +1725,6 @@ static void cik_program_aspm(struct amdgpu_device *adev)if (pci_is_root_bus (adev->pdev->bus))return ; -/* XXX double check APUs */ -if (adev->flags &AMD_IS_APU ) -return ; - orig = data =RREG32_PCIE (ixPCIE_LC_N_FTS_CNTL); data &= ~PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS_MASK ; data |= (0x24 << PCIE_LC_N_FTS_CNTL__LC_XMIT_N_FTS__SHIFT) |
drivers/gpu/drm/amd/amdgpu/nv.c +1 -2
@@ -516,8 +516,7 @@ static void nv_program_aspm(struct amdgpu_device *adev)if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_aspm_support_quirk ())return ; -if (!(adev->flags &AMD_IS_APU ) && - (adev->nbio.funcs->program_aspm)) +if (adev->nbio.funcs->program_aspm) adev->nbio.funcs->program_aspm (adev); }
drivers/gpu/drm/amd/amdgpu/si.c +0 -2
@@ -2456,8 +2456,6 @@ static void si_program_aspm(struct amdgpu_device *adev)if (!amdgpu_device_should_use_aspm (adev))return ; -if (adev->flags &AMD_IS_APU ) -return ; orig = data =RREG32_PCIE_PORT (PCIE_LC_N_FTS_CNTL ); data &= ~LC_XMIT_N_FTS_MASK ; data |=LC_XMIT_N_FTS (0x24 ) |LC_XMIT_N_FTS_OVERRIDE_EN ;
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -2
@@ -646,8 +646,7 @@ static void soc15_program_aspm(struct amdgpu_device *adev)if (!amdgpu_device_should_use_aspm (adev))return ; -if (!(adev->flags &AMD_IS_APU ) && - (adev->nbio.funcs->program_aspm)) +if (adev->nbio.funcs->program_aspm) adev->nbio.funcs->program_aspm (adev); }
drivers/gpu/drm/amd/amdgpu/soc21.c +1 -2
@@ -433,8 +433,7 @@ static void soc21_program_aspm(struct amdgpu_device *adev)if (!amdgpu_device_should_use_aspm (adev))return ; -if (!(adev->flags &AMD_IS_APU ) && - (adev->nbio.funcs->program_aspm)) +if (adev->nbio.funcs->program_aspm) adev->nbio.funcs->program_aspm (adev); }
drivers/gpu/drm/amd/amdgpu/vi.c +1 -2
@@ -1127,8 +1127,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_pcie_dynamic_switching_supported ())return ; -if (adev->flags &AMD_IS_APU || - adev->asic_type <CHIP_POLARIS10 ) +if (adev->asic_type <CHIP_POLARIS10 )return ; orig = data =RREG32_PCIE (ixPCIE_LC_CNTL);
Signature · 1 line
2.34.1
PATCH 3/3 drm/amd: Explicitly disable ASPM when dynamic switching disabled
In reply to Mario LimoncielloCurrently there are separate but related checks:
* amdgpu_device_should_use_aspm()
* amdgpu_device_aspm_support_quirk()
* amdgpu_device_pcie_dynamic_switching_supported()
Simplify into checking whether DPM was enabled or not in the auto case. This works because amdgpu_device_pcie_dynamic_switching_supported() populates that value.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 ++++++--------------- drivers/gpu/drm/amd/amdgpu/nv.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
@@ -1339,9 +1339,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);int amdgpu_device_pci_reset (struct amdgpu_device *adev);bool amdgpu_device_need_post (struct amdgpu_device *adev);bool amdgpu_device_seamless_boot_supported (struct amdgpu_device *adev); -bool amdgpu_device_pcie_dynamic_switching_supported (void );bool amdgpu_device_should_use_aspm (struct amdgpu_device *adev); -bool amdgpu_device_aspm_support_quirk (void );void amdgpu_cs_report_moved_bytes (struct amdgpu_device *adev,u64 num_bytes,u64 num_vis_bytes);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -15
@@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev) }/* -* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic -* speed switching. Until we have confirmation from Intel that a specific host -* supports it, it's safer that we keep it disabled for all. +* Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids +* don't support dynamic speed switching. Until we have confirmation from Intel +* that a specific host supports it, it's safer that we keep it disabled for all. * * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/ * https://gitlab.freedesktop.org/drm/amd/-/issues/2663 */ -bool amdgpu_device_pcie_dynamic_switching_supported (void ) +static bool amdgpu_device_pcie_dynamic_switching_supported (void ) {#if IS_ENABLED (CONFIG_X86 )struct cpuinfo_x86 *c = &cpu_data (0 );
@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev) }if (adev->flags &AMD_IS_APU )return false; +if (!(adev->pm.pp_feature &PP_PCIE_DPM_MASK )) +return false;return pcie_aspm_enabled (adev->pdev); } -bool amdgpu_device_aspm_support_quirk (void ) -{ -#if IS_ENABLED (CONFIG_X86 ) -struct cpuinfo_x86 *c = &cpu_data (0 ); - -return !(c->x86 ==6 && c->x86_model ==INTEL_FAM6_ALDERLAKE ); -#else -return true; -#endif -} -/* if we get transitioned to only one device, take VGA back */ /** * amdgpu_device_vga_set_decode - enable/disable vga decode
drivers/gpu/drm/amd/amdgpu/nv.c +3 -4
@@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)static void nv_program_aspm (struct amdgpu_device *adev) { -if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_aspm_support_quirk ()) +if (!amdgpu_device_should_use_aspm (adev))return ;if (adev->nbio.funcs->program_aspm)
@@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,if (adev->gfx.funcs->update_perfmon_mgcg) adev->gfx.funcs->update_perfmon_mgcg (adev, !enter); -if (!(adev->flags &AMD_IS_APU ) && - (adev->nbio.funcs->enable_aspm) && -amdgpu_device_should_use_aspm (adev)) +if (adev->nbio.funcs->enable_aspm && +amdgpu_device_should_use_aspm (adev)) adev->nbio.funcs->enable_aspm (adev, !enter);return 0 ;
drivers/gpu/drm/amd/amdgpu/vi.c +1 -1
@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)bool bL1SS = false;bool bClkReqSupport = true; -if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_pcie_dynamic_switching_supported ()) +if (!amdgpu_device_should_use_aspm (adev))return ;if (adev->asic_type <CHIP_POLARIS10 )
Signature · 1 line
2.34.1
Re: [PATCH 3/3] drm/amd: Explicitly disable ASPM when dynamic switching disabled
Quoted 11 lines · Mario Limonciello
Currently there are separate but related checks:
*amdgpu_device_should_use_aspm()
*amdgpu_device_aspm_support_quirk()
*amdgpu_device_pcie_dynamic_switching_supported()Simplify into checking whether DPM was enabled or not in the auto case. This works because
amdgpu_device_pcie_dynamic_switching_supported()populates that value.Signed-off-by Mario Limonciello <[email protected]>
Series is:
Quoted 108 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 ++++++--------------- drivers/gpu/drm/amd/amdgpu/nv.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/vi.c | 2 +- 4 files changed, 10 insertions(+), 22 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-2@@ -1339,9 +1339,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);int amdgpu_device_pci_reset (struct amdgpu_device *adev);bool amdgpu_device_need_post (struct amdgpu_device *adev);bool amdgpu_device_seamless_boot_supported (struct amdgpu_device *adev); -bool amdgpu_device_pcie_dynamic_switching_supported (void );bool amdgpu_device_should_use_aspm (struct amdgpu_device *adev); -bool amdgpu_device_aspm_support_quirk (void );void amdgpu_cs_report_moved_bytes (struct amdgpu_device *adev,u64 num_bytes,u64 num_vis_bytes);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-15@@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev) }/* -* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic -* speed switching. Until we have confirmation from Intel that a specific host -* supports it, it's safer that we keep it disabled for all. +* Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids +* don't support dynamic speed switching. Until we have confirmation from Intel +* that a specific host supports it, it's safer that we keep it disabled for all. * * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/ * https://gitlab.freedesktop.org/drm/amd/-/issues/2663 */ -bool amdgpu_device_pcie_dynamic_switching_supported (void ) +static bool amdgpu_device_pcie_dynamic_switching_supported (void ) {#if IS_ENABLED (CONFIG_X86 )struct cpuinfo_x86 *c = &cpu_data (0 );@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev) }if (adev->flags &AMD_IS_APU )return false; +if (!(adev->pm.pp_feature &PP_PCIE_DPM_MASK )) +return false;return pcie_aspm_enabled (adev->pdev); } -bool amdgpu_device_aspm_support_quirk (void ) -{ -#if IS_ENABLED (CONFIG_X86 ) -struct cpuinfo_x86 *c = &cpu_data (0 ); - -return !(c->x86 ==6 && c->x86_model ==INTEL_FAM6_ALDERLAKE ); -#else -return true; -#endif -} -/* if we get transitioned to only one device, take VGA back */ /** * amdgpu_device_vga_set_decode - enable/disable vga decode drivers/gpu/drm/amd/amdgpu/nv.c +3
-4@@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)static void nv_program_aspm (struct amdgpu_device *adev) { -if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_aspm_support_quirk ()) +if (!amdgpu_device_should_use_aspm (adev))return ;if (adev->nbio.funcs->program_aspm)@@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,if (adev->gfx.funcs->update_perfmon_mgcg) adev->gfx.funcs->update_perfmon_mgcg (adev, !enter); -if (!(adev->flags &AMD_IS_APU ) && - (adev->nbio.funcs->enable_aspm) && -amdgpu_device_should_use_aspm (adev)) +if (adev->nbio.funcs->enable_aspm && +amdgpu_device_should_use_aspm (adev)) adev->nbio.funcs->enable_aspm (adev, !enter);return 0 ;drivers/gpu/drm/amd/amdgpu/vi.c +1
-2@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)bool bL1SS = false;bool bClkReqSupport = true; -if (!amdgpu_device_should_use_aspm (adev) || !amdgpu_device_pcie_dynamic_switching_supported ()) +if (!amdgpu_device_should_use_aspm (adev))return ;if (adev->asic_type <CHIP_POLARIS10 ) --2.34.1