@@ -350,6 +350,81 @@ int amdgpu_device_supports_baco(struct drm_device *dev)
350350 return amdgpu_asic_supports_baco (adev );
351351}
352352
353+ void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device * adev )
354+ {
355+ struct drm_device * dev ;
356+ int bamaco_support ;
357+
358+ dev = adev_to_drm (adev );
359+
360+ adev -> pm .rpm_mode = AMDGPU_RUNPM_NONE ;
361+ bamaco_support = amdgpu_device_supports_baco (dev );
362+
363+ switch (amdgpu_runtime_pm ) {
364+ case 2 :
365+ if (bamaco_support & MACO_SUPPORT ) {
366+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BAMACO ;
367+ dev_info (adev -> dev , "Forcing BAMACO for runtime pm\n" );
368+ } else if (bamaco_support == BACO_SUPPORT ) {
369+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BACO ;
370+ dev_info (adev -> dev , "Requested mode BAMACO not available,fallback to use BACO\n" );
371+ }
372+ break ;
373+ case 1 :
374+ if (bamaco_support & BACO_SUPPORT ) {
375+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BACO ;
376+ dev_info (adev -> dev , "Forcing BACO for runtime pm\n" );
377+ }
378+ break ;
379+ case -1 :
380+ case -2 :
381+ if (amdgpu_device_supports_px (dev )) { /* enable PX as runtime mode */
382+ adev -> pm .rpm_mode = AMDGPU_RUNPM_PX ;
383+ dev_info (adev -> dev , "Using ATPX for runtime pm\n" );
384+ } else if (amdgpu_device_supports_boco (dev )) { /* enable boco as runtime mode */
385+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BOCO ;
386+ dev_info (adev -> dev , "Using BOCO for runtime pm\n" );
387+ } else {
388+ if (!bamaco_support )
389+ goto no_runtime_pm ;
390+
391+ switch (adev -> asic_type ) {
392+ case CHIP_VEGA20 :
393+ case CHIP_ARCTURUS :
394+ /* BACO are not supported on vega20 and arctrus */
395+ break ;
396+ case CHIP_VEGA10 :
397+ /* enable BACO as runpm mode if noretry=0 */
398+ if (!adev -> gmc .noretry )
399+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BACO ;
400+ break ;
401+ default :
402+ /* enable BACO as runpm mode on CI+ */
403+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BACO ;
404+ break ;
405+ }
406+
407+ if (adev -> pm .rpm_mode == AMDGPU_RUNPM_BACO ) {
408+ if (bamaco_support & MACO_SUPPORT ) {
409+ adev -> pm .rpm_mode = AMDGPU_RUNPM_BAMACO ;
410+ dev_info (adev -> dev , "Using BAMACO for runtime pm\n" );
411+ } else {
412+ dev_info (adev -> dev , "Using BACO for runtime pm\n" );
413+ }
414+ }
415+ }
416+ break ;
417+ case 0 :
418+ dev_info (adev -> dev , "runtime pm is manually disabled\n" );
419+ break ;
420+ default :
421+ break ;
422+ }
423+
424+ no_runtime_pm :
425+ if (adev -> pm .rpm_mode == AMDGPU_RUNPM_NONE )
426+ dev_info (adev -> dev , "Runtime PM not available\n" );
427+ }
353428/**
354429 * amdgpu_device_supports_smart_shift - Is the device dGPU with
355430 * smart shift support
@@ -1460,7 +1535,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
14601535
14611536 /* PCI_EXT_CAP_ID_VNDR extended capability is located at 0x100 */
14621537 if (!pci_find_ext_capability (adev -> pdev , PCI_EXT_CAP_ID_VNDR ))
1463- DRM_WARN ("System can't access extended configuration space,please check!!\n" );
1538+ DRM_WARN ("System can't access extended configuration space, please check!!\n" );
14641539
14651540 /* skip if the bios has already enabled large BAR */
14661541 if (adev -> gmc .real_vram_size &&
@@ -5282,7 +5357,9 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
52825357 /* Try reset handler method first */
52835358 tmp_adev = list_first_entry (device_list_handle , struct amdgpu_device ,
52845359 reset_list );
5285- amdgpu_reset_reg_dumps (tmp_adev );
5360+
5361+ if (!test_bit (AMDGPU_SKIP_COREDUMP , & reset_context -> flags ))
5362+ amdgpu_reset_reg_dumps (tmp_adev );
52865363
52875364 reset_context -> reset_device_list = device_list_handle ;
52885365 r = amdgpu_reset_perform_reset (tmp_adev , reset_context );
@@ -5355,7 +5432,8 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
53555432
53565433 vram_lost = amdgpu_device_check_vram_lost (tmp_adev );
53575434
5358- amdgpu_coredump (tmp_adev , vram_lost , reset_context );
5435+ if (!test_bit (AMDGPU_SKIP_COREDUMP , & reset_context -> flags ))
5436+ amdgpu_coredump (tmp_adev , vram_lost , reset_context );
53595437
53605438 if (vram_lost ) {
53615439 DRM_INFO ("VRAM is lost due to GPU reset!\n" );
0 commit comments