All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Matt Coffin <mcoffin13@gmail.com>
Cc: Nirmoy Das <nirmoy.das@amd.com>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/amdgpu/smu: Add message sending lock
Date: Tue, 25 Feb 2020 14:31:56 -0500	[thread overview]
Message-ID: <CADnq5_O7U4R=tmg0ah+JLCWPjX7Hey_RuC6xs+ZO0nEsUsUsjw@mail.gmail.com> (raw)
In-Reply-To: <20200219191941.67724-3-mcoffin13@gmail.com>

On Wed, Feb 19, 2020 at 2:19 PM Matt Coffin <mcoffin13@gmail.com> 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      reply	other threads:[~2020-02-25 19:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 14:31 [PATCH] drm/amdgpu/smu: add a send message lock Alex Deucher
2020-02-18 14:37 ` Nirmoy
2020-02-19 19:19   ` [PATCH 0/2] Implement SMU message register protection Matt Coffin
2020-02-19 19:19   ` [PATCH 1/2] drm/amdgpu/powerplay: Refactor SMU message handling for safety Matt Coffin
2020-02-25 19:30     ` Alex Deucher
2020-02-26  0:03       ` Matt Coffin
2020-02-26 16:33         ` Deucher, Alexander
2020-02-26 23:05       ` [PATCH v2 0/3] Implement SMU message register protection Matt Coffin
2020-02-26 23:05         ` [PATCH v2 1/3] drm/amdgpu/powerplay: Refactor SMU message handling for safety Matt Coffin
2020-02-26 23:05         ` [PATCH v2 2/3] drm/amdgpu/powerplay: Remove deprecated smc_read_arg Matt Coffin
2020-02-26 23:05         ` [PATCH v2 3/3] drm/amdgpu/smu: Add message sending lock Matt Coffin
2020-02-26 23:16       ` [PATCH v3 0/3] Implement SMU message register protection Matt Coffin
2020-02-26 23:16         ` [PATCH v3 1/3] drm/amdgpu/powerplay: Refactor SMU message handling for safety Matt Coffin
2020-02-26 23:16         ` [PATCH v3 2/3] drm/amdgpu/powerplay: Remove deprecated smc_read_arg Matt Coffin
2020-02-26 23:16         ` [PATCH v3 3/3] drm/amdgpu/smu: Add message sending lock Matt Coffin
2020-02-27 20:49         ` [PATCH v3 0/3] Implement SMU message register protection Alex Deucher
2020-02-27 21:00           ` Matt Coffin
2020-02-27 21:04             ` Alex Deucher
2020-02-19 19:19   ` [PATCH 2/2] drm/amdgpu/smu: Add message sending lock Matt Coffin
2020-02-25 19:31     ` Alex Deucher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnq5_O7U4R=tmg0ah+JLCWPjX7Hey_RuC6xs+ZO0nEsUsUsjw@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=mcoffin13@gmail.com \
    --cc=nirmoy.das@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.