Skip to content

Commit 31c7a3b

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/pm: conditionally disable pcie lane/speed switching for SMU13
Intel platforms such as Sapphire Rapids and Raptor Lake don't support dynamic pcie lane or speed switching. This limitation seems to carry over from one generation to another. To be safer, disable dynamic pcie lane width and speed switching when running on an Intel platform. Link: 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/ Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2663 Co-developed-by: Evan Quan <[email protected]> Signed-off-by: Evan Quan <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.1.x
1 parent dcb489b commit 31c7a3b

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,22 +2425,58 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
24252425
return ret;
24262426
}
24272427

2428+
/*
2429+
* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
2430+
* speed switching. Until we have confirmation from Intel that a specific host
2431+
* supports it, it's safer that we keep it disabled for all.
2432+
*
2433+
* 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/
2434+
* https://gitlab.freedesktop.org/drm/amd/-/issues/2663
2435+
*/
2436+
static bool smu_v13_0_is_pcie_dynamic_switching_supported(void)
2437+
{
2438+
#if IS_ENABLED(CONFIG_X86)
2439+
struct cpuinfo_x86 *c = &cpu_data(0);
2440+
2441+
if (c->x86_vendor == X86_VENDOR_INTEL)
2442+
return false;
2443+
#endif
2444+
return true;
2445+
}
2446+
24282447
int smu_v13_0_update_pcie_parameters(struct smu_context *smu,
24292448
uint32_t pcie_gen_cap,
24302449
uint32_t pcie_width_cap)
24312450
{
24322451
struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
24332452
struct smu_13_0_pcie_table *pcie_table =
24342453
&dpm_context->dpm_tables.pcie_table;
2454+
int num_of_levels = pcie_table->num_of_link_levels;
24352455
uint32_t smu_pcie_arg;
24362456
int ret, i;
24372457

2438-
for (i = 0; i < pcie_table->num_of_link_levels; i++) {
2439-
if (pcie_table->pcie_gen[i] > pcie_gen_cap)
2458+
if (!smu_v13_0_is_pcie_dynamic_switching_supported()) {
2459+
if (pcie_table->pcie_gen[num_of_levels - 1] < pcie_gen_cap)
2460+
pcie_gen_cap = pcie_table->pcie_gen[num_of_levels - 1];
2461+
2462+
if (pcie_table->pcie_lane[num_of_levels - 1] < pcie_width_cap)
2463+
pcie_width_cap = pcie_table->pcie_lane[num_of_levels - 1];
2464+
2465+
/* Force all levels to use the same settings */
2466+
for (i = 0; i < num_of_levels; i++) {
24402467
pcie_table->pcie_gen[i] = pcie_gen_cap;
2441-
if (pcie_table->pcie_lane[i] > pcie_width_cap)
24422468
pcie_table->pcie_lane[i] = pcie_width_cap;
2469+
}
2470+
} else {
2471+
for (i = 0; i < num_of_levels; i++) {
2472+
if (pcie_table->pcie_gen[i] > pcie_gen_cap)
2473+
pcie_table->pcie_gen[i] = pcie_gen_cap;
2474+
if (pcie_table->pcie_lane[i] > pcie_width_cap)
2475+
pcie_table->pcie_lane[i] = pcie_width_cap;
2476+
}
2477+
}
24432478

2479+
for (i = 0; i < num_of_levels; i++) {
24442480
smu_pcie_arg = i << 16;
24452481
smu_pcie_arg |= pcie_table->pcie_gen[i] << 8;
24462482
smu_pcie_arg |= pcie_table->pcie_lane[i];

0 commit comments

Comments
 (0)