Skip to content

Commit 2757a84

Browse files
superm1alexdeucher
authored andcommitted
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: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1a6513d commit 2757a84

4 files changed

Lines changed: 10 additions & 22 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,9 +1340,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
13401340
int amdgpu_device_pci_reset(struct amdgpu_device *adev);
13411341
bool amdgpu_device_need_post(struct amdgpu_device *adev);
13421342
bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev);
1343-
bool amdgpu_device_pcie_dynamic_switching_supported(void);
13441343
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
1345-
bool amdgpu_device_aspm_support_quirk(void);
13461344

13471345
void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
13481346
u64 num_vis_bytes);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
14561456
}
14571457

14581458
/*
1459-
* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
1460-
* speed switching. Until we have confirmation from Intel that a specific host
1461-
* supports it, it's safer that we keep it disabled for all.
1459+
* Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids
1460+
* don't support dynamic speed switching. Until we have confirmation from Intel
1461+
* that a specific host supports it, it's safer that we keep it disabled for all.
14621462
*
14631463
* 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/
14641464
* https://gitlab.freedesktop.org/drm/amd/-/issues/2663
14651465
*/
1466-
bool amdgpu_device_pcie_dynamic_switching_supported(void)
1466+
static bool amdgpu_device_pcie_dynamic_switching_supported(void)
14671467
{
14681468
#if IS_ENABLED(CONFIG_X86)
14691469
struct cpuinfo_x86 *c = &cpu_data(0);
@@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
14981498
}
14991499
if (adev->flags & AMD_IS_APU)
15001500
return false;
1501+
if (!(adev->pm.pp_feature & PP_PCIE_DPM_MASK))
1502+
return false;
15011503
return pcie_aspm_enabled(adev->pdev);
15021504
}
15031505

1504-
bool amdgpu_device_aspm_support_quirk(void)
1505-
{
1506-
#if IS_ENABLED(CONFIG_X86)
1507-
struct cpuinfo_x86 *c = &cpu_data(0);
1508-
1509-
return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
1510-
#else
1511-
return true;
1512-
#endif
1513-
}
1514-
15151506
/* if we get transitioned to only one device, take VGA back */
15161507
/**
15171508
* amdgpu_device_vga_set_decode - enable/disable vga decode

drivers/gpu/drm/amd/amdgpu/nv.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)
513513

514514
static void nv_program_aspm(struct amdgpu_device *adev)
515515
{
516-
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
516+
if (!amdgpu_device_should_use_aspm(adev))
517517
return;
518518

519519
if (adev->nbio.funcs->program_aspm)
@@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,
608608
if (adev->gfx.funcs->update_perfmon_mgcg)
609609
adev->gfx.funcs->update_perfmon_mgcg(adev, !enter);
610610

611-
if (!(adev->flags & AMD_IS_APU) &&
612-
(adev->nbio.funcs->enable_aspm) &&
613-
amdgpu_device_should_use_aspm(adev))
611+
if (adev->nbio.funcs->enable_aspm &&
612+
amdgpu_device_should_use_aspm(adev))
614613
adev->nbio.funcs->enable_aspm(adev, !enter);
615614

616615
return 0;

drivers/gpu/drm/amd/amdgpu/vi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
11241124
bool bL1SS = false;
11251125
bool bClkReqSupport = true;
11261126

1127-
if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported())
1127+
if (!amdgpu_device_should_use_aspm(adev))
11281128
return;
11291129

11301130
if (adev->asic_type < CHIP_POLARIS10)

0 commit comments

Comments
 (0)