All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Luben Tuikov <luben.tuikov@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Likun Gao <Likun.Gao@amd.com>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>,
	Hawking Zhang <Hawking.Zhang@amd.com>
Subject: Re: [PATCH 7/8] drm/amdgpu: support memory power gating for lsdma
Date: Fri, 6 May 2022 11:26:30 -0400	[thread overview]
Message-ID: <CADnq5_PHzyNy-yNTKhfi6H1Xu60FXfH+XHC5GVhpHj1pfNj27Q@mail.gmail.com> (raw)
In-Reply-To: <df37562a-86d0-16e6-96f0-b9b43ba08ca2@amd.com>

On Fri, May 6, 2022 at 1:10 AM Luben Tuikov <luben.tuikov@amd.com> wrote:
>
>
>
> On 2022-05-05 16:04, Alex Deucher wrote:
> > From: Likun Gao <Likun.Gao@amd.com>
> >
> > Support memory power gating control for LSDMA.
> >
> > Signed-off-by: Likun Gao <Likun.Gao@amd.com>
> > Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_lsdma.h |  1 +
> >  drivers/gpu/drm/amd/amdgpu/lsdma_v6_0.c   | 16 +++++++++++++++-
> >  drivers/gpu/drm/amd/amdgpu/soc21.c        | 12 +++++++++++-
> >  3 files changed, 27 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_lsdma.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_lsdma.h
> > index 9a29f18407b8..7ec7598e7dec 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_lsdma.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_lsdma.h
> > @@ -34,6 +34,7 @@ struct amdgpu_lsdma_funcs
> >                      uint64_t dst_addr, uint64_t size);
> >       int (*fill_mem)(struct amdgpu_device *adev, uint64_t dst_addr,
> >                      uint32_t data, uint64_t size);
> > +     void (*update_memory_power_gating)(struct amdgpu_device *adev, bool enable);
> >  };
> >
> >  int amdgpu_lsdma_copy_mem(struct amdgpu_device *adev, uint64_t src_addr,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/lsdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/lsdma_v6_0.c
> > index b4adb94a080b..1a285b531881 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/lsdma_v6_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/lsdma_v6_0.c
> > @@ -101,7 +101,21 @@ static int lsdma_v6_0_fill_mem(struct amdgpu_device *adev,
> >       return ret;
> >  }
> >
> > +static void lsdma_v6_0_update_memory_power_gating(struct amdgpu_device *adev,
> > +                                              bool enable)
> > +{
> > +     uint32_t tmp;
> > +
> > +     tmp = RREG32_SOC15(LSDMA, 0, regLSDMA_MEM_POWER_CTRL);
> > +     tmp = REG_SET_FIELD(tmp, LSDMA_MEM_POWER_CTRL, MEM_POWER_CTRL_EN, 0);
> > +     WREG32_SOC15(LSDMA, 0, regLSDMA_MEM_POWER_CTRL, tmp);
> > +
> > +     tmp = REG_SET_FIELD(tmp, LSDMA_MEM_POWER_CTRL, MEM_POWER_CTRL_EN, enable);
> > +     WREG32_SOC15(LSDMA, 0, regLSDMA_MEM_POWER_CTRL, tmp);
> > +}
> > +
>
> Do we need to disable it first before updating?
>
> What if we're updating it to the same value it currently is (on the first read)?
> Shouldn't we just skip the subsequent writes?

I'll let Likun comment, but I suspect this sequence came from the hardware team.

Alex

>
> >  const struct amdgpu_lsdma_funcs lsdma_v6_0_funcs = {
> >       .copy_mem = lsdma_v6_0_copy_mem,
> > -     .fill_mem = lsdma_v6_0_fill_mem
> > +     .fill_mem = lsdma_v6_0_fill_mem,
> > +     .update_memory_power_gating = lsdma_v6_0_update_memory_power_gating
> >  };
> > diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c
> > index 741ed3ba84d6..3303e02f85d1 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/soc21.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c
> > @@ -676,7 +676,17 @@ static int soc21_common_set_clockgating_state(void *handle,
> >  static int soc21_common_set_powergating_state(void *handle,
> >                                          enum amd_powergating_state state)
> >  {
> > -     /* TODO */
> > +     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> > +
> > +     switch (adev->ip_versions[LSDMA_HWIP][0]) {
> > +     case IP_VERSION(6, 0, 0):
> > +             adev->lsdma.funcs->update_memory_power_gating(adev,
> > +                             state == AMD_PG_STATE_GATE);
> > +             break;
> > +     default:
> > +             break;
> > +     }
> > +
> >       return 0;
> >  }
> >
>
> Regards,
> --
> Luben

  reply	other threads:[~2022-05-06 15:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05 20:03 [PATCH 0/8] LSDMA support Alex Deucher
2022-05-05 20:04 ` [PATCH 2/8] drm/amdgpu: add lsdma block Alex Deucher
2022-05-05 20:04 ` [PATCH 3/8] drm/amdgpu: support mem copy for LSDMA Alex Deucher
2022-05-06  5:02   ` Luben Tuikov
2022-05-06 14:22     ` Alex Deucher
2022-05-07  0:03       ` Luben Tuikov
2022-05-09  6:06         ` Christian König
2022-05-09 14:59           ` Luben Tuikov
2022-05-05 20:04 ` [PATCH 4/8] drm/amdgpu: support fill mem " Alex Deucher
2022-05-06  5:06   ` Luben Tuikov
2022-05-05 20:04 ` [PATCH 5/8] drm/amdgpu: add LSDMA block for LSDMA v6.0.0 Alex Deucher
2022-05-05 20:04 ` [PATCH 6/8] drm/amdgpu: add LSDMA block for LSDMA v6.0.2 Alex Deucher
2022-05-05 20:04 ` [PATCH 7/8] drm/amdgpu: support memory power gating for lsdma Alex Deucher
2022-05-06  5:10   ` Luben Tuikov
2022-05-06 15:26     ` Alex Deucher [this message]
2022-05-05 20:04 ` [PATCH 8/8] drm/amdgpu: support memory power gating for lsdma 6.0.2 Alex Deucher

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_PHzyNy-yNTKhfi6H1Xu60FXfH+XHC5GVhpHj1pfNj27Q@mail.gmail.com \
    --to=alexdeucher@gmail.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Likun.Gao@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=luben.tuikov@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.