On 2/28/2024 5:14 PM, Ma Jun wrote:
> Check return value of amdgpu_device_baco_enter/exit and print
> warning message because these errors may cause runtime resume failure
> 
> Signed-off-by: Ma Jun <jun....@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 8b83c26dc018..11e089cfb465 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2705,7 +2705,9 @@ static int amdgpu_pmops_runtime_suspend(struct device 
> *dev)
>       } else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BOCO) {
>               /* nothing to do */
>       } else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) {
> -             amdgpu_device_baco_enter(drm_dev);
> +             ret = amdgpu_device_baco_enter(drm_dev);
> +             if (ret)
> +                     dev_warn(&pdev->dev, "warning: device fails to enter 
> baco. ret=%d\n", ret);
>       }

If the intention is to print for any baco entry/exit failure, it's
better to put the print inside enter/exit functions itself. Also, since
these are triggered through PMFW, any PMFW fail will be printed. So this
may not be that useful.

Thanks,
Lijo

>  
>       dev_dbg(&pdev->dev, "asic/device is runtime suspended\n");
> @@ -2745,7 +2747,9 @@ static int amdgpu_pmops_runtime_resume(struct device 
> *dev)
>                */
>               pci_set_master(pdev);
>       } else if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO) {
> -             amdgpu_device_baco_exit(drm_dev);
> +             ret = amdgpu_device_baco_exit(drm_dev);
> +             if (ret)
> +                     dev_warn(&pdev->dev, "warning: device fails to exit 
> from baco. ret=%d\n", ret);
>       }
>       ret = amdgpu_device_resume(drm_dev, false);
>       if (ret) {

Reply via email to