[PATCH 2/3] drm/amd/pm/smu11: poll BACO status after RPM BACO exits

Alex Deucher alexdeucher at gmail.com
Tue Nov 29 17:52:33 UTC 2022


Once these patches land, can we revert these changes?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c85c067c9d9d7a1b2cc2e01a236d5d0d4a872b5
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=192039f12233c9063d040266e7c98188c7c89dec

Alex

On Tue, Nov 22, 2022 at 8:44 PM Guchun Chen <guchun.chen at amd.com> wrote:
>
> After executing BACO exit, driver needs to poll the status
> to ensure FW has completed BACO exit sequence to prevent
> timing issue.
>
> v2: use usleep_range to replace msleep to fix checkpatch.pl warnings
>
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
> ---
>  .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 24 ++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> index ad5f6a15a1d7..ad66d57aa102 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
> @@ -79,6 +79,17 @@ MODULE_FIRMWARE("amdgpu/beige_goby_smc.bin");
>  #define mmTHM_BACO_CNTL_ARCT                   0xA7
>  #define mmTHM_BACO_CNTL_ARCT_BASE_IDX          0
>
> +static void smu_v11_0_poll_baco_exit(struct smu_context *smu)
> +{
> +       struct amdgpu_device *adev = smu->adev;
> +       uint32_t data, loop = 0;
> +
> +       do {
> +               usleep_range(1000, 1100);
> +               data = RREG32_SOC15(THM, 0, mmTHM_BACO_CNTL);
> +       } while ((data & 0x100) && (++loop < 100));
> +}
> +
>  int smu_v11_0_init_microcode(struct smu_context *smu)
>  {
>         struct amdgpu_device *adev = smu->adev;
> @@ -1689,7 +1700,18 @@ int smu_v11_0_baco_enter(struct smu_context *smu)
>
>  int smu_v11_0_baco_exit(struct smu_context *smu)
>  {
> -       return smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
> +       int ret;
> +
> +       ret = smu_v11_0_baco_set_state(smu, SMU_BACO_STATE_EXIT);
> +       if (!ret) {
> +               /*
> +                * Poll BACO exit status to ensure FW has completed
> +                * BACO exit process to avoid timing issues.
> +                */
> +               smu_v11_0_poll_baco_exit(smu);
> +       }
> +
> +       return ret;
>  }
>
>  int smu_v11_0_mode1_reset(struct smu_context *smu)
> --
> 2.25.1
>


More information about the amd-gfx mailing list