@@ -2425,22 +2425,58 @@ int smu_v13_0_mode1_reset(struct smu_context *smu)
2425
2425
return ret ;
2426
2426
}
2427
2427
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
+
2428
2447
int smu_v13_0_update_pcie_parameters (struct smu_context * smu ,
2429
2448
uint32_t pcie_gen_cap ,
2430
2449
uint32_t pcie_width_cap )
2431
2450
{
2432
2451
struct smu_13_0_dpm_context * dpm_context = smu -> smu_dpm .dpm_context ;
2433
2452
struct smu_13_0_pcie_table * pcie_table =
2434
2453
& dpm_context -> dpm_tables .pcie_table ;
2454
+ int num_of_levels = pcie_table -> num_of_link_levels ;
2435
2455
uint32_t smu_pcie_arg ;
2436
2456
int ret , i ;
2437
2457
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 ++ ) {
2440
2467
pcie_table -> pcie_gen [i ] = pcie_gen_cap ;
2441
- if (pcie_table -> pcie_lane [i ] > pcie_width_cap )
2442
2468
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
+ }
2443
2478
2479
+ for (i = 0 ; i < num_of_levels ; i ++ ) {
2444
2480
smu_pcie_arg = i << 16 ;
2445
2481
smu_pcie_arg |= pcie_table -> pcie_gen [i ] << 8 ;
2446
2482
smu_pcie_arg |= pcie_table -> pcie_lane [i ];
0 commit comments