[PATCH 10/16] drm/amd/powerplay: max code sharing between .hw_init and .resume

Alex Deucher alexdeucher at gmail.com
Thu Jun 4 21:00:09 UTC 2020


On Thu, Jun 4, 2020 at 12:47 AM Evan Quan <evan.quan at amd.com> wrote:
>
> Then redundant code can be dropped.
>
> Change-Id: Icbafbb7ffc8189a09f4236786aea6702ee73f9f4
> Signed-off-by: Evan Quan <evan.quan at amd.com>

Subject could be clarified as:

drm/amd/powerplay: maximize code sharing between .hw_init and .resume

With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>


> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 42 ++++++++++------------
>  1 file changed, 18 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 3bd6b9a5b63c..4c1f7c36b74b 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1193,10 +1193,28 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
>          * Set PMSTATUSLOG table bo address with SetToolsDramAddr MSG for tools.
>          */
>         ret = smu_set_tool_table_location(smu);
> +       if (ret)
> +               return ret;
>
>         if (!smu_is_dpm_running(smu))
>                 pr_info("dpm has been disabled\n");
>
> +       /*
> +        * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify
> +        * pool location.
> +        */
> +       ret = smu_notify_memory_pool_location(smu);
> +       if (ret)
> +               return ret;
> +
> +       ret = smu_enable_thermal_alert(smu);
> +       if (ret)
> +               return ret;
> +
> +       ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
> +       if (ret)
> +               return ret;
> +
>         return ret;
>  }
>
> @@ -1276,22 +1294,6 @@ static int smu_hw_init(void *handle)
>         if (ret)
>                 goto failed;
>
> -       /*
> -        * Use msg SetSystemVirtualDramAddr and DramLogSetDramAddr can notify
> -        * pool location.
> -        */
> -       ret = smu_notify_memory_pool_location(smu);
> -       if (ret)
> -               goto failed;
> -
> -       ret = smu_enable_thermal_alert(smu);
> -       if (ret)
> -               goto failed;
> -
> -       ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
> -       if (ret)
> -               goto failed;
> -
>         adev->pm.dpm_enabled = true;
>
>         pr_info("SMU is initialized successfully!\n");
> @@ -1488,14 +1490,6 @@ static int smu_resume(void *handle)
>         if (ret)
>                 goto failed;
>
> -       ret = smu_enable_thermal_alert(smu);
> -       if (ret)
> -               goto failed;
> -
> -       ret = smu_i2c_eeprom_init(smu, &adev->pm.smu_i2c);
> -       if (ret)
> -               goto failed;
> -
>         if (smu->is_apu)
>                 smu_set_gfx_cgpg(&adev->smu, true);
>
> --
> 2.27.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list