Skip to contentSkip to conversation

drm/amdgpu: expand sdma copy_buffer interface with tmz parameter

PATCH In review Aaron Liu 4 participants 11 messages Nov 18, 2019 – Nov 20, 2019 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Aaron Liu

author
#0 lore raw

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

This patch expands sdma copy_buffer interface with tmz parameter.

---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3 -2
index 761ff8b..b313465 100644
@@ -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 *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index 339088d..c08c15e 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
index c45304f..82cdb8f 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
index a101758..89e8c74 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
index 5f4e2c6..011fd12 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
index 45bd538..110449a 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index f4ad299..b6a71a7 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
index bdda8b4..122df07 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1574054316-2802-1-git-send-email-aaron.liu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/5 drm/amdgpu: expand amdgpu_copy_buffer interface with tmz parameter

This patch expands amdgpu_copy_buffer interface with tmz parameter.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_test.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       | 6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h       | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +1 -1
index d1495e1..d9b35df 100644
@@ -40,7 +40,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
 	for (i = 0; i < n; i++) {
 		struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 		r = amdgpu_copy_buffer(ring, saddr, daddr, size, NULL, &fence,
-				       false, false);
+				       false, false, false);
 		if (r)
 			goto exit_do_move;
 		r = dma_fence_wait(fence, false);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index b8e5076..bba3485 100644
@@ -752,7 +752,7 @@ int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow, struct dma_fence **fence)
 
 	return amdgpu_copy_buffer(ring, shadow_addr, parent_addr,
 				  amdgpu_bo_size(shadow), NULL, fence,
-				  true, false);
+				  true, false, false);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2 -2
index b158230..476f1f8 100644
@@ -124,7 +124,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		amdgpu_bo_kunmap(gtt_obj[i]);
 
 		r = amdgpu_copy_buffer(ring, gart_addr, vram_addr,
-				       size, NULL, &fence, false, false);
+				       size, NULL, &fence, false, false, false);
 
 		if (r) {
 			DRM_ERROR("Failed GTT->VRAM copy %d\n", i);
@@ -170,7 +170,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
 		amdgpu_bo_kunmap(vram_obj);
 
 		r = amdgpu_copy_buffer(ring, vram_addr, gart_addr,
-				       size, NULL, &fence, false, false);
+				       size, NULL, &fence, false, false, false);
 
 		if (r) {
 			DRM_ERROR("Failed VRAM->GTT copy %d\n", i);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -3
index c08c15e..1a18aac 100644
@@ -376,7 +376,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
 		}
 
 		r = amdgpu_copy_buffer(ring, from, to, cur_size,
-				       resv, &next, false, true);
+				       resv, &next, false, true, false);
 		if (r)
 			goto error;
 
@@ -2052,7 +2052,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
 		       uint64_t dst_offset, uint32_t byte_count,
 		       struct dma_resv *resv,
 		       struct dma_fence **fence, bool direct_submit,
-		       bool vm_needs_flush)
+		       bool vm_needs_flush, bool tmz)
 {
 	struct amdgpu_device *adev = ring->adev;
 	struct amdgpu_job *job;
@@ -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, false);
+					dst_offset, cur_size_in_bytes, tmz);
 
 		src_offset += cur_size_in_bytes;
 		dst_offset += cur_size_in_bytes;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +1 -1
index 0dddedc..f1ebd42 100644
@@ -87,7 +87,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
 		       uint64_t dst_offset, uint32_t byte_count,
 		       struct dma_resv *resv,
 		       struct dma_fence **fence, bool direct_submit,
-		       bool vm_needs_flush);
+		       bool vm_needs_flush, bool tmz);
 int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,
 			       struct amdgpu_copy_mem *src,
 			       struct amdgpu_copy_mem *dst,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/5 drm/amdgpu: enable TMZ bit in sdma copy pkt for sdma v4

In reply to a message not in the archive

Enable sdma TMZ mode via setting TMZ bit in sdma copy pkt for sdma v4

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
index 110449a..d209cbf 100644
@@ -2342,7 +2342,8 @@ static void sdma_v4_0_emit_copy_buffer(struct amdgpu_ib *ib,
 				       bool tmz)
 {
 	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY) |
-		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
+		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
+		SDMA_PKT_COPY_LINEAR_HEADER_TMZ(tmz ? 1 : 0);
 	ib->ptr[ib->length_dw++] = byte_count - 1;
 	ib->ptr[ib->length_dw++] = 0; /* src/dst endian swap */
 	ib->ptr[ib->length_dw++] = lower_32_bits(src_offset);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 4/5 drm/amdgpu: enable TMZ bit in sdma copy pkt for sdma v5

In reply to a message not in the archive

Enable sdma TMZ mode via setting TMZ bit in sdma copy pkt for sdma v5.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index b6a71a7..64c53ee 100644
@@ -1664,7 +1664,8 @@ static void sdma_v5_0_emit_copy_buffer(struct amdgpu_ib *ib,
 				       bool tmz)
 {
 	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY) |
