drm/amdgpu: Fix the runtime pm mode error
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix the runtime pm mode error
Because of the logic error, Arcturus and vega20 currently use the AMDGPU_RUNPM_NONE for runtime pm even though they support BACO. So, the code is optimized to fix this error.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +27 -29
@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -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) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" ); + }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" );
Signature · 1 line
2.34.1
Quoted 31 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-13@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -switch (adev->asic_type) { -case CHIP_VEGA20 : -case CHIP_ARCTURUS :
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-7-/* 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) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );
Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1
Quoted 38 lines · Alex Deucher
Quoted 37 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-19@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -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 */
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-1-if (!adev->gmc.noretry) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
Also, based on the comment it appears as if runpm is not intended to be enabled by default on Vega20/Arcturus (unless forced by module parameter).
Thanks,
Lijo
Quoted 48 lines
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1
Quoted 51 lines · Lijo
Quoted 38 lines · Alex Deucher
Quoted 37 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-19@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -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 */ Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-1-if (!adev->gmc.noretry) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
Quoted 3 lines
Also, based on the comment it appears as if runpm is not intended to be enabled by default on Vega20/Arcturus (unless forced by module parameter).
Function amdgpu_dpm_is_baco_supported() is called in soc15_supports_baco to check if BACO is supported on Vega20 and Arcturus.
Regards,
Ma Jun
Quoted 51 lines
Thanks,
LijoQuoted 48 lines
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1
Quoted 54 lines · Jun
Quoted 51 lines · Lijo
Quoted 47 lines · Alex Deucher
Quoted 31 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-13@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -switch (adev->asic_type) { -case CHIP_VEGA20 : -case CHIP_ARCTURUS :drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-7-/* 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) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
Quoted 6 lines
Quoted 3 lines
Also, based on the comment it appears as if runpm is not intended to be enabled by default on Vega20/Arcturus (unless forced by module parameter).
Function
amdgpu_dpm_is_baco_supported()is called insoc15_supports_bacoto check if BACO is supported on Vega20 and Arcturus.
BACO support doesn't mean runtime pm needs to be enabled. BACO is also used for other usecases like reset. Since these are MI series ones, I doubt if runtime pm is an intended usecase for these.
Thanks,
Lijo
Quoted 53 lines
Regards,
Ma JunQuoted 51 lines
Thanks,
LijoQuoted 48 lines
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1
Quoted 38 lines · Alex Deucher
Quoted 37 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-19@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -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 */
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-1-if (!adev->gmc.noretry) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
BAMACO currently is detected in pptable_funcs->baco_enter() and baco_exit function. We just need to set BACO flag here.
How about adding a new mode AMDGPU_RUNPM_BAMACO, so we only have to check amdgpu_runtime_pm and detect the PM mode in initialization stage and don't need to handle it later.
Regards,
Ma Jun
Quoted 48 lines
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1
Quoted 52 lines · Jun
Quoted 38 lines · Alex Deucher
Quoted 37 lines · Ma Jun
Because of the logic error, Arcturus and vega20 currently use the
AMDGPU_RUNPM_NONEfor runtime pm even though they support BACO. So, the code is optimized to fix this error.Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++------------- 1 file changed, 27 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-19@@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) } 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_device_supports_baco (dev) && - (amdgpu_runtime_pm !=0 )) { -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 */ Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) · line 155
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-1-if (!adev->gmc.noretry) +if (amdgpu_runtime_pm >0 ) { + adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; +dev_info (adev->dev,"Forcing BACO for runtime pm\n" );Does this need special handling for BAMACO? Setting amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to force BACO.
Quoted 6 lines
BAMACO currently is detected in
pptable_funcs->baco_enter()andbaco_exitfunction. We just need to set BACO flag here.How about adding a new mode
AMDGPU_RUNPM_BAMACO, so we only have to checkamdgpu_runtime_pmand detect the PM mode in initialization stage and don't need to handle it later.
Sure that works, although we still need to verify that it is supported on the platform or not so I think we still need to check if BAMACO is supported in the baco_enter function and then fall back to BACO if BAMACO is not supported.
Alex
Quoted 52 lines
Regards,
Ma JunQuoted 48 lines
Alex
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24
-10+ }else if (amdgpu_runtime_pm !=0 ) { +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 (amdgpu_device_supports_baco (dev)) { +switch (adev->asic_type) { +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 ; -default : -/* enable BACO as runpm mode on CI+ */ - adev->pm.rpm_mode =AMDGPU_RUNPM_BACO ; -break ; - } +break ; + } -if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) -dev_info (adev->dev,"Using BACO for runtime pm\n" ); +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_BACO ) +dev_info (adev->dev,"Using BACO for runtime pm\n" ); + } } +if (adev->pm.rpm_mode ==AMDGPU_RUNPM_NONE ) +dev_info (adev->dev,"No PM mode for runtime pm\n" ); +/* Call ACPI methods: require modeset init * but failure is not fatal */ - acpi_status =amdgpu_acpi_init (adev);if (acpi_status)dev_dbg (dev->dev,"Error during ACPI methods call\n" ); --2.34.1