[PATCH 1/5] drm/amdgpu: expand sdma copy_buffer interface with tmz parameter

Liu, Aaron Aaron.Liu at amd.com
Wed Nov 20 03:06:40 UTC 2019



BR,
Aaron Liu

> -----Original Message-----
> From: Tuikov, Luben <Luben.Tuikov at amd.com>
> Sent: Wednesday, November 20, 2019 7:12 AM
> To: Liu, Aaron <Aaron.Liu at amd.com>; amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Huang, Ray
> <Ray.Huang at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>
> Subject: Re: [PATCH 1/5] drm/amdgpu: expand sdma copy_buffer interface
> with tmz parameter
> 
> I wonder if we really do need yet another function argument, thus increasing
> the argument list, or if the "tmz" boolean can/is already a property of the
> job/command/ib/etc., and if it can indeed be had from the latter entity...?
> 
Hi Luben,
In fact, I also thought about it. Compared to add this argument to other entities, perhaps it 
is more clearly and simply. Another reason is that TMZ is a relatively independent property.

> Regards,
> Luben
> 
> On 2019-11-18 12:18 a.m., Aaron Liu wrote:
> > This patch expands sdma copy_buffer interface with tmz parameter.
> >
> > Signed-off-by: Aaron Liu <aaron.liu at amd.com>
> > Reviewed-by: Christian König <christian.koenig at amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 5 +++--
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 4 ++--
> >  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c   | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c   | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/si_dma.c      | 3 ++-
> >  8 files changed, 17 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> > index 761ff8b..b313465 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> > @@ -79,7 +79,8 @@ struct amdgpu_buffer_funcs {
> >  				 /* dst addr in bytes */
> >  				 uint64_t dst_offset,
> >  				 /* number of byte to transfer */
> > -				 uint32_t byte_count);
> > +				 uint32_t byte_count,
> > +				 bool tmz);
> >
> >  	/* maximum bytes in a single operation */
> >  	uint32_t	fill_max_bytes;
> > @@ -97,7 +98,7 @@ struct amdgpu_buffer_funcs {
> >  				 uint32_t byte_count);
> >  };
> >
> > -#define amdgpu_emit_copy_buffer(adev, ib, s, d, b)
> > (adev)->mman.buffer_funcs->emit_copy_buffer((ib),  (s), (d), (b))
> > +#define amdgpu_emit_copy_buffer(adev, ib, s, d, b, t)
> > +(adev)->mman.buffer_funcs->emit_copy_buffer((ib),  (s), (d), (b),
> > +(t))
> >  #define amdgpu_emit_fill_buffer(adev, ib, s, d, b)
> > (adev)->mman.buffer_funcs->emit_fill_buffer((ib), (s), (d), (b))
> >
> >  struct amdgpu_sdma_instance *
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > index 339088d..c08c15e 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > @@ -2022,7 +2022,7 @@ static int amdgpu_map_buffer(struct
> ttm_buffer_object *bo,
> >  	dst_addr = amdgpu_bo_gpu_offset(adev->gart.bo);
> >  	dst_addr += window * AMDGPU_GTT_MAX_TRANSFER_SIZE * 8;
> >  	amdgpu_emit_copy_buffer(adev, &job->ibs[0], src_addr,
> > -				dst_addr, num_bytes);
> > +				dst_addr, num_bytes, false);
> >
> >  	amdgpu_ring_pad_ib(ring, &job->ibs[0]);
> >  	WARN_ON(job->ibs[0].length_dw > num_dw); @@ -2093,7 +2093,7
> @@ int
> > amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
> >  		uint32_t cur_size_in_bytes = min(byte_count, max_bytes);
> >
> >  		amdgpu_emit_copy_buffer(adev, &job->ibs[0], src_offset,
> > -					dst_offset, cur_size_in_bytes);
> > +					dst_offset, cur_size_in_bytes, false);
> >
> >  		src_offset += cur_size_in_bytes;
> >  		dst_offset += cur_size_in_bytes;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> > b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> > index c45304f..82cdb8f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> > @@ -1313,7 +1313,8 @@ static void cik_sdma_set_irq_funcs(struct
> > amdgpu_device *adev)  static void cik_sdma_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				      uint64_t src_offset,
> >  				      uint64_t dst_offset,
> > -				      uint32_t byte_count)
> > +				      uint32_t byte_count,
> > +				      bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = SDMA_PACKET(SDMA_OPCODE_COPY,
> SDMA_COPY_SUB_OPCODE_LINEAR, 0);
> >  	ib->ptr[ib->length_dw++] = byte_count; diff --git
> > a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> > b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> > index a101758..89e8c74 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> > @@ -1200,7 +1200,8 @@ static void sdma_v2_4_set_irq_funcs(struct
> > amdgpu_device *adev)  static void sdma_v2_4_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				       uint64_t src_offset,
> >  				       uint64_t dst_offset,
> > -				       uint32_t byte_count)
> > +				       uint32_t byte_count,
> > +				       bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)
> |
> >  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> > b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> > index 5f4e2c6..011fd12 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> > @@ -1638,7 +1638,8 @@ static void sdma_v3_0_set_irq_funcs(struct
> > amdgpu_device *adev)  static void sdma_v3_0_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				       uint64_t src_offset,
> >  				       uint64_t dst_offset,
> > -				       uint32_t byte_count)
> > +				       uint32_t byte_count,
> > +				       bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)
> |
> >  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > index 45bd538..110449a 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> > @@ -2338,7 +2338,8 @@ static void sdma_v4_0_set_irq_funcs(struct
> > amdgpu_device *adev)  static void sdma_v4_0_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				       uint64_t src_offset,
> >  				       uint64_t dst_offset,
> > -				       uint32_t byte_count)
> > +				       uint32_t byte_count,
> > +				       bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)
> |
> >  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> > b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> > index f4ad299..b6a71a7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
> > @@ -1660,7 +1660,8 @@ static void sdma_v5_0_set_irq_funcs(struct
> > amdgpu_device *adev)  static void sdma_v5_0_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				       uint64_t src_offset,
> >  				       uint64_t dst_offset,
> > -				       uint32_t byte_count)
> > +				       uint32_t byte_count,
> > +				       bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)
> |
> >  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c
> > b/drivers/gpu/drm/amd/amdgpu/si_dma.c
> > index bdda8b4..122df07 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
> > @@ -775,7 +775,8 @@ static void si_dma_set_irq_funcs(struct
> > amdgpu_device *adev)  static void si_dma_emit_copy_buffer(struct
> amdgpu_ib *ib,
> >  				       uint64_t src_offset,
> >  				       uint64_t dst_offset,
> > -				       uint32_t byte_count)
> > +				       uint32_t byte_count,
> > +				       bool tmz)
> >  {
> >  	ib->ptr[ib->length_dw++] = DMA_PACKET(DMA_PACKET_COPY,
> >  					      1, 0, 0, byte_count);
> >



More information about the amd-gfx mailing list