-		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
+		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
+		SDMA_PKT_COPY_LINEAR_HEADER_TMZ(tmz ? 1 : 0);
 	ib->ptr[ib->length_dw++] = byte_count - 1;
 	ib->ptr[ib->length_dw++] = 0; /* src/dst endian swap */
 	ib->ptr[ib->length_dw++] = lower_32_bits(src_offset);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#5 lore raw

PATCH 5/5 drm/amdgpu: enable TMZ bit in FRAME_CONTROL for gfx10

In reply to a message not in the archive

This patch enables TMZ bit in FRAME_CONTROL for gfx10.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
index d6e11ee..8dce067 100644
@@ -4588,7 +4588,7 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring,
 		gfx_v10_0_ring_emit_ce_meta(ring,
 				    flags & AMDGPU_IB_PREEMPTED ? true : false);
 
-	gfx_v10_0_ring_emit_tmz(ring, true, false);
+	gfx_v10_0_ring_emit_tmz(ring, true, trusted);
 
 	dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */
 	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1574054316-2802-5-git-send-email-aaron.liu-5C7GfCeVMHo@public.gmane.org

#7 lore raw

Re: [PATCH 5/5] drm/amdgpu: enable TMZ bit in FRAME_CONTROL for gfx10

Quoted 12 lines · Aaron Liu

This patch enables TMZ bit in FRAME_CONTROL for gfx10.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
index d6e11ee..8dce067 100644

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, · line 4592

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
@@ -4588,7 +4588,7 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring,
 		gfx_v10_0_ring_emit_ce_meta(ring,
 				    flags & AMDGPU_IB_PREEMPTED ? true : false);
 
-	gfx_v10_0_ring_emit_tmz(ring, true, false);
+	gfx_v10_0_ring_emit_tmz(ring, true, trusted);
 

Do you mean here "true" (the opposite of "false") as opposed to "trusted"?

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, · line 4594

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
 	dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */
 	if (flags & AMDGPU_HAVE_CTX_SWITCH) {

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): de8125e7-a483-4701-7d29-2ba33ca3e21d-5C7GfCeVMHo@public.gmane.org

author
#9 lore raw

RE: [PATCH 5/5] drm/amdgpu: enable TMZ bit in FRAME_CONTROL for gfx10

BR,
Aaron Liu

Quoted 26 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, November 20, 2019 7:52 AM
To: Liu, Aaron <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 5/5] drm/amdgpu: enable TMZ bit in FRAME_CONTROL for gfx10

Review

Quoted 8 lines · Aaron Liu

This patch enables TMZ bit in FRAME_CONTROL for gfx10.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct

Quoted 4 lines

index d6e11ee..8dce067 100644

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
@@ -4588,7 +4588,7 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct

amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct · line 4589

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
 		gfx_v10_0_ring_emit_ce_meta(ring,
 				    flags & AMDGPU_IB_PREEMPTED ? true :
Quoted 8 lines

false);

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, · line 4592

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
-	gfx_v10_0_ring_emit_tmz(ring, true, false);
+	gfx_v10_0_ring_emit_tmz(ring, true, trusted);
 

Do you mean here "true" (the opposite of "false") as opposed to "trusted"?

Here need to consider both non-TMZ and TMZ. Trusted value is decided by cs.in.flags in amdgpu_cs_submit* from libdrm.

Quoted 7 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_ring_emit_cntxcntl(struct · line 4592

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
 	dw2 |= 0x80000000; /* set load_enable otherwise this package is just

NOPs */

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -0
 	if (flags & AMDGPU_HAVE_CTX_SWITCH) {
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw
In reply to a message not in the archive

Series are Reviewed-by: Huang Rui <[email protected]>

Quoted 147 lines · Aaron

This patch expands sdma copy_buffer interface with tmz parameter.

---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3 -2
index 761ff8b..b313465 100644
@@ -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 *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index 339088d..c08c15e 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
index c45304f..82cdb8f 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
index a101758..89e8c74 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
index 5f4e2c6..011fd12 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
index 45bd538..110449a 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index f4ad299..b6a71a7 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
index bdda8b4..122df07 100644
@@ -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);
Signature · 1 line
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw
In reply to a message not in the archive

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...?

Regards,
Luben

Quoted 136 lines · Aaron Liu

This patch expands sdma copy_buffer interface with tmz parameter.

---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +3 -2
index 761ff8b..b313465 100644
@@ -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 *
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index 339088d..c08c15e 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
index c45304f..82cdb8f 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
index a101758..89e8c74 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
index 5f4e2c6..011fd12 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
index 45bd538..110449a 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
index f4ad299..b6a71a7 100644
@@ -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);
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -0
index bdda8b4..122df07 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c static void si_dma_set_irq_funcs(struct amdgpu_device *adev) · line 782

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
@@ -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);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 8edd5526-b762-59d2-7b02-cabe5f5658e9-5C7GfCeVMHo@public.gmane.org

