Re: [PATCH 1/5] drm/amdkfd: Improve doorbell variable names

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

 



On Tue, Feb 5, 2019 at 4:43 PM Kuehling, Felix <Felix.Kuehling@xxxxxxx> wrote:
>
> The headline should start with "drm/amdgpu". This change is not KFD
> specific.
>
> I think Alex should review this change.

If we are going to change it, let's be consistent for all IPs (e.g.,
gfx, vcn, etc.).

Alex

>
> Regards,
>    Felix
>
> On 2019-02-05 3:31 p.m., Zhao, Yong wrote:
> > Indicate that the doorbell offset and range is in dwords.
> >
> > Change-Id: Ib0f2564ffa7b1940ffb8725cdc03f662184f5436
> > Signed-off-by: Yong Zhao <Yong.Zhao@xxxxxxx>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu.h          | 2 +-
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h | 3 ++-
> >   drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c       | 6 +++---
> >   drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c       | 6 +++---
> >   drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c       | 6 +++---
> >   drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c       | 3 ++-
> >   drivers/gpu/drm/amd/amdgpu/soc15.c           | 2 +-
> >   drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c | 6 +++++-
> >   drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 6 +++++-
> >   9 files changed, 25 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index d67f8b1dfe80..6230425f3f3d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -642,7 +642,7 @@ struct amdgpu_nbio_funcs {
> >       void (*hdp_flush)(struct amdgpu_device *adev, struct amdgpu_ring *ring);
> >       u32 (*get_memsize)(struct amdgpu_device *adev);
> >       void (*sdma_doorbell_range)(struct amdgpu_device *adev, int instance,
> > -                     bool use_doorbell, int doorbell_index, int doorbell_size);
> > +                     bool use_doorbell, int index_in_dw, int range_dw_size);
> >       void (*enable_doorbell_aperture)(struct amdgpu_device *adev,
> >                                        bool enable);
> >       void (*enable_doorbell_selfring_aperture)(struct amdgpu_device *adev,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> > index 1cfec06f81d4..5c8d04c353d0 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
> > @@ -39,6 +39,7 @@ struct amdgpu_doorbell {
> >    * can be 64-bit, so the index defined is in qword.
> >    */
> >   struct amdgpu_doorbell_index {
> > +     uint32_t entry_dw_size;
> >       uint32_t kiq;
> >       uint32_t mec_ring0;
> >       uint32_t mec_ring1;
> > @@ -73,7 +74,7 @@ struct amdgpu_doorbell_index {
> >       };
> >       uint32_t max_assignment;
> >       /* Per engine SDMA doorbell size in dword */
> > -     uint32_t sdma_doorbell_range;
> > +     uint32_t dw_range_per_sdma_eng;
> >   };
> >
> >   typedef enum _AMDGPU_DOORBELL_ASSIGNMENT
> > diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
> > index cc967dbfd631..64bc41afd71e 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
> > @@ -68,7 +68,7 @@ static u32 nbio_v6_1_get_memsize(struct amdgpu_device *adev)
> >   }
> >
> >   static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
> > -                     bool use_doorbell, int doorbell_index, int doorbell_size)
> > +                     bool use_doorbell, int index_in_dw, int range_dw_size)
> >   {
> >       u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :
> >                       SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);
> > @@ -76,8 +76,8 @@ static void nbio_v6_1_sdma_doorbell_range(struct amdgpu_device *adev, int instan
> >       u32 doorbell_range = RREG32(reg);
> >
> >       if (use_doorbell) {
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);
> >       } else
> >               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
> > index 1cdb98ad2db3..28cc96b7a292 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_0.c
> > @@ -67,7 +67,7 @@ static u32 nbio_v7_0_get_memsize(struct amdgpu_device *adev)
> >   }
> >
> >   static void nbio_v7_0_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
> > -                     bool use_doorbell, int doorbell_index, int doorbell_size)
> > +                     bool use_doorbell, int index_in_dw, int range_dw_size)
> >   {
> >       u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :
> >                       SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);
> > @@ -75,8 +75,8 @@ static void nbio_v7_0_sdma_doorbell_range(struct amdgpu_device *adev, int instan
> >       u32 doorbell_range = RREG32(reg);
> >
> >       if (use_doorbell) {
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);
> >       } else
> >               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
> > index 221f26e50322..9ae8cd4dc702 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
> > @@ -65,7 +65,7 @@ static u32 nbio_v7_4_get_memsize(struct amdgpu_device *adev)
> >   }
> >
> >   static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instance,
> > -                     bool use_doorbell, int doorbell_index, int doorbell_size)
> > +                     bool use_doorbell, int index_in_dw, int range_dw_size)
> >   {
> >       u32 reg = instance == 0 ? SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA0_DOORBELL_RANGE) :
> >                       SOC15_REG_OFFSET(NBIO, 0, mmBIF_SDMA1_DOORBELL_RANGE);
> > @@ -73,8 +73,8 @@ static void nbio_v7_4_sdma_doorbell_range(struct amdgpu_device *adev, int instan
> >       u32 doorbell_range = RREG32(reg);
> >
> >       if (use_doorbell) {
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, doorbell_index);
> > -             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, doorbell_size);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, OFFSET, index_in_dw);
> > +             doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, range_dw_size);
> >       } else
> >               doorbell_range = REG_SET_FIELD(doorbell_range, BIF_SDMA0_DOORBELL_RANGE, SIZE, 0);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > index 127b85983e8f..e65e9bc52bd4 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > @@ -1520,7 +1520,8 @@ 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 = adev->doorbell_index.sdma_engine[i] << 1;
> > +             ring->doorbell_index = adev->doorbell_index.sdma_engine[i]
> > +                             * adev->doorbell_index.entry_dw_size;
> >
> >               sprintf(ring->name, "sdma%d", i);
> >               r = amdgpu_ring_init(adev, ring, 1024,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
> > index 99ebcf29dcb0..aad72ac80361 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
> > @@ -980,7 +980,7 @@ static void soc15_doorbell_range_init(struct amdgpu_device *adev)
> >               ring = &adev->sdma.instance[i].ring;
> >               adev->nbio_funcs->sdma_doorbell_range(adev, i,
> >                       ring->use_doorbell, ring->doorbell_index,
> > -                     adev->doorbell_index.sdma_doorbell_range);
> > +                     adev->doorbell_index.dw_range_per_sdma_eng);
> >       }
> >
> >       adev->nbio_funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,
> > diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> > index 4b5d60ea3e78..d2409df2dde9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c
> > @@ -58,6 +58,7 @@ int vega10_reg_base_init(struct amdgpu_device *adev)
> >
> >   void vega10_doorbell_index_init(struct amdgpu_device *adev)
> >   {
> > +     adev->doorbell_index.entry_dw_size = 2;
> >       adev->doorbell_index.kiq = AMDGPU_DOORBELL64_KIQ;
> >       adev->doorbell_index.mec_ring0 = AMDGPU_DOORBELL64_MEC_RING0;
> >       adev->doorbell_index.mec_ring1 = AMDGPU_DOORBELL64_MEC_RING1;
> > @@ -83,6 +84,9 @@ void vega10_doorbell_index_init(struct amdgpu_device *adev)
> >       adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_DOORBELL64_VCE_RING6_7;
> >       /* In unit of dword doorbell */
> >       adev->doorbell_index.max_assignment = AMDGPU_DOORBELL64_MAX_ASSIGNMENT << 1;
> > -     adev->doorbell_index.sdma_doorbell_range = 4;
> > +     adev->doorbell_index.dw_range_per_sdma_eng =
> > +                     (adev->doorbell_index.sdma_engine[1]
> > +                     - adev->doorbell_index.sdma_engine[0])
> > +                     * adev->doorbell_index.entry_dw_size;
> >   }
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> > index 53716c593b2b..b28c5999d8f0 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c
> > @@ -56,6 +56,7 @@ int vega20_reg_base_init(struct amdgpu_device *adev)
> >
> >   void vega20_doorbell_index_init(struct amdgpu_device *adev)
> >   {
> > +     adev->doorbell_index.entry_dw_size = 2;
> >       adev->doorbell_index.kiq = AMDGPU_VEGA20_DOORBELL_KIQ;
> >       adev->doorbell_index.mec_ring0 = AMDGPU_VEGA20_DOORBELL_MEC_RING0;
> >       adev->doorbell_index.mec_ring1 = AMDGPU_VEGA20_DOORBELL_MEC_RING1;
> > @@ -86,6 +87,9 @@ void vega20_doorbell_index_init(struct amdgpu_device *adev)
> >       adev->doorbell_index.uvd_vce.vce_ring4_5 = AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5;
> >       adev->doorbell_index.uvd_vce.vce_ring6_7 = AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7;
> >       adev->doorbell_index.max_assignment = AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT << 1;
> > -     adev->doorbell_index.sdma_doorbell_range = 20;
> > +     adev->doorbell_index.dw_range_per_sdma_eng =
> > +                     (adev->doorbell_index.sdma_engine[1]
> > +                     - adev->doorbell_index.sdma_engine[0])
> > +                     * adev->doorbell_index.entry_dw_size;
> >   }
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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