Skip to content

Commit 3227cd5

Browse files
Kenneth Fenggregkh
authored andcommitted
drm/amd/amdgpu: disable ASPM in some situations
[ Upstream commit c770ef1 ] disable ASPM with some ASICs on some specific platforms. required from PCIe controller owner. Signed-off-by: Kenneth Feng <kenneth.feng@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Stable-dep-of: 2a9c515 ("drm/amdgpu: check ASPM on the dGPU host link") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a3d60ae commit 3227cd5

3 files changed

Lines changed: 45 additions & 13 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ int amdgpu_device_pci_reset(struct amdgpu_device *adev);
13001300
bool amdgpu_device_need_post(struct amdgpu_device *adev);
13011301
bool amdgpu_device_pcie_dynamic_switching_supported(void);
13021302
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
1303-
bool amdgpu_device_aspm_support_quirk(void);
1303+
bool amdgpu_device_nv_aspm_support_quirk(void);
13041304

13051305
void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
13061306
u64 num_vis_bytes);

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

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484

8585
#if IS_ENABLED(CONFIG_X86)
8686
#include <asm/intel-family.h>
87+
#include <asm/cpu_device_id.h>
8788
#endif
8889

8990
MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
@@ -1283,6 +1284,46 @@ bool amdgpu_device_pcie_dynamic_switching_supported(void)
12831284
return true;
12841285
}
12851286

1287+
bool amdgpu_device_nv_aspm_support_quirk(void)
1288+
{
1289+
#if IS_ENABLED(CONFIG_X86)
1290+
struct cpuinfo_x86 *c = &cpu_data(0);
1291+
1292+
return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
1293+
#else
1294+
return true;
1295+
#endif
1296+
}
1297+
1298+
static bool amdgpu_device_aspm_support_quirk(struct amdgpu_device *adev)
1299+
{
1300+
#if IS_ENABLED(CONFIG_X86)
1301+
struct cpuinfo_x86 *c = &cpu_data(0);
1302+
1303+
if (!(adev->ip_versions[GC_HWIP][0] == IP_VERSION(12, 0, 0) ||
1304+
adev->ip_versions[GC_HWIP][0] == IP_VERSION(12, 0, 1)))
1305+
return false;
1306+
1307+
if (c->x86 == 6 &&
1308+
adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN5) {
1309+
switch (c->x86_model) {
1310+
case VFM_MODEL(INTEL_ALDERLAKE):
1311+
case VFM_MODEL(INTEL_ALDERLAKE_L):
1312+
case VFM_MODEL(INTEL_RAPTORLAKE):
1313+
case VFM_MODEL(INTEL_RAPTORLAKE_P):
1314+
case VFM_MODEL(INTEL_RAPTORLAKE_S):
1315+
return true;
1316+
default:
1317+
return false;
1318+
}
1319+
} else {
1320+
return false;
1321+
}
1322+
#else
1323+
return false;
1324+
#endif
1325+
}
1326+
12861327
/**
12871328
* amdgpu_device_should_use_aspm - check if the device should program ASPM
12881329
*
@@ -1305,20 +1346,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
13051346
default:
13061347
return false;
13071348
}
1349+
if (amdgpu_device_aspm_support_quirk(adev))
1350+
return false;
13081351
return pcie_aspm_enabled(adev->pdev);
13091352
}
13101353

1311-
bool amdgpu_device_aspm_support_quirk(void)
1312-
{
1313-
#if IS_ENABLED(CONFIG_X86)
1314-
struct cpuinfo_x86 *c = &cpu_data(0);
1315-
1316-
return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
1317-
#else
1318-
return true;
1319-
#endif
1320-
}
1321-
13221354
/* if we get transitioned to only one device, take VGA back */
13231355
/**
13241356
* amdgpu_device_vga_set_decode - enable/disable vga decode

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

Lines changed: 1 addition & 1 deletion
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) || !amdgpu_device_nv_aspm_support_quirk())
517517
return;
518518

519519
if (!(adev->flags & AMD_IS_APU) &&

0 commit comments

Comments
 (0)