author
#13 lore raw

BR,
Aaron Liu

Quoted 9 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, November 20, 2019 7:12 AM
To: Liu, Aaron <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 1/5] drm/amdgpu: expand sdma copy_buffer interface with tmz parameter

Quoted 4 lines

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.

Quoted 165 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_map_buffer(struct

Quoted 49 lines · Aaron Liu

This patch expands sdma copy_buffer interface with tmz parameter.

---
 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +5 -2
index 761ff8b..b313465 100644
@@ -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 *

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 339088d..c08c15e 100644
@@ -2022,7 +2022,7 @@ static int amdgpu_map_buffer(struct

ttm_buffer_object *bo,

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_map_buffer(struct ttm_buffer_object *bo,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
 	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

Quoted 15 lines

amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
 		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;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
index c45304f..82cdb8f 100644
@@ -1313,7 +1313,8 @@ static void cik_sdma_set_irq_funcs(struct
Quoted 1 line

amdgpu_device *adev) static void cik_sdma_emit_copy_buffer(struct

amdgpu_ib *ib,

drivers/gpu/drm/amd/amdgpu/cik_sdma.c static void cik_sdma_set_irq_funcs(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
 				      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);

Quoted 8 lines

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

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
 				       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)

|

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
 		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
index 5f4e2c6..011fd12 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
 				       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)

|

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
 		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -0
index 45bd538..110449a 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
 				       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)

|

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -0
 		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index f4ad299..b6a71a7 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
 				       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)

|

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
 		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -0
index bdda8b4..122df07 100644
@@ -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,

Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/si_dma.c static void si_dma_set_irq_funcs(struct amdgpu_device *adev) · line 782

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
 				       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);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3838DC6674DF376565BC805EF04F0-rweVpJHSKTrcE+Ck/[email protected]

#15 lore raw

Am 20.11.19 um 04:06 schrieb Liu, Aaron:

Quoted 13 lines

BR,
Aaron Liu

Quoted 9 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Wednesday, November 20, 2019 7:12 AM
To: Liu, Aaron <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH 1/5] drm/amdgpu: expand sdma copy_buffer interface with tmz parameter

Quoted 7 lines
Quoted 4 lines

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.

That idea came to my mind as well while reviewing this, but there is one killer argument why we need this:

For correct eviction of encrypted buffers we will want to do a secure copy to a staging area and then an unsecure copy to the final destination.

So you need a secure and an unsecure copy in the same IB (or go the extra hassle to emit two IBs).

Regards,
Christian.

Quoted 166 lines
Quoted 166 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_map_buffer(struct

Quoted 49 lines · Aaron Liu

This patch expands sdma copy_buffer interface with tmz parameter.

---
  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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +5 -2
index 761ff8b..b313465 100644
@@ -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 *

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 339088d..c08c15e 100644
@@ -2022,7 +2022,7 @@ static int amdgpu_map_buffer(struct

ttm_buffer_object *bo,

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_map_buffer(struct ttm_buffer_object *bo,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
  	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

Quoted 15 lines

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,

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
-					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;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
index c45304f..82cdb8f 100644
@@ -1313,7 +1313,8 @@ static void cik_sdma_set_irq_funcs(struct
Quoted 1 line

amdgpu_device *adev) static void cik_sdma_emit_copy_buffer(struct

amdgpu_ib *ib,

drivers/gpu/drm/amd/amdgpu/cik_sdma.c static void cik_sdma_set_irq_funcs(struct amdgpu_device *adev)

Quoted 7 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
-				      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);

Quoted 8 lines

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

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c

Quoted 7 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
-				       uint32_t byte_count)
+				       uint32_t byte_count,
+				       bool tmz)
  {
  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)

|

Quoted 8 lines
  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
index 5f4e2c6..011fd12 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c

Quoted 7 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-				       uint32_t byte_count)
+				       uint32_t byte_count,
+				       bool tmz)
  {
  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)

|

Quoted 8 lines
  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -0
index 45bd538..110449a 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

Quoted 7 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -1
-				       uint32_t byte_count)
+				       uint32_t byte_count,
+				       bool tmz)
  {
  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)

|

Quoted 8 lines
  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index f4ad299..b6a71a7 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c

Quoted 7 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -1
-				       uint32_t byte_count)
+				       uint32_t byte_count,
+				       bool tmz)
  {
  	ib->ptr[ib->length_dw++] = SDMA_PKT_HEADER_OP(SDMA_OP_COPY)

|

Quoted 8 lines
  		SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR);
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -0
index bdda8b4..122df07 100644
@@ -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,

Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/si_dma.c static void si_dma_set_irq_funcs(struct amdgpu_device *adev) · line 782

Quoted 9 lines

uint64_t src_offset, uint64_t dst_offset,

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
-				       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);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx