Re: [PATCH 2/2] drm/amdgpu/smu: Add message sending lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 19, 2020 at 2:19 PM Matt Coffin <mcoffin13@xxxxxxxxx> wrote:
>
> This adds a message lock to the smu_send_smc_msg* implementations to
> protect against concurrent access to the mmu registers used to
> communicate with the SMU

Missing your signed-off-by.  Also you need to move the mutex init and
declaration into this patch.

Thanks,

Alex

> ---
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index 220bf0b10971..19bebba3e0a4 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -102,11 +102,12 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,
>         if (index < 0)
>                 return index;
>
> +       mutex_lock(&smu->message_lock);
>         ret = smu_v11_0_wait_for_response(smu);
>         if (ret) {
>                 pr_err("Msg issuing pre-check failed and "
>                        "SMU may be not in the right state!\n");
> -               return ret;
> +               goto out;
>         }
>
>         WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);
> @@ -119,18 +120,19 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,
>         if (ret) {
>                 pr_err("failed send message: %10s (%d) \tparam: 0x%08x response %#x\n",
>                        smu_get_message_name(smu, msg), index, param, ret);
> -               return ret;
> +               goto out;
>         }
>         if (read_arg) {
>                 ret = smu_v11_0_read_arg(smu, read_arg);
>                 if (ret) {
>                         pr_err("failed to read message arg: %10s (%d) \tparam: 0x%08x response %#x\n",
>                                smu_get_message_name(smu, msg), index, param, ret);
> -                       return ret;
> +                       goto out;
>                 }
>         }
> -
> -       return 0;
> +out:
> +       mutex_unlock(&smu->message_lock);
> +       return ret;
>  }
>
>  int smu_v11_0_init_microcode(struct smu_context *smu)
> --
> 2.25.0
>
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux