Commit 2757a848 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher

drm/amd: Explicitly disable ASPM when dynamic switching disabled

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: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1a6513de
...@@ -1340,9 +1340,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev); ...@@ -1340,9 +1340,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
int amdgpu_device_pci_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_need_post(struct amdgpu_device *adev);
bool amdgpu_device_seamless_boot_supported(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_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, void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
u64 num_vis_bytes); u64 num_vis_bytes);
......
...@@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev) ...@@ -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 * Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids
* speed switching. Until we have confirmation from Intel that a specific host * don't support dynamic speed switching. Until we have confirmation from Intel
* supports it, it's safer that we keep it disabled for all. * 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://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 * 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) #if IS_ENABLED(CONFIG_X86)
struct cpuinfo_x86 *c = &cpu_data(0); struct cpuinfo_x86 *c = &cpu_data(0);
...@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev) ...@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
} }
if (adev->flags & AMD_IS_APU) if (adev->flags & AMD_IS_APU)
return false; return false;
if (!(adev->pm.pp_feature & PP_PCIE_DPM_MASK))
return false;
return pcie_aspm_enabled(adev->pdev); 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 */ /* if we get transitioned to only one device, take VGA back */
/** /**
* amdgpu_device_vga_set_decode - enable/disable vga decode * amdgpu_device_vga_set_decode - enable/disable vga decode
......
...@@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk) ...@@ -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) 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; return;
if (adev->nbio.funcs->program_aspm) if (adev->nbio.funcs->program_aspm)
...@@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev, ...@@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,
if (adev->gfx.funcs->update_perfmon_mgcg) if (adev->gfx.funcs->update_perfmon_mgcg)
adev->gfx.funcs->update_perfmon_mgcg(adev, !enter); adev->gfx.funcs->update_perfmon_mgcg(adev, !enter);
if (!(adev->flags & AMD_IS_APU) && if (adev->nbio.funcs->enable_aspm &&
(adev->nbio.funcs->enable_aspm) && amdgpu_device_should_use_aspm(adev))
amdgpu_device_should_use_aspm(adev))
adev->nbio.funcs->enable_aspm(adev, !enter); adev->nbio.funcs->enable_aspm(adev, !enter);
return 0; return 0;
......
...@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev) ...@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
bool bL1SS = false; bool bL1SS = false;
bool bClkReqSupport = true; bool bClkReqSupport = true;
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported()) if (!amdgpu_device_should_use_aspm(adev))
return; return;
if (adev->asic_type < CHIP_POLARIS10) if (adev->asic_type < CHIP_POLARIS10)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment