drm/amdgpu: refactoring the runtime pm mode detection code
Subsystems (2)
PATCH 1/1 drm/amdgpu: refactoring the runtime pm mode detection code
refactor the code of runtime pm mode detection to support amdgpu_runtime_pm =2 and 1 two cases
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 48 +-------------- 3 files changed, 70 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1408,6 +1408,7 @@ bool amdgpu_device_supports_px(struct drm_device *dev);bool amdgpu_device_supports_boco (struct drm_device *dev);bool amdgpu_device_supports_smart_shift (struct drm_device *dev);int amdgpu_device_supports_baco (struct drm_device *dev); +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev);bool amdgpu_device_is_peer_accessible (struct amdgpu_device *adev,struct amdgpu_device *peer_adev);int amdgpu_device_baco_enter (struct drm_device *dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +68 -0
74 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -47
60 lines not on this page · raw message
Signature · 1 line
2.34.1
ping...
Regards,
Ma Jun
Quoted 167 lines · Ma Jun
refactor the code of runtime pm mode detection to support
amdgpu_runtime_pm=2 and 1 two casesSigned-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 48 +-------------- 3 files changed, 70 insertions(+), 47 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1408,6 +1408,7 @@ bool amdgpu_device_supports_px(struct drm_device *dev);bool amdgpu_device_supports_boco (struct drm_device *dev);bool amdgpu_device_supports_smart_shift (struct drm_device *dev);int amdgpu_device_supports_baco (struct drm_device *dev); +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev);bool amdgpu_device_is_peer_accessible (struct amdgpu_device *adev,struct amdgpu_device *peer_adev);int amdgpu_device_baco_enter (struct drm_device *dev);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +68
-0@@ -350,6 +350,74 @@ int amdgpu_device_supports_baco(struct drm_device *dev)return amdgpu_asic_supports_baco (adev); } +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev) +{ +struct drm_device *dev; +int bamaco_support =0 ; + + dev =adev_to_drm (adev); + + adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; + bamaco_support =amdgpu_device_supports_baco (dev); + +if (amdgpu_runtime_pm ==2 ) { +if (bamaco_support == (BACO_SUPPORT |MACO_SUPPORT )) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; +dev_info (adev->dev,"Forcing BAMACO for runtime pm\n" ); + }else if (bamaco_support ==BACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + } + }else if (amdgpu_runtime_pm ==1 ) { +if (bamaco_support ==BACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + } + }else if (amdgpu_runtime_pm ==-1 || amdgpu_runtime_pm ==-2 ) { +if (amdgpu_device_supports_px (dev)) {/* enable PX as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; +dev_info (adev->dev,"Using ATPX for runtime pm\n" ); + }else if (amdgpu_device_supports_boco (dev)) {/* enable boco as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; +dev_info (adev->dev,"Using BOCO for runtime pm\n" ); + }else { +if (!bamaco_support) + goto no_runtime_pm; + +switch (adev->asic_type) { +case CHIP_VEGA20 : +case CHIP_ARCTURUS : +/* BACO are not supported on vega20 and arctrus */ +break ; +case CHIP_VEGA10 : +/* enable BACO as runpm mode if noretry=0 */ +if (!adev->gmc.noretry) + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; +default : +/* enable BACO as runpm mode on CI+ */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; + } + +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { +if (bamaco_support &MACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; +dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); + }else { +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } + } + } + + }else { +dev_info (adev->dev,"runtime pm is manually disabled\n" ); + } + +no_runtime_pm: +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"NO pm mode for runtime pm\n" ); +}/** * amdgpu_device_supports_smart_shift - Is the device dGPU with * smart shift support drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-47@@ -133,7 +133,6 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)int amdgpu_driver_load_kms (struct amdgpu_device *adev,unsigned long flags) {struct drm_device *dev; -int bamaco_support =0 ;int r, acpi_status; dev =adev_to_drm (adev);@@ -150,52 +149,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) goto out; } - adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; -if (amdgpu_device_supports_px (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable PX as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; -dev_info (adev->dev,"Using ATPX for runtime pm\n" ); - }else if (amdgpu_device_supports_boco (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable boco as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; -dev_info (adev->dev,"Using BOCO for runtime pm\n" ); - }else if (amdgpu_runtime_pm !=0 ) { - bamaco_support =amdgpu_device_supports_baco (dev); - -if (!bamaco_support) - goto no_runtime_pm; - -switch (adev->asic_type) { -case CHIP_VEGA20 : -case CHIP_ARCTURUS : -/* enable BACO as runpm mode if runpm=1 */ -if (amdgpu_runtime_pm >0 ) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -case CHIP_VEGA10 : -/* enable BACO as runpm mode if noretry=0 */ -if (!adev->gmc.noretry) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } - -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { -if (bamaco_support &MACO_SUPPORT ) { - adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; -dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); - }else { -dev_info (adev->dev,"Using BACO for runtime pm\n" ); - } - } - } - -no_runtime_pm: -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) -dev_info (adev->dev,"NO pm mode for runtime pm\n" ); +amdgpu_device_detect_runtime_pm_mode (adev);/* Call ACPI methods: require modeset init * but failure is not fatal
[AMD Official Use Only - General]
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Tuesday, April 2, 2024 11:44 AM
To: Ma, Jun <[email protected]>; [email protected]
Cc: Ma, Jun <[email protected]>; Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Lazar, Lijo <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: refactoring the runtime pm mode detection code
ping...
Regards,
Ma Jun
Quoted 85 lines · Ma Jun
refactor the code of runtime pm mode detection to support
amdgpu_runtime_pm=2 and 1 two casesSigned-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 48 +-------------- 3 files changed, 70 insertions(+), 47 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0@@ -1408,6 +1408,7 @@ bool amdgpu_device_supports_px(struct drm_device *dev); bool amdgpu_device_supports_boco(struct drm_device *dev);bool
amdgpu_device_supports_smart_shift(struct drm_device *dev); intamdgpu_device_supports_baco(struct drm_device *dev);drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0+void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device +*adev);bool amdgpu_device_is_peer_accessible (struct amdgpu_device *adev,struct amdgpu_device *peer_adev);int
amdgpu_device_baco_enter(struct drm_device *dev); diff --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_device.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index410f878462bc..ca117f2666bc100644drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +53
-0@@ -350,6 +350,74 @@ int amdgpu_device_supports_baco(struct drm_device *dev)return amdgpu_asic_supports_baco (adev); } +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev) +{ +struct drm_device *dev; +int bamaco_support =0 ; + + dev =adev_to_drm (adev); + + adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; + bamaco_support =amdgpu_device_supports_baco (dev); + +if (amdgpu_runtime_pm ==2 ) { +if (bamaco_support == (BACO_SUPPORT |MACO_SUPPORT )) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; +dev_info (adev->dev,"Forcing BAMACO for runtime pm\n" ); + }else if (bamaco_support ==BACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + } + }else if (amdgpu_runtime_pm ==1 ) { +if (bamaco_support ==BACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + } + }else if (amdgpu_runtime_pm ==-1 || amdgpu_runtime_pm ==-2 ) { +if (amdgpu_device_supports_px (dev)) {/* enable PX as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; +dev_info (adev->dev,"Using ATPX for runtime pm\n" ); + }else if (amdgpu_device_supports_boco (dev)) {/* enable boco as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; +dev_info (adev->dev,"Using BOCO for runtime pm\n" ); + }else { +if (!bamaco_support) + goto no_runtime_pm; + +switch (adev->asic_type) { +case CHIP_VEGA20 : +case CHIP_ARCTURUS : +/* BACO are not supported on vega20 and arctrus */ +break ; +case CHIP_VEGA10 : +/* enable BACO as runpm mode if noretry=0 */ +if (!adev->gmc.noretry) + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; +default : +/* enable BACO as runpm mode on CI+ */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; + } + +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { +if (bamaco_support &MACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 414
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); + }else { +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } + } + } + + }else { +dev_info (adev->dev,"runtime pm is manually disabled\n" ); + }
[kevin]:
Better to use switch...case instead of if..else to make code clean for above code. Anyway, Reviewed-by: Yang Wang <[email protected]>
Best Regards,
Kevin
Quoted 74 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+ +no_runtime_pm: +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"NO pm mode for runtime pm\n" ); }/** * amdgpu_device_supports_smart_shift - Is the device dGPU with * smart shift support drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-0@@ -133,7 +133,6 @@ void amdgpu_register_gpu_instance(struct
amdgpu_device*adev) int amdgpu_driver_load_kms(structamdgpu_device*adev, unsigned long flags) { struct drm_device *dev;drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-47-int bamaco_support =0 ;int r, acpi_status; dev =adev_to_drm (adev);@@ -150,52 +149,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) goto out; } - adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; -if (amdgpu_device_supports_px (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable PX as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; -dev_info (adev->dev,"Using ATPX for runtime pm\n" ); - }else if (amdgpu_device_supports_boco (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable boco as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; -dev_info (adev->dev,"Using BOCO for runtime pm\n" ); - }else if (amdgpu_runtime_pm !=0 ) { - bamaco_support =amdgpu_device_supports_baco (dev); - -if (!bamaco_support) - goto no_runtime_pm; - -switch (adev->asic_type) { -case CHIP_VEGA20 : -case CHIP_ARCTURUS : -/* enable BACO as runpm mode if runpm=1 */ -if (amdgpu_runtime_pm >0 ) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -case CHIP_VEGA10 : -/* enable BACO as runpm mode if noretry=0 */ -if (!adev->gmc.noretry) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } - -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { -if (bamaco_support &MACO_SUPPORT ) { - adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; -dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); - }else { -dev_info (adev->dev,"Using BACO for runtime pm\n" ); - } - } - } - -no_runtime_pm: -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) -dev_info (adev->dev,"NO pm mode for runtime pm\n" ); +amdgpu_device_detect_runtime_pm_mode (adev);/* Call ACPI methods: require modeset init * but failure is not fatal
Quoted 27 lines · Ma Jun
refactor the code of runtime pm mode detection to support
amdgpu_runtime_pm=2 and 1 two casesSigned-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 48 +-------------- 3 files changed, 70 insertions(+), 47 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1408,6 +1408,7 @@ bool amdgpu_device_supports_px(struct drm_device *dev);bool amdgpu_device_supports_boco (struct drm_device *dev);bool amdgpu_device_supports_smart_shift (struct drm_device *dev);int amdgpu_device_supports_baco (struct drm_device *dev); +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev);bool amdgpu_device_is_peer_accessible (struct amdgpu_device *adev,struct amdgpu_device *peer_adev);int amdgpu_device_baco_enter (struct drm_device *dev);drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 356
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -350,6 +350,74 @@ int amdgpu_device_supports_baco(struct drm_device *dev)return amdgpu_asic_supports_baco (adev); } +void amdgpu_device_detect_runtime_pm_mode (struct amdgpu_device *adev) +{ +struct drm_device *dev; +int bamaco_support =0 ;
This initialization is not required.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 364
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ + dev =adev_to_drm (adev); + + adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; + bamaco_support =amdgpu_device_supports_baco (dev); + +if (amdgpu_runtime_pm ==2 ) { +if (bamaco_support == (BACO_SUPPORT |MACO_SUPPORT )) {
Better to check only if MACO is supported as that's the user preference.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 369
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0+ adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; +dev_info (adev->dev,"Forcing BAMACO for runtime pm\n" ); + }else if (bamaco_support ==BACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );
Maybe change this so that user doesn't get confused - "Requested mode BAMACO not available, fallback to use BACO"
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 372
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0+ } + }else if (amdgpu_runtime_pm ==1 ) { +if (bamaco_support ==BACO_SUPPORT ) {
Use & instead of ==. This could also mean SOC supports both MACO and BACO, but user prefers BACO for runpm.
Quoted 37 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +37
-0+ adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + } + }else if (amdgpu_runtime_pm ==-1 || amdgpu_runtime_pm ==-2 ) { +if (amdgpu_device_supports_px (dev)) {/* enable PX as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; +dev_info (adev->dev,"Using ATPX for runtime pm\n" ); + }else if (amdgpu_device_supports_boco (dev)) {/* enable boco as runtime mode */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; +dev_info (adev->dev,"Using BOCO for runtime pm\n" ); + }else { +if (!bamaco_support) + goto no_runtime_pm; + +switch (adev->asic_type) { +case CHIP_VEGA20 : +case CHIP_ARCTURUS : +/* BACO are not supported on vega20 and arctrus */ +break ; +case CHIP_VEGA10 : +/* enable BACO as runpm mode if noretry=0 */ +if (!adev->gmc.noretry) + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; +default : +/* enable BACO as runpm mode on CI+ */ + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +break ; + } + +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { +if (bamaco_support &MACO_SUPPORT ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; +dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); + }else { +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_supports_baco(struct drm_device *dev) · line 419
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+ } + } + + }else { +dev_info (adev->dev,"runtime pm is manually disabled\n" ); + } + +no_runtime_pm: +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"NO pm mode for runtime pm\n" );
Maybe put this differently - "Runtime PM not available"
Thanks,
Lijo
Quoted 70 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+}/** * amdgpu_device_supports_smart_shift - Is the device dGPU with * smart shift support drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-47@@ -133,7 +133,6 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)int amdgpu_driver_load_kms (struct amdgpu_device *adev,unsigned long flags) {struct drm_device *dev; -int bamaco_support =0 ;int r, acpi_status; dev =adev_to_drm (adev);@@ -150,52 +149,7 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) goto out; } - adev->pm.rpm_mode =AMDGPU_RUNPM_NONE ; -if (amdgpu_device_supports_px (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable PX as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_PX ; -dev_info (adev->dev,"Using ATPX for runtime pm\n" ); - }else if (amdgpu_device_supports_boco (dev) && - (amdgpu_runtime_pm !=0 )) {/* enable boco as runtime mode */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BOCO ; -dev_info (adev->dev,"Using BOCO for runtime pm\n" ); - }else if (amdgpu_runtime_pm !=0 ) { - bamaco_support =amdgpu_device_supports_baco (dev); - -if (!bamaco_support) - goto no_runtime_pm; - -switch (adev->asic_type) { -case CHIP_VEGA20 : -case CHIP_ARCTURUS : -/* enable BACO as runpm mode if runpm=1 */ -if (amdgpu_runtime_pm >0 ) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -case CHIP_VEGA10 : -/* enable BACO as runpm mode if noretry=0 */ -if (!adev->gmc.noretry) - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } - -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) { -if (bamaco_support &MACO_SUPPORT ) { - adev->pm.rpm_mode =AMDGPU_RUNPM_BAMACO ; -dev_info (adev->dev,"Using BAMACO for runtime pm\n" ); - }else { -dev_info (adev->dev,"Using BACO for runtime pm\n" ); - } - } - } - -no_runtime_pm: -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) -dev_info (adev->dev,"NO pm mode for runtime pm\n" ); +amdgpu_device_detect_runtime_pm_mode (adev);/* Call ACPI methods: require modeset init * but failure is not fatal