All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Oak Zeng <Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
Cc: amd-gfx list <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: Use sdma_engine array
Date: Mon, 17 Dec 2018 17:17:40 -0500	[thread overview]
Message-ID: <CADnq5_OKP2wnLN=8kJ=rXv206upvkGFzU0d569fajK8cPT1u8g@mail.gmail.com> (raw)
In-Reply-To: <1545069872-26076-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>

On Mon, Dec 17, 2018 at 1:05 PM Zeng, Oak <Oak.Zeng@amd.com> wrote:
>
> Use sdma_engine[8] array instead of sdma_engine0~7 so it is easier
> to program.
>
> Change-Id: I04873ddfd82e613c28908ae81665c6b02836d093
> Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c   |  8 ++++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h |  9 +--------
>  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c       |  3 +--
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c       |  8 ++------
>  drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 16 ++++++++--------
>  drivers/gpu/drm/amd/amdgpu/vi.c              |  4 ++--
>  7 files changed, 20 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index 612887c..e957e42 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -188,13 +188,13 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
>                          * can use each doorbell assignment twice.
>                          */
>                         gpu_resources.sdma_doorbell[0][i] =
> -                               adev->doorbell_index.sdma_engine0 + (i >> 1);
> +                               adev->doorbell_index.sdma_engine[0] + (i >> 1);
>                         gpu_resources.sdma_doorbell[0][i+1] =
> -                               adev->doorbell_index.sdma_engine0 + 0x200 + (i >> 1);
> +                               adev->doorbell_index.sdma_engine[0] + 0x200 + (i >> 1);
>                         gpu_resources.sdma_doorbell[1][i] =
> -                               adev->doorbell_index.sdma_engine1 + (i >> 1);
> +                               adev->doorbell_index.sdma_engine[1] + (i >> 1);
>                         gpu_resources.sdma_doorbell[1][i+1] =
> -                               adev->doorbell_index.sdma_engine1 + 0x200 + (i >> 1);
> +                               adev->doorbell_index.sdma_engine[1] + 0x200 + (i >> 1);
>                 }
>                 /* Doorbells 0x0e0-0ff and 0x2e0-2ff are reserved for
>                  * SDMA, IH and VCN. So don't use them for the CP.
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> index be620b2..35a0c05 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> @@ -51,14 +51,7 @@ struct amdgpu_doorbell_index {
>         uint32_t userqueue_start;
>         uint32_t userqueue_end;
>         uint32_t gfx_ring0;
> -       uint32_t sdma_engine0;
> -       uint32_t sdma_engine1;
> -       uint32_t sdma_engine2;
> -       uint32_t sdma_engine3;
> -       uint32_t sdma_engine4;
> -       uint32_t sdma_engine5;
> -       uint32_t sdma_engine6;
> -       uint32_t sdma_engine7;
> +       uint32_t sdma_engine[8];
>         uint32_t ih;
>         union {
>                 struct {
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> index 1bccc5f..06c5a27 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> @@ -1145,8 +1145,7 @@ static int sdma_v3_0_sw_init(void *handle)
>                 ring->ring_obj = NULL;
>                 if (!amdgpu_sriov_vf(adev)) {
>                         ring->use_doorbell = true;
> -                       ring->doorbell_index = (i == 0) ?
> -                               adev->doorbell_index.sdma_engine0 : adev->doorbell_index.sdma_engine1;
> +                       ring->doorbell_index = adev->doorbell_index.sdma_engine[i];
>                 } else {
>                         ring->use_pollmem = true;
>                 }
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index fd0bfe1..42b419d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1521,9 +1521,7 @@ static int sdma_v4_0_sw_init(void *handle)
>                                 ring->use_doorbell?"true":"false");
>
>                 /* doorbell size is 2 dwords, get DWORD offset */
> -               ring->doorbell_index = (i == 0) ?
> -                       (adev->doorbell_index.sdma_engine0 << 1)
> -                       : (adev->doorbell_index.sdma_engine1 << 1);
> +               ring->doorbell_index = adev->doorbell_index.sdma_engine[i] << 1;
>
>                 sprintf(ring->name, "sdma%d", i);
>                 r = amdgpu_ring_init(adev, ring, 1024,
> @@ -1542,9 +1540,7 @@ static int sdma_v4_0_sw_init(void *handle)
>                         /* paging queue use same doorbell index/routing as gfx queue
>                          * with 0x400 (4096 dwords) offset on second doorbell page
>                          */
> -                       ring->doorbell_index = (i == 0) ?
> -                               (adev->doorbell_index.sdma_engine0 << 1)
> -                               : (adev->doorbell_index.sdma_engine1 << 1);
> +                       ring->doorbell_index = adev->doorbell_index.sdma_engine[i] << 1;
>                         ring->doorbell_index += 0x400;
>
>                         sprintf(ring->name, "page%d", i);
> diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> index 422674b..b75d17b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> @@ -70,8 +70,8 @@ void vega10_doorbell_index_init(struct amdgpu_device *adev)
>         adev->doorbell_index.userqueue_start = AMDGPU_DOORBELL64_USERQUEUE_START;
>         adev->doorbell_index.userqueue_end = AMDGPU_DOORBELL64_USERQUEUE_END;
>         adev->doorbell_index.gfx_ring0 = AMDGPU_DOORBELL64_GFX_RING0;
> -       adev->doorbell_index.sdma_engine0 = AMDGPU_DOORBELL64_sDMA_ENGINE0;
> -       adev->doorbell_index.sdma_engine1 = AMDGPU_DOORBELL64_sDMA_ENGINE1;
> +       adev->doorbell_index.sdma_engine[0] = AMDGPU_DOORBELL64_sDMA_ENGINE0;
> +       adev->doorbell_index.sdma_engine[1] = AMDGPU_DOORBELL64_sDMA_ENGINE1;
>         adev->doorbell_index.ih = AMDGPU_DOORBELL64_IH;
>         adev->doorbell_index.uvd_vce.uvd_ring0_1 = AMDGPU_DOORBELL64_UVD_RING0_1;
>         adev->doorbell_index.uvd_vce.uvd_ring2_3 = AMDGPU_DOORBELL64_UVD_RING2_3;
> diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> index edce413..63c542c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> @@ -68,14 +68,14 @@ void vega20_doorbell_index_init(struct amdgpu_device *adev)
>         adev->doorbell_index.userqueue_start = AMDGPU_VEGA20_DOORBELL_USERQUEUE_START;
>         adev->doorbell_index.userqueue_end = AMDGPU_VEGA20_DOORBELL_USERQUEUE_END;
>         adev->doorbell_index.gfx_ring0 = AMDGPU_VEGA20_DOORBELL_GFX_RING0;
> -       adev->doorbell_index.sdma_engine0 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0;
> -       adev->doorbell_index.sdma_engine1 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1;
> -       adev->doorbell_index.sdma_engine2 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2;
> -       adev->doorbell_index.sdma_engine3 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3;
> -       adev->doorbell_index.sdma_engine4 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4;
> -       adev->doorbell_index.sdma_engine5 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5;
> -       adev->doorbell_index.sdma_engine6 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6;
> -       adev->doorbell_index.sdma_engine7 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7;
> +       adev->doorbell_index.sdma_engine[0] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0;
> +       adev->doorbell_index.sdma_engine[1] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1;
> +       adev->doorbell_index.sdma_engine[2] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2;
> +       adev->doorbell_index.sdma_engine[3] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3;
> +       adev->doorbell_index.sdma_engine[4] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4;
> +       adev->doorbell_index.sdma_engine[5] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5;
> +       adev->doorbell_index.sdma_engine[6] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6;
> +       adev->doorbell_index.sdma_engine[7] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7;
>         adev->doorbell_index.ih = AMDGPU_VEGA20_DOORBELL_IH;
>         adev->doorbell_index.uvd_vce.uvd_ring0_1 = AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1;
>         adev->doorbell_index.uvd_vce.uvd_ring2_3 = AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3;
> diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
> index 77e3674..03e7be5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
> @@ -1726,8 +1726,8 @@ void legacy_doorbell_index_init(struct amdgpu_device *adev)
>         adev->doorbell_index.mec_ring6 = AMDGPU_DOORBELL_MEC_RING6;
>         adev->doorbell_index.mec_ring7 = AMDGPU_DOORBELL_MEC_RING7;
>         adev->doorbell_index.gfx_ring0 = AMDGPU_DOORBELL_GFX_RING0;
> -       adev->doorbell_index.sdma_engine0 = AMDGPU_DOORBELL_sDMA_ENGINE0;
> -       adev->doorbell_index.sdma_engine1 = AMDGPU_DOORBELL_sDMA_ENGINE1;
> +       adev->doorbell_index.sdma_engine[0] = AMDGPU_DOORBELL_sDMA_ENGINE0;
> +       adev->doorbell_index.sdma_engine[1] = AMDGPU_DOORBELL_sDMA_ENGINE1;
>         adev->doorbell_index.ih = AMDGPU_DOORBELL_IH;
>         adev->doorbell_index.max_assignment = AMDGPU_DOORBELL_MAX_ASSIGNMENT;
>  }
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-12-17 22:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-17 18:04 [PATCH] drm/amdgpu: Use sdma_engine array Zeng, Oak
     [not found] ` <1545069872-26076-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2018-12-17 22:17   ` 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_OKP2wnLN=8kJ=rXv206upvkGFzU0d569fajK8cPT1u8g@mail.gmail.com' \
    --to=alexdeucher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Oak.Zeng-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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.