Skip to contentSkip to conversation

drm/amdgpu: pad gfx and compute rings to 256 dw

PATCH In review Christian König 6 participants 22 messages Oct 5, 2016 – Oct 28, 2016 13 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 drm/amdgpu: pad gfx and compute rings to 256 dw

From: Christian König <[email protected]>

The same as on windows to avoid further problems with CE/DE command submission overlaps.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -2
index 40abb6b..e3be5bd 100644
@@ -2896,7 +2896,7 @@ static int gfx_v6_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xf,
+				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
 				     AMDGPU_RING_TYPE_GFX);
 		if (r)
@@ -2920,7 +2920,7 @@ static int gfx_v6_0_sw_init(void *handle)
 		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xf,
+				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, irq_type,
 				     AMDGPU_RING_TYPE_COMPUTE);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -2
index 2bdcdd0..3ef7cc0 100644
@@ -4640,7 +4640,7 @@ static int gfx_v7_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xf,
+				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
 				     AMDGPU_RING_TYPE_GFX);
 		if (r)
@@ -4667,7 +4667,7 @@ static int gfx_v7_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xf,
+				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, irq_type,
 				     AMDGPU_RING_TYPE_COMPUTE);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
index e3db40d..8efd7db 100644
@@ -2062,7 +2062,7 @@ static int gfx_v8_0_sw_init(void *handle)
 		}
 
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xf,
+				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
 				     AMDGPU_RING_TYPE_GFX);
 		if (r)
@@ -2089,7 +2089,7 @@ static int gfx_v8_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xf,
+				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, irq_type,
 				     AMDGPU_RING_TYPE_COMPUTE);
 		if (r)
Signature · 6 lines
2.5.0

_______________________________________________
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): 1475676809-3061-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

PATCH 2/8 drm/amdgpu: "revert fix exclusive mode game texture blank(v2)"

From: Christian König <[email protected]>

This reverts commit e3bb40fcd1a3e889cf2c8972f1925083dd9f96dc and commit 52d7a0c509a48f228d1ec04eaadb2056c201e06e.

Shouldn't be necessary any more with the increased padding and we really don't want engine specific code here.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -8
index 3e39039..38261a0 100644
@@ -129,7 +129,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 
 	unsigned i;
 	int r = 0;
-	unsigned extra_nop = 0;
 
 	if (num_ibs == 0)
 		return -EINVAL;
@@ -156,11 +155,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
 		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
-	if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
-		extra_nop = 128;
-		alloc_size += extra_nop;
-	}
-
 	r = amdgpu_ring_alloc(ring, alloc_size);
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
@@ -171,8 +165,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
 	if (vm) {
-		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go too fast than DE */
-
 		r = amdgpu_vm_flush(ring, job);
 		if (r) {
 			amdgpu_ring_undo(ring);
Signature · 6 lines
2.5.0

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

PATCH 3/8 drm/amdgpu: remove ring type check for conditional execution

In reply to a message not in the archive

From: Christian König <[email protected]>

If a ring doesn't support that it shouldn't implement the function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
index 38261a0..f43368b 100644
@@ -161,7 +161,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		return r;
 	}
 
-	if (ring->type == AMDGPU_RING_TYPE_GFX && ring->funcs->init_cond_exec)
+	if (ring->funcs->init_cond_exec)
 		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
 	if (vm) {
Signature · 6 lines
2.5.0

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

PATCH 4/8 drm/amdgpu: remove 128 NOP hack from vm_flush

In reply to a message not in the archive

From: Christian König <[email protected]>

With the padding raised to 256 DW that shouldn't be needed any more.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -4
index 8efd7db..90bb451 100644
@@ -6253,10 +6253,6 @@ static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 {
 	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
 
-	/* GFX8 emits 128 dw nop to prevent DE do vm_flush before CE finish CEIB */
-	if (usepfp)
-		amdgpu_ring_insert_nop(ring, 128);
-
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
 	amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
 				 WRITE_DATA_DST_SEL(0)) |
Signature · 6 lines
2.5.0

_______________________________________________
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): 1475676809-3061-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#6 lore raw

RE: [PATCH 4/8] drm/amdgpu: remove 128 NOP hack from vm_flush

Quoted 28 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Wednesday, October 05, 2016 10:13 AM
To: [email protected]
Subject: [PATCH 4/8] drm/amdgpu: remove 128 NOP hack from vm_flush

From: Christian König <[email protected]>

With the padding raised to 256 DW that shouldn't be needed any more.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
index 8efd7db..90bb451 100644
@@ -6253,10 +6253,6 @@ static void gfx_v8_0_ring_emit_vm_flush(struct
 amdgpu_ring *ring,
 {
 	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
 
-	/* GFX8 emits 128 dw nop to prevent DE do vm_flush before CE

finish CEIB */

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, · line 6259

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -3
-	if (usepfp)
-		amdgpu_ring_insert_nop(ring, 128);
-

Make sure to adjust the dma frame size as well in this patch. With that fixed,

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
 	amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
 				 WRITE_DATA_DST_SEL(0)) |
--

2.5.0

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

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

#7 lore raw

PATCH 5/8 drm/amdgpu: remove explicit NULL init for parse_cs

In reply to a message not in the archive

From: Christian König <[email protected]>

sed -i "/\.parse_cs = NULL,/d" drivers/gpu/drm/amd/amdgpu/*.c

That's just a leftover from radeon.

---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c  | 1 -
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c  | 2 --
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c  | 2 --
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 2 --
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 1 -
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 1 -
 drivers/gpu/drm/amd/amdgpu/si_dma.c    | 1 -
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c  | 1 -
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c  | 1 -
 9 files changed, 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
index e6d7bf9..662f493 100644
@@ -1225,7 +1225,6 @@ static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = cik_sdma_ring_emit_ib,
 	.emit_fence = cik_sdma_ring_emit_fence,
 	.emit_pipeline_sync = cik_sdma_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
index e3be5bd..4e35e16 100644
@@ -3258,7 +3258,6 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_gfx,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v6_0_ring_emit_ib,
 	.emit_fence = gfx_v6_0_ring_emit_fence,
 	.emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync,
@@ -3277,7 +3276,6 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_compute,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v6_0_ring_emit_ib,
 	.emit_fence = gfx_v6_0_ring_emit_fence,
 	.emit_pipeline_sync = gfx_v6_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -2
index 3ef7cc0..d4db26d 100644
@@ -5141,7 +5141,6 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v7_0_ring_set_wptr_gfx,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v7_0_ring_emit_ib_gfx,
 	.emit_fence = gfx_v7_0_ring_emit_fence_gfx,
 	.emit_pipeline_sync = gfx_v7_0_ring_emit_pipeline_sync,
@@ -5162,7 +5161,6 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v7_0_ring_set_wptr_compute,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v7_0_ring_emit_ib_compute,
 	.emit_fence = gfx_v7_0_ring_emit_fence_compute,
 	.emit_pipeline_sync = gfx_v7_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index 90bb451..5aca9de 100644
@@ -6572,7 +6572,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v8_0_ring_emit_ib_gfx,
 	.emit_fence = gfx_v8_0_ring_emit_fence_gfx,
 	.emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync,
@@ -6594,7 +6593,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
-	.parse_cs = NULL,
 	.emit_ib = gfx_v8_0_ring_emit_ib_compute,
 	.emit_fence = gfx_v8_0_ring_emit_fence_compute,
 	.emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
index 1f3dcab..2e3fd35 100644
@@ -1229,7 +1229,6 @@ static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = sdma_v2_4_ring_emit_ib,
 	.emit_fence = sdma_v2_4_ring_emit_fence,
 	.emit_pipeline_sync = sdma_v2_4_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
index 62e2f4c..d7d5f5f 100644
@@ -1574,7 +1574,6 @@ static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = sdma_v3_0_ring_emit_ib,
 	.emit_fence = sdma_v3_0_ring_emit_fence,
 	.emit_pipeline_sync = sdma_v3_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
index de35819..9f11e37 100644
@@ -783,7 +783,6 @@ static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = si_dma_ring_emit_ib,
 	.emit_fence = si_dma_ring_emit_fence,
 	.emit_pipeline_sync = si_dma_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -1
index e0fd9f2..fec5a15 100644
@@ -1070,7 +1070,6 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
 	.get_rptr = uvd_v6_0_ring_get_rptr,
 	.get_wptr = uvd_v6_0_ring_get_wptr,
 	.set_wptr = uvd_v6_0_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = uvd_v6_0_ring_emit_ib,
 	.emit_fence = uvd_v6_0_ring_emit_fence,
 	.emit_vm_flush = uvd_v6_0_ring_emit_vm_flush,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -1
index 3f6db4e..af91421 100644
@@ -871,7 +871,6 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,
 	.set_wptr = vce_v3_0_ring_set_wptr,
-	.parse_cs = NULL,
 	.emit_ib = vce_v3_0_ring_emit_ib,
 	.emit_vm_flush = vce_v3_0_emit_vm_flush,
 	.emit_pipeline_sync = vce_v3_0_emit_pipeline_sync,
Signature · 6 lines
2.5.0

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

PATCH 6/8 drm/amdgpu: move IB and frame size directly into the engine description

In reply to a message not in the archive

From: Christian König <[email protected]>

I should have suggested that on the initial patchset. This saves us a few CPU cycles during CS and a bunch of loc.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h      |  2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c   |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  5 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c  | 12 -------
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    | 25 ++++----------
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    | 46 +++++++++----------------
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 56 ++++++++++--------------------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 58 ++++++++++----------------------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   | 25 ++++----------
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   | 25 ++++----------
 drivers/gpu/drm/amd/amdgpu/si_dma.c      | 25 ++++----------
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    | 21 +++---------
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    | 21 +++---------
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    | 42 +++++++----------------
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +--
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    | 34 +++++--------------
 16 files changed, 117 insertions(+), 288 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
index 69ef6d0..4cfd55c 100644
@@ -1960,8 +1960,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 #define amdgpu_ring_pad_ib(r, ib) ((r)->funcs->pad_ib((r), (ib)))
 #define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r))
 #define amdgpu_ring_patch_cond_exec(r,o) (r)->funcs->patch_cond_exec((r),(o))
-#define amdgpu_ring_get_emit_ib_size(r) (r)->funcs->get_emit_ib_size((r))
-#define amdgpu_ring_get_dma_frame_size(r) (r)->funcs->get_dma_frame_size((r))
 #define amdgpu_ih_get_wptr(adev) (adev)->irq.ih_funcs->get_wptr((adev))
 #define amdgpu_ih_decode_iv(adev, iv) (adev)->irq.ih_funcs->decode_iv((adev), (iv))
 #define amdgpu_ih_set_rptr(adev) (adev)->irq.ih_funcs->set_rptr((adev))
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -2
index f43368b..acf48de 100644
@@ -152,8 +152,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		return -EINVAL;
 	}
 
-	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
-		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
+	alloc_size = ring->funcs->emit_frame_size + num_ibs *
+		ring->funcs->emit_ib_size;
 
 	r = amdgpu_ring_alloc(ring, alloc_size);
 	if (r) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3 -2
index 2f93588..767843c 100644
@@ -98,6 +98,9 @@ struct amdgpu_ring_funcs {
 	void (*set_wptr)(struct amdgpu_ring *ring);
 	/* validating and patching of IBs */
 	int (*parse_cs)(struct amdgpu_cs_parser *p, uint32_t ib_idx);
+	/* constants to calculate how many DW are needed for an emit */
+	unsigned emit_frame_size;
+	unsigned emit_ib_size;
 	/* command emit functions */
 	void (*emit_ib)(struct amdgpu_ring *ring,
 			struct amdgpu_ib *ib,
@@ -127,8 +130,6 @@ struct amdgpu_ring_funcs {
 	void (*end_use)(struct amdgpu_ring *ring);
 	void (*emit_switch_buffer) (struct amdgpu_ring *ring);
 	void (*emit_cntxcntl) (struct amdgpu_ring *ring, uint32_t flags);
-	unsigned (*get_emit_ib_size) (struct amdgpu_ring *ring);
-	unsigned (*get_dma_frame_size) (struct amdgpu_ring *ring);
 };
 
 struct amdgpu_ring {
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +0 -12
index 9a534e2..2fb469a 100644
@@ -824,18 +824,6 @@ void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
 	amdgpu_ring_write(ring, VCE_CMD_END);
 }
 
-unsigned amdgpu_vce_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		4; /* amdgpu_vce_ring_emit_ib */
-}
-
-unsigned amdgpu_vce_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		6; /* amdgpu_vce_ring_emit_fence  x1 no user fence */
-}
-
 /**
  * amdgpu_vce_ring_test_ring - test if VCE ring is working
  *
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +7 -18
index 662f493..bac3c14 100644
@@ -847,22 +847,6 @@ static void cik_sdma_ring_emit_vm_flush(struct amdgpu_ring *ring,
 	amdgpu_ring_write(ring, (0xfff << 16) | 10); /* retry count, poll interval */
 }
 
-static unsigned cik_sdma_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		7 + 4; /* cik_sdma_ring_emit_ib */
-}
-
-static unsigned cik_sdma_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		6 + /* cik_sdma_ring_emit_hdp_flush */
-		3 + /* cik_sdma_ring_emit_hdp_invalidate */
-		6 + /* cik_sdma_ring_emit_pipeline_sync */
-		12 + /* cik_sdma_ring_emit_vm_flush */
-		9 + 9 + 9; /* cik_sdma_ring_emit_fence x3 for user fence, vm fence */
-}
-
 static void cik_enable_sdma_mgcg(struct amdgpu_device *adev,
 				 bool enable)
 {
@@ -1225,6 +1209,13 @@ static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
+	.emit_frame_size =
+		6 + /* cik_sdma_ring_emit_hdp_flush */
+		3 + /* cik_sdma_ring_emit_hdp_invalidate */
+		6 + /* cik_sdma_ring_emit_pipeline_sync */
+		12 + /* cik_sdma_ring_emit_vm_flush */
+		9 + 9 + 9, /* cik_sdma_ring_emit_fence x3 for user fence, vm fence */
+	.emit_ib_size = 7 + 4, /* cik_sdma_ring_emit_ib */
 	.emit_ib = cik_sdma_ring_emit_ib,
 	.emit_fence = cik_sdma_ring_emit_fence,
 	.emit_pipeline_sync = cik_sdma_ring_emit_pipeline_sync,
@@ -1235,8 +1226,6 @@ static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.test_ib = cik_sdma_ring_test_ib,
 	.insert_nop = cik_sdma_ring_insert_nop,
 	.pad_ib = cik_sdma_ring_pad_ib,
-	.get_emit_ib_size = cik_sdma_ring_get_emit_ib_size,
-	.get_dma_frame_size = cik_sdma_ring_get_dma_frame_size,
 };
 
 static void cik_sdma_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +15 -31

76 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +17 -39

86 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +18 -40

88 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +7 -18
index 2e3fd35..b797900 100644
@@ -906,22 +906,6 @@ static void sdma_v2_4_ring_emit_vm_flush(struct amdgpu_ring *ring,
 			  SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10)); /* retry count, poll interval */
 }
 
-static unsigned sdma_v2_4_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		7 + 6; /* sdma_v2_4_ring_emit_ib */
-}
-
-static unsigned sdma_v2_4_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		6 + /* sdma_v2_4_ring_emit_hdp_flush */
-		3 + /* sdma_v2_4_ring_emit_hdp_invalidate */
-		6 + /* sdma_v2_4_ring_emit_pipeline_sync */
-		12 + /* sdma_v2_4_ring_emit_vm_flush */
-		10 + 10 + 10; /* sdma_v2_4_ring_emit_fence x3 for user fence, vm fence */
-}
-
 static int sdma_v2_4_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1229,6 +1213,13 @@ static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
+	.emit_frame_size =
+		6 + /* sdma_v2_4_ring_emit_hdp_flush */
+		3 + /* sdma_v2_4_ring_emit_hdp_invalidate */
+		6 + /* sdma_v2_4_ring_emit_pipeline_sync */
+		12 + /* sdma_v2_4_ring_emit_vm_flush */
+		10 + 10 + 10, /* sdma_v2_4_ring_emit_fence x3 for user fence, vm fence */
+	.emit_ib_size = 7 + 6, /* sdma_v2_4_ring_emit_ib */
 	.emit_ib = sdma_v2_4_ring_emit_ib,
 	.emit_fence = sdma_v2_4_ring_emit_fence,
 	.emit_pipeline_sync = sdma_v2_4_ring_emit_pipeline_sync,
@@ -1239,8 +1230,6 @@ static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.test_ib = sdma_v2_4_ring_test_ib,
 	.insert_nop = sdma_v2_4_ring_insert_nop,
 	.pad_ib = sdma_v2_4_ring_pad_ib,
-	.get_emit_ib_size = sdma_v2_4_ring_get_emit_ib_size,
-	.get_dma_frame_size = sdma_v2_4_ring_get_dma_frame_size,
 };
 
 static void sdma_v2_4_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +7 -18
index d7d5f5f..891de21 100644
@@ -1108,22 +1108,6 @@ static void sdma_v3_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 			  SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10)); /* retry count, poll interval */
 }
 
-static unsigned sdma_v3_0_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		7 + 6; /* sdma_v3_0_ring_emit_ib */
-}
-
-static unsigned sdma_v3_0_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		6 + /* sdma_v3_0_ring_emit_hdp_flush */
-		3 + /* sdma_v3_0_ring_emit_hdp_invalidate */
-		6 + /* sdma_v3_0_ring_emit_pipeline_sync */
-		12 + /* sdma_v3_0_ring_emit_vm_flush */
-		10 + 10 + 10; /* sdma_v3_0_ring_emit_fence x3 for user fence, vm fence */
-}
-
 static int sdma_v3_0_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1574,6 +1558,13 @@ static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
+	.emit_frame_size =
+		6 + /* sdma_v3_0_ring_emit_hdp_flush */
+		3 + /* sdma_v3_0_ring_emit_hdp_invalidate */
+		6 + /* sdma_v3_0_ring_emit_pipeline_sync */
+		12 + /* sdma_v3_0_ring_emit_vm_flush */
+		10 + 10 + 10, /* sdma_v3_0_ring_emit_fence x3 for user fence, vm fence */
+	.emit_ib_size = 7 + 6, /* sdma_v3_0_ring_emit_ib */
 	.emit_ib = sdma_v3_0_ring_emit_ib,
 	.emit_fence = sdma_v3_0_ring_emit_fence,
 	.emit_pipeline_sync = sdma_v3_0_ring_emit_pipeline_sync,
@@ -1584,8 +1575,6 @@ static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.test_ib = sdma_v3_0_ring_test_ib,
 	.insert_nop = sdma_v3_0_ring_insert_nop,
 	.pad_ib = sdma_v3_0_ring_pad_ib,
-	.get_emit_ib_size = sdma_v3_0_ring_get_emit_ib_size,
-	.get_dma_frame_size = sdma_v3_0_ring_get_dma_frame_size,
 };
 
 static void sdma_v3_0_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/si_dma.c +7 -18
index 9f11e37..c1c1b51 100644
@@ -495,22 +495,6 @@ static void si_dma_ring_emit_vm_flush(struct amdgpu_ring *ring,
 	amdgpu_ring_write(ring, (0 << 28) | 0x20); /* func(always) | poll interval */
 }
 
-static unsigned si_dma_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		7 + 3; /* si_dma_ring_emit_ib */
-}
-
-static unsigned si_dma_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		3 + /* si_dma_ring_emit_hdp_flush */
-		3 + /* si_dma_ring_emit_hdp_invalidate */
-		6 + /* si_dma_ring_emit_pipeline_sync */
-		12 + /* si_dma_ring_emit_vm_flush */
-		9 + 9 + 9; /* si_dma_ring_emit_fence x3 for user fence, vm fence */
-}
-
 static int si_dma_early_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -783,6 +767,13 @@ static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
+	.emit_frame_size =
+		3 + /* si_dma_ring_emit_hdp_flush */
+		3 + /* si_dma_ring_emit_hdp_invalidate */
+		6 + /* si_dma_ring_emit_pipeline_sync */
+		12 + /* si_dma_ring_emit_vm_flush */
+		9 + 9 + 9, /* si_dma_ring_emit_fence x3 for user fence, vm fence */
+	.emit_ib_size = 7 + 3, /* si_dma_ring_emit_ib */
 	.emit_ib = si_dma_ring_emit_ib,
 	.emit_fence = si_dma_ring_emit_fence,
 	.emit_pipeline_sync = si_dma_ring_emit_pipeline_sync,
@@ -793,8 +784,6 @@ static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.test_ib = si_dma_ring_test_ib,
 	.insert_nop = amdgpu_ring_insert_nop,
 	.pad_ib = si_dma_ring_pad_ib,
-	.get_emit_ib_size = si_dma_ring_get_emit_ib_size,
-	.get_dma_frame_size = si_dma_ring_get_dma_frame_size,
 };
 
 static void si_dma_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +5 -16
index f6c9415..708de99 100644
@@ -526,20 +526,6 @@ static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring,
 	amdgpu_ring_write(ring, ib->length_dw);
 }
 
-static unsigned uvd_v4_2_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		4; /* uvd_v4_2_ring_emit_ib */
-}
-
-static unsigned uvd_v4_2_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		2 + /* uvd_v4_2_ring_emit_hdp_flush */
-		2 + /* uvd_v4_2_ring_emit_hdp_invalidate */
-		14; /* uvd_v4_2_ring_emit_fence  x1 no user fence */
-}
-
 /**
  * uvd_v4_2_mc_resume - memory controller programming
  *
@@ -760,6 +746,11 @@ static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
 	.get_wptr = uvd_v4_2_ring_get_wptr,
 	.set_wptr = uvd_v4_2_ring_set_wptr,
 	.parse_cs = amdgpu_uvd_ring_parse_cs,
+	.emit_frame_size =
+		2 + /* uvd_v4_2_ring_emit_hdp_flush */
+		2 + /* uvd_v4_2_ring_emit_hdp_invalidate */
+		14, /* uvd_v4_2_ring_emit_fence  x1 no user fence */
+	.emit_ib_size = 4, /* uvd_v4_2_ring_emit_ib */
 	.emit_ib = uvd_v4_2_ring_emit_ib,
 	.emit_fence = uvd_v4_2_ring_emit_fence,
 	.emit_hdp_flush = uvd_v4_2_ring_emit_hdp_flush,
@@ -770,8 +761,6 @@ static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = amdgpu_uvd_ring_begin_use,
 	.end_use = amdgpu_uvd_ring_end_use,
-	.get_emit_ib_size = uvd_v4_2_ring_get_emit_ib_size,
-	.get_dma_frame_size = uvd_v4_2_ring_get_dma_frame_size,
 };
 
 static void uvd_v4_2_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +5 -16
index 400c16f..9e695e0 100644
@@ -577,20 +577,6 @@ static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring,
 	amdgpu_ring_write(ring, ib->length_dw);
 }
 
-static unsigned uvd_v5_0_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		6; /* uvd_v5_0_ring_emit_ib */
-}
-
-static unsigned uvd_v5_0_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		2 + /* uvd_v5_0_ring_emit_hdp_flush */
-		2 + /* uvd_v5_0_ring_emit_hdp_invalidate */
-		14; /* uvd_v5_0_ring_emit_fence  x1 no user fence */
-}
-
 static bool uvd_v5_0_is_idle(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -811,6 +797,11 @@ static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
 	.get_wptr = uvd_v5_0_ring_get_wptr,
 	.set_wptr = uvd_v5_0_ring_set_wptr,
 	.parse_cs = amdgpu_uvd_ring_parse_cs,
+	.emit_frame_size =
+		2 + /* uvd_v5_0_ring_emit_hdp_flush */
+		2 + /* uvd_v5_0_ring_emit_hdp_invalidate */
+		14, /* uvd_v5_0_ring_emit_fence  x1 no user fence */
+	.emit_ib_size = 6, /* uvd_v5_0_ring_emit_ib */
 	.emit_ib = uvd_v5_0_ring_emit_ib,
 	.emit_fence = uvd_v5_0_ring_emit_fence,
 	.emit_hdp_flush = uvd_v5_0_ring_emit_hdp_flush,
@@ -821,8 +812,6 @@ static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = amdgpu_uvd_ring_begin_use,
 	.end_use = amdgpu_uvd_ring_end_use,
-	.get_emit_ib_size = uvd_v5_0_ring_get_emit_ib_size,
-	.get_dma_frame_size = uvd_v5_0_ring_get_dma_frame_size,
 };
 
 static void uvd_v5_0_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +13 -29

72 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -2
index 76e64ad..7ada30d 100644
@@ -614,6 +614,8 @@ static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
 	.get_wptr = vce_v2_0_ring_get_wptr,
 	.set_wptr = vce_v2_0_ring_set_wptr,
 	.parse_cs = amdgpu_vce_ring_parse_cs,
+	.emit_frame_size = 6, /* amdgpu_vce_ring_emit_fence  x1 no user fence */
+	.emit_ib_size = 4, /* amdgpu_vce_ring_emit_ib */
 	.emit_ib = amdgpu_vce_ring_emit_ib,
 	.emit_fence = amdgpu_vce_ring_emit_fence,
 	.test_ring = amdgpu_vce_ring_test_ring,
@@ -622,8 +624,6 @@ static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = amdgpu_vce_ring_begin_use,
 	.end_use = amdgpu_vce_ring_end_use,
-	.get_emit_ib_size = amdgpu_vce_ring_get_emit_ib_size,
-	.get_dma_frame_size = amdgpu_vce_ring_get_dma_frame_size,
 };
 
 static void vce_v2_0_set_ring_funcs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +9 -25
index af91421..6303f2b 100644
@@ -809,27 +809,6 @@ static void vce_v3_0_emit_pipeline_sync(struct amdgpu_ring *ring)
 	amdgpu_ring_write(ring, seq);
 }
 
-static unsigned vce_v3_0_ring_get_emit_ib_size(struct amdgpu_ring *ring)
-{
-	return
-		5; /* vce_v3_0_ring_emit_ib */
-}
-
-static unsigned vce_v3_0_ring_get_dma_frame_size(struct amdgpu_ring *ring)
-{
-	return
-		4 + /* vce_v3_0_emit_pipeline_sync */
-		6; /* amdgpu_vce_ring_emit_fence x1 no user fence */
-}
-
-static unsigned vce_v3_0_ring_get_dma_frame_size_vm(struct amdgpu_ring *ring)
-{
-	return
-		6 + /* vce_v3_0_emit_vm_flush */
-		4 + /* vce_v3_0_emit_pipeline_sync */
-		6 + 6; /* amdgpu_vce_ring_emit_fence x2 vm fence */
-}
-
 const struct amd_ip_funcs vce_v3_0_ip_funcs = {
 	.name = "vce_v3_0",
 	.early_init = vce_v3_0_early_init,
@@ -855,6 +834,10 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
 	.get_wptr = vce_v3_0_ring_get_wptr,
 	.set_wptr = vce_v3_0_ring_set_wptr,
 	.parse_cs = amdgpu_vce_ring_parse_cs,
+	.emit_frame_size =
+		4 + /* vce_v3_0_emit_pipeline_sync */
+		6, /* amdgpu_vce_ring_emit_fence x1 no user fence */
+	.emit_ib_size = 5, /* vce_v3_0_ring_emit_ib */
 	.emit_ib = amdgpu_vce_ring_emit_ib,
 	.emit_fence = amdgpu_vce_ring_emit_fence,
 	.test_ring = amdgpu_vce_ring_test_ring,
@@ -863,14 +846,17 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = amdgpu_vce_ring_begin_use,
 	.end_use = amdgpu_vce_ring_end_use,
-	.get_emit_ib_size = vce_v3_0_ring_get_emit_ib_size,
-	.get_dma_frame_size = vce_v3_0_ring_get_dma_frame_size,
 };
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,
 	.set_wptr = vce_v3_0_ring_set_wptr,
+	.emit_frame_size =
+		6 + /* vce_v3_0_emit_vm_flush */
+		4 + /* vce_v3_0_emit_pipeline_sync */
+		6 + 6, /* amdgpu_vce_ring_emit_fence x2 vm fence */
+	.emit_ib_size = 4, /* amdgpu_vce_ring_emit_ib */
 	.emit_ib = vce_v3_0_ring_emit_ib,
 	.emit_vm_flush = vce_v3_0_emit_vm_flush,
 	.emit_pipeline_sync = vce_v3_0_emit_pipeline_sync,
@@ -881,8 +867,6 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.pad_ib = amdgpu_ring_generic_pad_ib,
 	.begin_use = amdgpu_vce_ring_begin_use,
 	.end_use = amdgpu_vce_ring_end_use,
-	.get_emit_ib_size = vce_v3_0_ring_get_emit_ib_size,
-	.get_dma_frame_size = vce_v3_0_ring_get_dma_frame_size_vm,
 };
 
 static void vce_v3_0_set_ring_funcs(struct amdgpu_device *adev)
Signature · 6 lines
2.5.0

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

PATCH 7/8 drm/amdgpu: move the ring type into the funcs structure

In reply to a message not in the archive

From: Christian König <[email protected]>

It's constant, so it doesn't make to much sense to keep it with the variable data.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c   |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c |  4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    | 12 ++++++------
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    | 16 ++++++++--------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 +++++++-------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  5 +++--
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  5 +++--
 drivers/gpu/drm/amd/amdgpu/si_dma.c      |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  3 ++-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  3 ++-
 16 files changed, 50 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -2
index a13e551..04b7aaf 100644
@@ -942,8 +942,8 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
 
 	/* UVD & VCE fw doesn't support user fences */
 	if (parser->job->uf_addr && (
-	    parser->job->ring->type == AMDGPU_RING_TYPE_UVD ||
-	    parser->job->ring->type == AMDGPU_RING_TYPE_VCE))
+	    parser->job->ring->funcs->type == AMDGPU_RING_TYPE_UVD ||
+	    parser->job->ring->funcs->type == AMDGPU_RING_TYPE_VCE))
 		return -EINVAL;
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -3
index e1fa873..b2df735 100644
@@ -164,8 +164,7 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
  */
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type,
-		     enum amdgpu_ring_type ring_type)
+		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
 {
 	int r;
 
@@ -218,7 +217,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 					     amdgpu_sched_hw_submission);
 	ring->align_mask = align_mask;
 	ring->nop = nop;
-	ring->type = ring_type;
 
 	/* Allocate ring buffer */
 	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3 -3
index 767843c..6cf89c9 100644
@@ -92,6 +92,8 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);
 
 /* provided by hw blocks that expose a ring buffer for commands */
 struct amdgpu_ring_funcs {
+	enum amdgpu_ring_type	type;
+
 	/* ring read/write ptr handling */
 	u32 (*get_rptr)(struct amdgpu_ring *ring);
 	u32 (*get_wptr)(struct amdgpu_ring *ring);
@@ -161,7 +163,6 @@ struct amdgpu_ring {
 	unsigned		wptr_offs;
 	unsigned		fence_offs;
 	uint64_t		current_ctx;
-	enum amdgpu_ring_type	type;
 	char			name[16];
 	unsigned		cond_exe_offs;
 	u64			cond_exe_gpu_addr;
@@ -178,8 +179,7 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring);
 void amdgpu_ring_undo(struct amdgpu_ring *ring);
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type,
-		     enum amdgpu_ring_type ring_type);
+		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
 void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
 #endif
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
index b8620d3..da66823 100644
@@ -348,7 +348,7 @@ static bool amdgpu_vm_ring_has_compute_vm_bug(struct amdgpu_ring *ring)
 	struct amdgpu_device *adev = ring->adev;
 	const struct amdgpu_ip_block_version *ip_block;
 
-	if (ring->type != AMDGPU_RING_TYPE_COMPUTE)
+	if (ring->funcs->type != AMDGPU_RING_TYPE_COMPUTE)
 		/* only compute rings */
 		return false;
 
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +3 -2
index bac3c14..f91f02f 100644
@@ -945,8 +945,8 @@ static int cik_sdma_sw_init(void *handle)
 				     SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
-				     AMDGPU_SDMA_IRQ_TRAP0 : AMDGPU_SDMA_IRQ_TRAP1,
-				     AMDGPU_RING_TYPE_SDMA);
+				     AMDGPU_SDMA_IRQ_TRAP0 :
+				     AMDGPU_SDMA_IRQ_TRAP1);
 		if (r)
 			return r;
 	}
@@ -1206,6 +1206,7 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_SDMA,
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +6 -6
index a86b179..1f8687fd 100644
@@ -1940,7 +1940,7 @@ static int gfx_v6_0_cp_resume(struct amdgpu_device *adev)
 
 static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 	uint32_t seq = ring->fence_drv.sync_seq;
 	uint64_t addr = ring->fence_drv.gpu_addr;
 
@@ -1966,7 +1966,7 @@ static void gfx_v6_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 static void gfx_v6_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 					unsigned vm_id, uint64_t pd_addr)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
 	/* write new base address */
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
@@ -2870,8 +2870,7 @@ static int gfx_v6_0_sw_init(void *handle)
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     0x80000000, 0xff,
-				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
-				     AMDGPU_RING_TYPE_GFX);
+				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
 	}
@@ -2894,8 +2893,7 @@ static int gfx_v6_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     0x80000000, 0xff,
-				     &adev->gfx.eop_irq, irq_type,
-				     AMDGPU_RING_TYPE_COMPUTE);
+				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
 	}
@@ -3228,6 +3226,7 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
+	.type = AMDGPU_RING_TYPE_GFX,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_gfx,
@@ -3252,6 +3251,7 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
+	.type = AMDGPU_RING_TYPE_COMPUTE,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +8 -8
index 99fb839..be3881e 100644
@@ -2077,9 +2077,9 @@ static int gfx_v7_0_ring_test_ring(struct amdgpu_ring *ring)
 static void gfx_v7_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
 {
 	u32 ref_and_mask;
-	int usepfp = ring->type == AMDGPU_RING_TYPE_COMPUTE ? 0 : 1;
+	int usepfp = ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE ? 0 : 1;
 
-	if (ring->type == AMDGPU_RING_TYPE_COMPUTE) {
+	if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) {
 		switch (ring->me) {
 		case 1:
 			ref_and_mask = GPU_HDP_FLUSH_DONE__CP2_MASK << ring->pipe;
@@ -3216,7 +3216,7 @@ static int gfx_v7_0_cp_resume(struct amdgpu_device *adev)
  */
 static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 	uint32_t seq = ring->fence_drv.sync_seq;
 	uint64_t addr = ring->fence_drv.gpu_addr;
 
@@ -3256,7 +3256,7 @@ static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 					unsigned vm_id, uint64_t pd_addr)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
 	amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
@@ -4606,8 +4606,7 @@ static int gfx_v7_0_sw_init(void *handle)
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
-				     AMDGPU_RING_TYPE_GFX);
+				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
 	}
@@ -4633,8 +4632,7 @@ static int gfx_v7_0_sw_init(void *handle)
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type,
-				     AMDGPU_RING_TYPE_COMPUTE);
+				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
 	}
@@ -5103,6 +5101,7 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
+	.type = AMDGPU_RING_TYPE_GFX,
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v7_0_ring_set_wptr_gfx,
@@ -5130,6 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
+	.type = AMDGPU_RING_TYPE_COMPUTE,
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v7_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -7
index 768a8fd..0d66f49 100644
@@ -2063,8 +2063,7 @@ static int gfx_v8_0_sw_init(void *handle)
 
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP,
-				     AMDGPU_RING_TYPE_GFX);
+				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
 	}
@@ -2090,8 +2089,7 @@ static int gfx_v8_0_sw_init(void *handle)
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
 		r = amdgpu_ring_init(adev, ring, 1024,
 				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type,
-				     AMDGPU_RING_TYPE_COMPUTE);
+				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
 	}
@@ -6131,7 +6129,7 @@ static void gfx_v8_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
 {
 	u32 ref_and_mask, reg_mem_engine;
 
-	if (ring->type == AMDGPU_RING_TYPE_COMPUTE) {
+	if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) {
 		switch (ring->me) {
 		case 1:
 			ref_and_mask = GPU_HDP_FLUSH_DONE__CP2_MASK << ring->pipe;
@@ -6233,7 +6231,7 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr,
 
 static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 	uint32_t seq = ring->fence_drv.sync_seq;
 	uint64_t addr = ring->fence_drv.gpu_addr;
 
@@ -6251,7 +6249,7 @@ static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 					unsigned vm_id, uint64_t pd_addr)
 {
-	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
+	int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);
 
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
 	amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
@@ -6533,6 +6531,7 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
+	.type = AMDGPU_RING_TYPE_GFX,
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx,
@@ -6562,6 +6561,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 };
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
+	.type = AMDGPU_RING_TYPE_COMPUTE,
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +3 -2
index b797900..b11a81e 100644
@@ -956,8 +956,8 @@ static int sdma_v2_4_sw_init(void *handle)
 				     SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
-				     AMDGPU_SDMA_IRQ_TRAP0 : AMDGPU_SDMA_IRQ_TRAP1,
-				     AMDGPU_RING_TYPE_SDMA);
+				     AMDGPU_SDMA_IRQ_TRAP0 :
+				     AMDGPU_SDMA_IRQ_TRAP1);
 		if (r)
 			return r;
 	}
@@ -1210,6 +1210,7 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_SDMA,
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +3 -2
index 891de21..accf4d1 100644
@@ -1168,8 +1168,8 @@ static int sdma_v3_0_sw_init(void *handle)
 				     SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
-				     AMDGPU_SDMA_IRQ_TRAP0 : AMDGPU_SDMA_IRQ_TRAP1,
-				     AMDGPU_RING_TYPE_SDMA);
+				     AMDGPU_SDMA_IRQ_TRAP0 :
+				     AMDGPU_SDMA_IRQ_TRAP1);
 		if (r)
 			return r;
 	}
@@ -1555,6 +1555,7 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_SDMA,
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/si_dma.c +3 -2
index c1c1b51..1aee45b 100644
@@ -534,8 +534,8 @@ static int si_dma_sw_init(void *handle)
 				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
-				     AMDGPU_SDMA_IRQ_TRAP0 : AMDGPU_SDMA_IRQ_TRAP1,
-				     AMDGPU_RING_TYPE_SDMA);
+				     AMDGPU_SDMA_IRQ_TRAP0 :
+				     AMDGPU_SDMA_IRQ_TRAP1);
 		if (r)
 			return r;
 	}
@@ -764,6 +764,7 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_SDMA,
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
index 708de99..55af8ac 100644
@@ -117,7 +117,7 @@ static int uvd_v4_2_sw_init(void *handle)
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0, AMDGPU_RING_TYPE_UVD);
+			     &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -742,6 +742,7 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_UVD,
 	.get_rptr = uvd_v4_2_ring_get_rptr,
 	.get_wptr = uvd_v4_2_ring_get_wptr,
 	.set_wptr = uvd_v4_2_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -1
index 9e695e0..21e725b 100644
@@ -113,7 +113,7 @@ static int uvd_v5_0_sw_init(void *handle)
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0, AMDGPU_RING_TYPE_UVD);
+			     &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -793,6 +793,7 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_UVD,
 	.get_rptr = uvd_v5_0_ring_get_rptr,
 	.get_wptr = uvd_v5_0_ring_get_wptr,
 	.set_wptr = uvd_v5_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -1
index e6abd86..2ce1818 100644
@@ -117,7 +117,7 @@ static int uvd_v6_0_sw_init(void *handle)
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0, AMDGPU_RING_TYPE_UVD);
+			     &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -1046,6 +1046,7 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = {
 };
 
 static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
+	.type = AMDGPU_RING_TYPE_UVD,
 	.get_rptr = uvd_v6_0_ring_get_rptr,
 	.get_wptr = uvd_v6_0_ring_get_wptr,
 	.set_wptr = uvd_v6_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -1
index 7ada30d..cf0c68f 100644
@@ -225,7 +225,7 @@ static int vce_v2_0_sw_init(void *handle)
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0, AMDGPU_RING_TYPE_VCE);
+				     &adev->vce.irq, 0);
 		if (r)
 			return r;
 	}
@@ -610,6 +610,7 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 };
 
 static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
+	.type = AMDGPU_RING_TYPE_VCE,
 	.get_rptr = vce_v2_0_ring_get_rptr,
 	.get_wptr = vce_v2_0_ring_get_wptr,
 	.set_wptr = vce_v2_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -1
index 6303f2b..56a3feb 100644
@@ -390,7 +390,7 @@ static int vce_v3_0_sw_init(void *handle)
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
 		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0, AMDGPU_RING_TYPE_VCE);
+				     &adev->vce.irq, 0);
 		if (r)
 			return r;
 	}
@@ -849,6 +849,7 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
 };
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
+	.type = AMDGPU_RING_TYPE_VCE,
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,
 	.set_wptr = vce_v3_0_ring_set_wptr,
Signature · 6 lines
2.5.0

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

PATCH 8/8 drm/amdgpu: move align_mask and nop into ring funcs as well

In reply to a message not in the archive

From: Christian König <[email protected]>

They are constant as well.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
 14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +9 -10
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw)
 {
 	/* Align requested size with padding so unlock_commit can
 	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
 	/* Make sure we aren't trying to allocate more space
 	 * than the maximum for one submission
@@ -94,7 +94,7 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 	int i;
 
 	for (i = 0; i < count; i++)
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
 /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets
@@ -106,8 +106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
  */
 void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib)
 {
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
 }
 
 /**
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
 	uint32_t count;
 
 	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
 	ring->funcs->insert_nop(ring, count);
 
 	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
  * Returns 0 on success, error on failure.
  */
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
 {
 	int r;
 
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 
 	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
 					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
 	/* Allocate ring buffer */
 	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +4 -4
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);
 /* provided by hw blocks that expose a ring buffer for commands */
 struct amdgpu_ring_funcs {
 	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
 	/* ring read/write ptr handling */
 	u32 (*get_rptr)(struct amdgpu_ring *ring);
@@ -149,10 +151,8 @@ struct amdgpu_ring {
 	unsigned		max_dw;
 	int			count_dw;
 	uint64_t		gpu_addr;
-	uint32_t		align_mask;
 	uint32_t		ptr_mask;
 	bool			ready;
-	u32			nop;
 	u32			idx;
 	u32			me;
 	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib);
 void amdgpu_ring_commit(struct amdgpu_ring *ring);
 void amdgpu_ring_undo(struct amdgpu_ring *ring);
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
 void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
 #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +4 -3
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 					  SDMA_NOP_COUNT(count - 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
 /**
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -2
index 1f8687fd..367b14e 100644
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_gfx,
@@ -3252,6 +3252,8 @@ static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +4 -2
index be3881e..15f24bd 100644
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v7_0_ring_set_wptr_gfx,
@@ -5130,6 +5130,8 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v7_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +8 -6
index 0d66f49..51f1139 100644
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
 			ring->doorbell_index = AMDGPU_DOORBELL_GFX_RING0;
 		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
 			return r;
 	}
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
 		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead */
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
 		if (r)
 			return r;
 	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx,
@@ -6562,6 +6562,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +4 -3
index b11a81e..49c47d6 100644
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count - 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
 /**
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +4 -3
index accf4d1..f8ec370 100644
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count - 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
 /**
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -1
index 1aee45b..7fece1f 100644
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +3 -2
index 55af8ac..1bab75a 100644
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v4_2_ring_get_rptr,
 	.get_wptr = uvd_v4_2_ring_get_wptr,
 	.set_wptr = uvd_v4_2_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +3 -2
index 21e725b..ec848fc 100644
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v5_0_ring_get_rptr,
 	.get_wptr = uvd_v5_0_ring_get_wptr,
 	.set_wptr = uvd_v5_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -2
index 2ce1818..15708f8 100644
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;
 }
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v6_0_ring_get_rptr,
 	.get_wptr = uvd_v6_0_ring_get_wptr,
 	.set_wptr = uvd_v6_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index cf0c68f..d585839 100644
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
 				     &adev->vce.irq, 0);
 		if (r)
 			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v2_0_ring_get_rptr,
 	.get_wptr = vce_v2_0_ring_get_wptr,
 	.set_wptr = vce_v2_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
index 56a3feb..f7dbd0d 100644
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
 		if (r)
 			return r;
 	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,
 	.set_wptr = vce_v3_0_ring_set_wptr,
Signature · 6 lines
2.5.0

_______________________________________________
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): 1475676809-3061-8-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#12 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Wednesday, October 05, 2016 10:13 AM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 5 lines

From: Christian König <[email protected]>

They are constant as well.

Patches 1-3, 5-8 are:

Quoted 530 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++----------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
 14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)
 {
 	/* Align requested size with padding so unlock_commit can
 	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
 	/* Make sure we aren't trying to allocate more space
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
 	 * than the maximum for one submission
@@ -94,7 +94,7 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring
 *ring, uint32_t count)
 	int i;
 
 	for (i = 0; i < count; i++)
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
 }
 

/** amdgpu_ring_generic_pad_ib - pad IB with NOP packets

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
@@ -106,8 +106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring
 *ring, uint32_t count)
  */
 void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
 amdgpu_ib *ib)
 {
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
 }

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +5 -6
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
 	uint32_t count;
 
 	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
 	ring->funcs->insert_nop(ring, count);
 
 	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
  * Returns 0 on success, error on failure.
  */
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring
 *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
 {
 	int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 
 	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
 					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
 	/* Allocate ring buffer */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
 	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
 /* provided by hw blocks that expose a ring buffer for commands */
 struct amdgpu_ring_funcs {
 	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
 	/* ring read/write ptr handling */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -4
 	u32 (*get_rptr)(struct amdgpu_ring *ring);
@@ -149,10 +151,8 @@ struct amdgpu_ring {
 	unsigned		max_dw;
 	int			count_dw;
 	uint64_t		gpu_addr;
-	uint32_t		align_mask;
 	uint32_t		ptr_mask;
 	bool			ready;
-	u32			nop;
 	u32			idx;
 	u32			me;
 	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct
 amdgpu_ring *ring, struct amdgpu_ib *ib);
 void amdgpu_ring_commit(struct amdgpu_ring *ring);
 void amdgpu_ring_undo(struct amdgpu_ring *ring);
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring
 *ring,
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
 void amdgpu_ring_fini(struct amdgpu_ring *ring);

#endif

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 					  SDMA_NOP_COUNT(count - 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }
 

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
index 1f8687fd..367b14e 100644
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +5 -1
 			return r;
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_gfx,
@@ -3252,6 +3252,8 @@ static const struct amdgpu_ring_funcs
 gfx_v6_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 	.set_wptr = gfx_v6_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
index be3881e..15f24bd 100644
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +5 -1
 			return r;
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v7_0_ring_set_wptr_gfx,
@@ -5130,6 +5130,8 @@ static const struct amdgpu_ring_funcs
 gfx_v7_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 	.set_wptr = gfx_v7_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
index 0d66f49..51f1139 100644
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
 			ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
 		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -3
 			return r;
 	}
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
 		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
 >pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
 		if (r)
 			return r;
 	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx,
@@ -6562,6 +6562,8 @@ static const struct amdgpu_ring_funcs
 gfx_v8_0_ring_funcs_gfx = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -2
index b11a81e..49c47d6 100644
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
index accf4d1..f8ec370 100644
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
index 1aee45b..7fece1f 100644
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
index 55af8ac..1bab75a 100644
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v4_2_ring_get_rptr,
 	.get_wptr = uvd_v4_2_ring_get_wptr,
 	.set_wptr = uvd_v4_2_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
index 21e725b..ec848fc 100644
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v5_0_ring_get_rptr,
 	.get_wptr = uvd_v5_0_ring_get_wptr,
 	.set_wptr = uvd_v5_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
index 2ce1818..15708f8 100644
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v6_0_ring_get_rptr,
 	.get_wptr = uvd_v6_0_ring_get_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
 	.set_wptr = uvd_v6_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index cf0c68f..d585839 100644
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
 				     &adev->vce.irq, 0);
 		if (r)
 			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v2_0_ring_get_rptr,
 	.get_wptr = vce_v2_0_ring_get_wptr,
 	.set_wptr = vce_v2_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
index 56a3feb..f7dbd0d 100644
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
 		if (r)
 			return r;
 	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,

.set_wptr = vce_v3_0_ring_set_wptr,
--
2.5.0

Quoted 4 lines

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

_______________________________________________
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): [email protected]

#15 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Am 11.10.2016 um 15:13 schrieb Andy Furniss:

Quoted 8 lines
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

They are constant as well.

I die on driver load with this commit on R9285 testing on 4.9-wip.

Probably just a typo in the hardware handling.

Going to switch to my Tonga in a minute, but I only got about half an hour left before I need to get my daughter from kindergarten.

Christian.
_______________________________________________
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): 82e102e9-cd1b-10ce-75ca-201ef4b802d4-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#17 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

It dies on my Tonga just FYI (save you some trouble).

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]>
Sent: Tuesday, October 11, 2016 09:26
To: Andy Furniss; [email protected]
Subject: Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Am 11.10.2016 um 15:13 schrieb Andy Furniss:

Quoted 8 lines
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

They are constant as well.

I die on driver load with this commit on R9285 testing on 4.9-wip.

Probably just a typo in the hardware handling.

Going to switch to my Tonga in a minute, but I only got about half an hour left before I need to get my daughter from kindergarten.

Christian.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

_______________________________________________
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): CY4PR12MB1768C74FCED56F7663ABCE5BF7DA0-rpdhrqHFk06yjjPBNVDk/[email protected]

#19 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Turned out I just missed adding the three lines to the physical mode for VCE on Tonga as well.

Please test and review the patch I've just send to the mailing list.

Regards,
Christian.

Am 11.10.2016 um 15:28 schrieb StDenis, Tom:

Quoted 40 lines

It dies on my Tonga just FYI (save you some trouble).

Tom

------------------------------------------------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Christian König <[email protected]> *Sent:* Tuesday, October 11, 2016 09:26
*To:* Andy Furniss; [email protected]
*Subject:* Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well
Am 11.10.2016 um 15:13 schrieb Andy Furniss:

Quoted 8 lines
Quoted 3 lines · Christian König

From: Christian König <[email protected]>

They are constant as well.

I die on driver load with this commit on R9285 testing on 4.9-wip.

Probably just a typo in the hardware handling.

Going to switch to my Tonga in a minute, but I only got about half an hour left before I need to get my daughter from kindergarten.

Christian.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

Quoted 4 lines

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

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

#20 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

In reply to a message not in the archive

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct field into amdgpu_ring struct? I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the amdgpu_ring will lost the meaning.

Thanks!
Xiangliang Yu

Quoted 535 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++----------
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
 14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)  {
 	/* Align requested size with padding so unlock_commit can
 	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
 	/* Make sure we aren't trying to allocate more space
 	 * than the maximum for one submission @@ -94,7 +94,7 @@ void

amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
 	int i;
 
 	for (i = 0; i < count; i++)
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
 /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@ -106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +7 -8
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
 }
 
 /**
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
 	uint32_t count;
 
 	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
 	ring->funcs->insert_nop(ring, count);
 
 	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
  * Returns 0 on success, error on failure.
  */
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring
 *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
 {
 	int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 
 	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
 					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
 	/* Allocate ring buffer */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
 	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
 /* provided by hw blocks that expose a ring buffer for commands */  struct
 amdgpu_ring_funcs {
 	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
 	/* ring read/write ptr handling */

u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10 +151,8 @@
struct amdgpu_ring {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -2
 	unsigned		max_dw;
 	int			count_dw;
 	uint64_t		gpu_addr;
-	uint32_t		align_mask;
 	uint32_t		ptr_mask;
 	bool			ready;
-	u32			nop;
 	u32			idx;
 	u32			me;
 	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
 void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
 #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 					  SDMA_NOP_COUNT(count - 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }
 

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
 	.get_rptr = cik_sdma_ring_get_rptr,
 	.get_wptr = cik_sdma_ring_get_wptr,
 	.set_wptr = cik_sdma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
index 1f8687fd..367b14e 100644
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
 			return r;
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
 		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6 +3252,8 @@

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
 	.get_rptr = gfx_v6_0_ring_get_rptr,
 	.get_wptr = gfx_v6_0_ring_get_wptr,
 	.set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		ring->ring_obj = NULL;
 		sprintf(ring->name, "gfx");
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
 			return r;
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
 				     &adev->gfx.eop_irq, irq_type);
 		if (r)
 			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6 +5130,8 @@

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v7_0_ring_get_rptr,
 	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
 			ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
 		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
 		if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -3
 			return r;
 	}
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
 		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
 >pipe, ring->queue);
 		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
 		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
 		if (r)
 			return r;
 	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
 	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
 	.set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6 +6562,8 @@

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
 	.type = AMDGPU_RING_TYPE_COMPUTE,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
 	.get_rptr = gfx_v8_0_ring_get_rptr,
 	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
 	.set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -2
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v2_4_ring_get_rptr,
 	.get_wptr = sdma_v2_4_ring_get_wptr,
 	.set_wptr = sdma_v2_4_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
index accf4d1..f8ec370 100644
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
 	for (i = 0; i < count; i++)
 		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
 				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
 		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
 }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
 	.get_rptr = sdma_v3_0_ring_get_rptr,
 	.get_wptr = sdma_v3_0_ring_get_wptr,
 	.set_wptr = sdma_v3_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
index 1aee45b..7fece1f 100644
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
 		ring->use_doorbell = false;
 		sprintf(ring->name, "sdma%d", i);
 		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
 				     &adev->sdma.trap_irq,
 				     (i == 0) ?
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
 				     AMDGPU_SDMA_IRQ_TRAP0 :
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
 static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
 	.get_rptr = si_dma_ring_get_rptr,
 	.get_wptr = si_dma_ring_get_wptr,
 	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
index 55af8ac..1bab75a 100644
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v4_2_ring_get_rptr,
 	.get_wptr = uvd_v4_2_ring_get_wptr,
 	.set_wptr = uvd_v4_2_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
index 21e725b..ec848fc 100644
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v5_0_ring_get_rptr,
 	.get_wptr = uvd_v5_0_ring_get_wptr,
 	.set_wptr = uvd_v5_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
index 2ce1818..15708f8 100644
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
 	ring = &adev->uvd.ring;
 	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
 	return r;

}

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
 	.get_rptr = uvd_v6_0_ring_get_rptr,
 	.get_wptr = uvd_v6_0_ring_get_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
 	.set_wptr = uvd_v6_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index cf0c68f..d585839 100644
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
 				     &adev->vce.irq, 0);
 		if (r)
 			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v2_0_ring_get_rptr,
 	.get_wptr = vce_v2_0_ring_get_wptr,
 	.set_wptr = vce_v2_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
index 56a3feb..f7dbd0d 100644
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
 	for (i = 0; i < adev->vce.num_rings; i++) {
 		ring = &adev->vce.ring[i];
 		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
 		if (r)
 			return r;
 	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
 static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
 	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
 	.get_rptr = vce_v3_0_ring_get_rptr,
 	.get_wptr = vce_v3_0_ring_get_wptr,

.set_wptr = vce_v3_0_ring_set_wptr,
--
2.5.0

Quoted 4 lines

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

_______________________________________________
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): CY4PR12MB1701A02391D1C48C729FF51EEBAB0-rpdhrqHFk05QaJCA3gGb3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author NAK
#22 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Hi Xiangliang,

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 545 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct field into amdgpu_ring struct? I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the amdgpu_ring will lost the meaning.

Thanks!
Xiangliang Yu

Quoted 535 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++----------
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
  14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)  {
  	/* Align requested size with padding so unlock_commit can
  	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
  	/* Make sure we aren't trying to allocate more space
  	 * than the maximum for one submission @@ -94,7 +94,7 @@ void

amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
int i;

for (i = 0; i < count; i++)

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
  /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@ -106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +7 -8
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
  }
 
  /**
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
  	uint32_t count;
 
  	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
  	ring->funcs->insert_nop(ring, count);
 
  	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
   * Returns 0 on success, error on failure.
   */
  int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring
 *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
  {
  	int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 
  	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
  					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
  	/* Allocate ring buffer */
  	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
  /* provided by hw blocks that expose a ring buffer for commands */  struct
 amdgpu_ring_funcs {
  	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
  	/* ring read/write ptr handling */

u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10 +151,8 @@
struct amdgpu_ring {
unsigned max_dw;
int count_dw;
uint64_t gpu_addr;

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -2
-	uint32_t		align_mask;
  	uint32_t		ptr_mask;
  	bool			ready;
-	u32			nop;
  	u32			idx;
  	u32			me;
  	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
  void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
  #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  					  SDMA_NOP_COUNT(count - 1));
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
 
  static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
  	.get_rptr = cik_sdma_ring_get_rptr,
  	.get_wptr = cik_sdma_ring_get_wptr,
  	.set_wptr = cik_sdma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
index 1f8687fd..367b14e 100644
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6 +3252,8 @@

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {

  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6 +5130,8 @@

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {

  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
  			ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
  		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -3
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
  		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
 > pipe, ring->queue);
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead
 */
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
  		if (r)
  			return r;
  	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6 +6562,8 @@

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {

  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -2
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v2_4_ring_get_rptr,
  	.get_wptr = sdma_v2_4_ring_get_wptr,
  	.set_wptr = sdma_v2_4_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
index accf4d1..f8ec370 100644
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -
 1));
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v3_0_ring_get_rptr,
  	.get_wptr = sdma_v3_0_ring_get_wptr,
  	.set_wptr = sdma_v3_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
index 1aee45b..7fece1f 100644
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
  static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
  	.get_rptr = si_dma_ring_get_rptr,
  	.get_wptr = si_dma_ring_get_wptr,
  	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
index 55af8ac..1bab75a 100644
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v4_2_ring_get_rptr,
  	.get_wptr = uvd_v4_2_ring_get_wptr,
  	.set_wptr = uvd_v4_2_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
index 21e725b..ec848fc 100644
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v5_0_ring_get_rptr,
  	.get_wptr = uvd_v5_0_ring_get_wptr,
  	.set_wptr = uvd_v5_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
index 2ce1818..15708f8 100644
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v6_0_ring_get_rptr,
  	.get_wptr = uvd_v6_0_ring_get_wptr,

.set_wptr = uvd_v6_0_ring_set_wptr,

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
index cf0c68f..d585839 100644
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
  				     &adev->vce.irq, 0);
  		if (r)
  			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v2_0_ring_get_rptr,
  	.get_wptr = vce_v2_0_ring_get_wptr,
  	.set_wptr = vce_v2_0_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
index 56a3feb..f7dbd0d 100644
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
  		if (r)
  			return r;
  	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v3_0_ring_get_rptr,
  	.get_wptr = vce_v3_0_ring_get_wptr,

.set_wptr = vce_v3_0_ring_set_wptr,
--
2.5.0

Quoted 4 lines
Quoted 4 lines

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

_______________________________________________
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): 0d8b9683-01c5-0fdc-d52f-bfdf2a0fa67c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#24 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 8 lines

Hi Xiangliang,

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

Why not create a new structure for the constant data? It can make code more flexible. Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 562 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 3 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

amdgpu_ring will lost the meaning.

Quoted 69 lines

Thanks!
Xiangliang Yu

Quoted 64 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++----------
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
  14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)  {
  	/* Align requested size with padding so unlock_commit can
  	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
  	/* Make sure we aren't trying to allocate more space
  	 * than the maximum for one submission @@ -94,7 +94,7 @@ void

amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
int i;

for (i = 0; i < count; i++)

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
  /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@ -106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
  }
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct amdgpu_ring

Quoted 2 lines

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring

*ring)

Quoted 55 lines
Quoted 55 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +5 -6
  	uint32_t count;
 
  	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
  	ring->funcs->insert_nop(ring, count);
 
  	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
   * Returns 0 on success, error on failure.
   */
  int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring
 *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
  {
  	int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 
  	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
  					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
  	/* Allocate ring buffer */
  	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
  /* provided by hw blocks that expose a ring buffer for commands */
 struct amdgpu_ring_funcs {
  	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
  	/* ring read/write ptr handling */

u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10 +151,8 @@
struct amdgpu_ring {
unsigned max_dw;
int count_dw;
uint64_t gpu_addr;

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-	uint32_t		align_mask;
  	uint32_t		ptr_mask;
  	bool			ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-	u32			nop;
  	u32			idx;
  	u32			me;
  	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
  void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
  #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  					  SDMA_NOP_COUNT(count - 1));
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/cik_sdma.c const struct amd_ip_funcs cik_sdma_ip_funcs =

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs =

{

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
  static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
  	.get_rptr = cik_sdma_ring_get_rptr,
  	.get_wptr = cik_sdma_ring_get_wptr,
  	.set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c const struct amd_ip_funcs gfx_v6_0_ip_funcs =

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -1
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs =

{

Quoted 27 lines
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6 +3252,8 @@
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static int gfx_v7_0_sw_init(void *handle) · line 4632

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -0
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c const struct amd_ip_funcs gfx_v7_0_ip_funcs =

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs =

{

Quoted 38 lines
Quoted 38 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6 +5130,8 @@
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
  			ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
  		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
  		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_sw_init(void *handle) · line 2090

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
 > pipe, ring->queue);
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c const struct amd_ip_funcs gfx_v8_0_ip_funcs =

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
  		if (r)
  			return r;
  	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs =

{

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6 +6562,8 @@
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
  	.type = AMDGPU_RING_TYPE_COMPUTE,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c static void sdma_v2_4_ring_insert_nop(struct · line 241

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs sdma_v2_4_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs

=

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v2_4_ring_get_rptr,
  	.get_wptr = sdma_v2_4_ring_get_wptr,

.set_wptr = sdma_v2_4_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static void sdma_v3_0_ring_insert_nop(struct · line 401

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs sdma_v3_0_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs

=

Quoted 159 lines
Quoted 159 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v3_0_ring_get_rptr,
  	.get_wptr = sdma_v3_0_ring_get_wptr,

.set_wptr = sdma_v3_0_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
  static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
  	.get_rptr = si_dma_ring_get_rptr,
  	.get_wptr = si_dma_ring_get_wptr,
  	.set_wptr = si_dma_ring_set_wptr,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
index 55af8ac..1bab75a 100644
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v4_2_ring_get_rptr,
  	.get_wptr = uvd_v4_2_ring_get_wptr,
  	.set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v5_0_ring_get_rptr,
  	.get_wptr = uvd_v5_0_ring_get_wptr,
  	.set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v6_0_ring_get_rptr,
  	.get_wptr = uvd_v6_0_ring_get_wptr,

.set_wptr = uvd_v6_0_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -1
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
  				     &adev->vce.irq, 0);
  		if (r)
  			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v2_0_ring_get_rptr,
  	.get_wptr = vce_v2_0_ring_get_wptr,
  	.set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 56a3feb..f7dbd0d 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
  		if (r)
  			return r;
  	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v3_0_ring_get_rptr,
  	.get_wptr = vce_v3_0_ring_get_wptr,

.set_wptr = vce_v3_0_ring_set_wptr,
--
2.5.0

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

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

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

_______________________________________________
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): CY4PR12MB170187E251705A2617860F49EBAB0-rpdhrqHFk05QaJCA3gGb3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#26 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 9 lines
Quoted 9 lines

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

What benefit to put the constant data into the structure?
If no, I'll create a new patch that create new structure for these constant data.

Quoted 593 lines

Why not create a new structure for the constant data? It can make code more flexible.
Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 5 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 28 lines
Quoted 4 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

amdgpu_ring will lost the meaning.

Quoted 20 lines

Thanks!
Xiangliang Yu

Quoted 15 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++--------

--

Quoted 63 lines
Quoted 50 lines
Quoted 50 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++----

  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
  14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)  {
  	/* Align requested size with padding so unlock_commit can
  	 * pad safely */
-	ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+	ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
  	/* Make sure we aren't trying to allocate more space
  	 * than the maximum for one submission @@ -94,7 +94,7 @@ void

amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
int i;

for (i = 0; i < count; i++)

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-		amdgpu_ring_write(ring, ring->nop);
+		amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
  /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@
-106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-	while (ib->length_dw & ring->align_mask)
-		ib->ptr[ib->length_dw++] = ring->nop;
+	while (ib->length_dw & ring->funcs->align_mask)
+		ib->ptr[ib->length_dw++] = ring->funcs->nop;
  }
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct amdgpu_ring

Quoted 2 lines

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring

*ring)

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
  	uint32_t count;
 
  	/* We pad to match fetch size */
-	count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-	count %= ring->align_mask + 1;
+	count = ring->funcs->align_mask + 1 -
+		(ring->wptr & ring->funcs->align_mask);
+	count %= ring->funcs->align_mask + 1;
  	ring->funcs->insert_nop(ring, count);
 
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct amdgpu_ring

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
  	mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring

*ring)

Quoted 77 lines
Quoted 43 lines
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -4
   * Returns 0 on success, error on failure.
   */
  int amdgpu_ring_init(struct amdgpu_device *adev, struct
 amdgpu_ring *ring,
-		     unsigned max_dw, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+		     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type)
  {
  	int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device
 *adev, struct amdgpu_ring *ring,
 
  	ring->ring_size = roundup_pow_of_two(max_dw * 4 *
  					     amdgpu_sched_hw_submission);
-	ring->align_mask = align_mask;
-	ring->nop = nop;
 
  	/* Allocate ring buffer */
  	if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
  /* provided by hw blocks that expose a ring buffer for commands
 */ struct amdgpu_ring_funcs {
  	enum amdgpu_ring_type	type;
+	uint32_t		align_mask;
+	u32			nop;
 
  	/* ring read/write ptr handling */

u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10 +151,8 @@
struct amdgpu_ring {
unsigned max_dw;
int count_dw;
uint64_t gpu_addr;

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-	uint32_t		align_mask;
  	uint32_t		ptr_mask;
  	bool			ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-	u32			nop;
  	u32			idx;
  	u32			me;
  	u32			pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-		     unsigned ring_size, u32 nop, u32 align_mask,
-		     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+		     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+		     unsigned irq_type);
  void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
  #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  					  SDMA_NOP_COUNT(count - 1));
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/cik_sdma.c const struct amd_ip_funcs cik_sdma_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs

=

Quoted 26 lines

{

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
  static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
  	.get_rptr = cik_sdma_ring_get_rptr,
  	.get_wptr = cik_sdma_ring_get_wptr,
  	.set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
  		sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c const struct amd_ip_funcs gfx_v6_0_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -1
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     0x80000000, 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs

=

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6 +3252,8 @@
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
Quoted 1 line
Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute

= {

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = 0x80000000,
  	.get_rptr = gfx_v6_0_ring_get_rptr,
  	.get_wptr = gfx_v6_0_ring_get_wptr,
  	.set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		ring->ring_obj = NULL;
  		sprintf(ring->name, "gfx");
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static int gfx_v7_0_sw_init(void *handle) · line 4632

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
  				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)

return r;

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -0
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c const struct amd_ip_funcs gfx_v7_0_ip_funcs

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
  				     &adev->gfx.eop_irq, irq_type);
  		if (r)
  			return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs

=

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6 +5130,8 @@
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
Quoted 1 line
Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute

= {

Quoted 32 lines
Quoted 27 lines
Quoted 27 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v7_0_ring_get_rptr,
  	.get_wptr = gfx_v7_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
  			ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
  		}
 
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     AMDGPU_CP_IRQ_GFX_EOP);
  		if (r)
  			return r;
  	}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
  		sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_sw_init(void *handle) · line 2090

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
 > pipe, ring->queue);
  		irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
  		/* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c const struct amd_ip_funcs gfx_v8_0_ip_funcs

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
-		r = amdgpu_ring_init(adev, ring, 1024,
-				     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-				     &adev->gfx.eop_irq, irq_type);
+		r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+				     irq_type);
  		if (r)
  			return r;
  	}
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs

=

Quoted 11 lines

{

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
  	.type = AMDGPU_RING_TYPE_GFX,
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_gfx,
  	.set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6 +6562,8 @@
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
Quoted 1 line
Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute

= {

Quoted 25 lines
Quoted 14 lines
Quoted 14 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+	.align_mask = 0xff,
+	.nop = PACKET3(PACKET3_NOP, 0x3FFF),
  	.get_rptr = gfx_v8_0_ring_get_rptr,
  	.get_wptr = gfx_v8_0_ring_get_wptr_compute,
  	.set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c static void sdma_v2_4_ring_insert_nop(struct · line 241

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs

sdma_v2_4_ip_funcs

Quoted 32 lines

=

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v2_4_ring_get_rptr,
  	.get_wptr = sdma_v2_4_ring_get_wptr,

.set_wptr = sdma_v2_4_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static void sdma_v3_0_ring_insert_nop(struct · line 401

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
  	for (i = 0; i < count; i++)
  		if (sdma && sdma->burst_nop && (i == 0))
-			amdgpu_ring_write(ring, ring->nop |
+			amdgpu_ring_write(ring, ring->funcs->nop |
  				SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
  		else
-			amdgpu_ring_write(ring, ring->nop);
+			amdgpu_ring_write(ring, ring->funcs->nop);
  }
 

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs

sdma_v3_0_ip_funcs

Quoted 47 lines

=

Quoted 46 lines
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
  	.get_rptr = sdma_v3_0_ring_get_rptr,
  	.get_wptr = sdma_v3_0_ring_get_wptr,

.set_wptr = sdma_v3_0_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
  		ring->use_doorbell = false;
  		sprintf(ring->name, "sdma%d", i);
  		r = amdgpu_ring_init(adev, ring, 1024,
-				     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
  				     &adev->sdma.trap_irq,
  				     (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
  static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_SDMA,
+	.align_mask = 0xf,
+	.nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
  	.get_rptr = si_dma_ring_get_rptr,
  	.get_wptr = si_dma_ring_get_wptr,
  	.set_wptr = si_dma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 55af8ac..1bab75a 100644

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c const struct amd_ip_funcs uvd_v4_2_ip_funcs =

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs =

{

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
  static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v4_2_ring_get_rptr,
  	.get_wptr = uvd_v4_2_ring_get_wptr,
  	.set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c const struct amd_ip_funcs uvd_v5_0_ip_funcs =

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs =

{

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
  static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v5_0_ring_get_rptr,
  	.get_wptr = uvd_v5_0_ring_get_wptr,
  	.set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
  	ring = &adev->uvd.ring;
  	sprintf(ring->name, "uvd");
-	r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-			     &adev->uvd.irq, 0);
+	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
  	return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_UVD,
+	.align_mask = 0xf,
+	.nop = PACKET0(mmUVD_NO_OP, 0),
  	.get_rptr = uvd_v6_0_ring_get_rptr,
  	.get_wptr = uvd_v6_0_ring_get_wptr,

.set_wptr = uvd_v6_0_ring_set_wptr, diff --git
a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -0
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c const struct amd_ip_funcs vce_v2_0_ip_funcs =

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -1
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+		r = amdgpu_ring_init(adev, ring, 512,
  				     &adev->vce.irq, 0);
  		if (r)
  			return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs =

{

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
  static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v2_0_ring_get_rptr,
  	.get_wptr = vce_v2_0_ring_get_wptr,
  	.set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 56a3feb..f7dbd0d 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
  	for (i = 0; i < adev->vce.num_rings; i++) {
  		ring = &adev->vce.ring[i];
  		sprintf(ring->name, "vce%d", i);
-		r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-				     &adev->vce.irq, 0);
+		r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
  		if (r)
  			return r;
  	}
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
  	.type = AMDGPU_RING_TYPE_VCE,
+	.align_mask = 0xf,
+	.nop = VCE_CMD_NO_OP,
  	.get_rptr = vce_v3_0_ring_get_rptr,
  	.get_wptr = vce_v3_0_ring_get_wptr,

.set_wptr = vce_v3_0_ring_set_wptr,
--
2.5.0

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

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

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

Quoted 4 lines

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

_______________________________________________
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): CY4PR12MB17015B2156B539C0540A2905EBAA0-rpdhrqHFk05QaJCA3gGb3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#28 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 6 lines · Xiangliang
Quoted 6 lines
Quoted 6 lines

NAK, we agreed upon moving the constant data into the functions structure as well.

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

What benefit to put the constant data into the structure?
If no, I'll create a new patch that create new structure for these constant data.

The functions and the parameters should be const. I don't care how we arrange the structure(s). Feel free to re-arrange.

Alex

Quoted 594 lines
Quoted 594 lines

Why not create a new structure for the constant data? It can make code more flexible.
Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 5 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 28 lines
Quoted 4 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

amdgpu_ring will lost the meaning.

Quoted 20 lines

Thanks!
Xiangliang Yu

Quoted 15 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19 +++++++++--------

--

Quoted 63 lines
Quoted 50 lines
Quoted 50 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++----

  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
  14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring,
 unsigned ndw)  {
         /* Align requested size with padding so unlock_commit can
          * pad safely */
-        ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+        ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
 
         /* Make sure we aren't trying to allocate more space
          * than the maximum for one submission @@ -94,7 +94,7 @@ void

amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

         int i;

         for (i = 0; i < count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-                amdgpu_ring_write(ring, ring->nop);
+                amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
  /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@
-106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct
amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-        while (ib->length_dw & ring->align_mask)
-                ib->ptr[ib->length_dw++] = ring->nop;
+        while (ib->length_dw & ring->funcs->align_mask)
+                ib->ptr[ib->length_dw++] = ring->funcs->nop;
  }
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct amdgpu_ring

Quoted 2 lines

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring

*ring)

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
         uint32_t count;
 
         /* We pad to match fetch size */
-        count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-        count %= ring->align_mask + 1;
+        count = ring->funcs->align_mask + 1 -
+                (ring->wptr & ring->funcs->align_mask);
+        count %= ring->funcs->align_mask + 1;
         ring->funcs->insert_nop(ring, count);
 
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct amdgpu_ring

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
         mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring

*ring)

Quoted 77 lines
Quoted 43 lines
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -4
   * Returns 0 on success, error on failure.
   */
  int amdgpu_ring_init(struct amdgpu_device *adev, struct
 amdgpu_ring *ring,
-                     unsigned max_dw, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+                     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type)
  {
         int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device
 *adev, struct amdgpu_ring *ring,
 
         ring->ring_size = roundup_pow_of_two(max_dw * 4 *
                                              amdgpu_sched_hw_submission);
-        ring->align_mask = align_mask;
-        ring->nop = nop;
 
         /* Allocate ring buffer */
         if (ring->ring_obj == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
index 6cf89c9..1ee1b65 100644
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
  /* provided by hw blocks that expose a ring buffer for commands
 */ struct amdgpu_ring_funcs {
         enum amdgpu_ring_type   type;
+        uint32_t                align_mask;
+        u32                     nop;
 
         /* ring read/write ptr handling */
         u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10 +151,8 @@
struct amdgpu_ring {
         unsigned                max_dw;
         int                     count_dw;
         uint64_t                gpu_addr;
-        uint32_t                align_mask;
         uint32_t                ptr_mask;
         bool                    ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-        u32                     nop;
         u32                     idx;
         u32                     me;
         u32                     pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-                     unsigned ring_size, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+                     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type);
  void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
  #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -2
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void cik_sdma_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring, ring->funcs->nop |
                                           SDMA_NOP_COUNT(count - 1));
                 else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/cik_sdma.c const struct amd_ip_funcs cik_sdma_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs

=

Quoted 26 lines

{

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
  static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
         .get_rptr = cik_sdma_ring_get_rptr,
         .get_wptr = cik_sdma_ring_get_wptr,
         .set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "gfx");
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                      &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
                 if (r)
                         return r;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
                 sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe,
 ring->queue);
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c const struct amd_ip_funcs gfx_v6_0_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 -1
                 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                      &adev->gfx.eop_irq, irq_type);
                 if (r)
                         return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs

=

Quoted 12 lines

{

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
+        .align_mask = 0xff,
+        .nop = 0x80000000,
         .get_rptr = gfx_v6_0_ring_get_rptr,
         .get_wptr = gfx_v6_0_ring_get_wptr,
         .set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6 +3252,8 @@
 static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute

= {

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
         .get_rptr = gfx_v6_0_ring_get_rptr,
         .get_wptr = gfx_v6_0_ring_get_wptr,
         .set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "gfx");
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static int gfx_v7_0_sw_init(void *handle) · line 4632

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
                                      &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
                 if (r)
                         return r;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -0
@@ -4631,7 +4630,6 @@ static int gfx_v7_0_sw_init(void *handle)
                 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                 /* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c const struct amd_ip_funcs gfx_v7_0_ip_funcs

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                      &adev->gfx.eop_irq, irq_type);
                 if (r)
                         return r;
@@ -5102,6 +5100,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs

=

Quoted 12 lines

{

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v7_0_ring_get_rptr,
         .get_wptr = gfx_v7_0_ring_get_wptr_gfx,
         .set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6 +5130,8 @@
 static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute

= {

Quoted 32 lines
Quoted 27 lines
Quoted 27 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v7_0_ring_get_rptr,
         .get_wptr = gfx_v7_0_ring_get_wptr_compute,
         .set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
                         ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
                 }
 
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     AMDGPU_CP_IRQ_GFX_EOP);
                 if (r)
                         return r;
         }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
                 sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring-
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_sw_init(void *handle) · line 2090

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
 > pipe, ring->queue);
                 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                 /* type-2 packets are deprecated on MEC, use type-3 instead

*/

Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c const struct amd_ip_funcs gfx_v8_0_ip_funcs

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq, irq_type);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     irq_type);
                 if (r)
                         return r;
         }
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs

=

Quoted 12 lines

{

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v8_0_ring_get_rptr,
         .get_wptr = gfx_v8_0_ring_get_wptr_gfx,
         .set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6 +6562,8 @@
 static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute

= {

Quoted 25 lines
Quoted 14 lines
Quoted 14 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v8_0_ring_get_rptr,
         .get_wptr = gfx_v8_0_ring_get_wptr_compute,
         .set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void sdma_v2_4_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c static void sdma_v2_4_ring_insert_nop(struct · line 241

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring, ring->funcs->nop |
                                 SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
                 else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
                 ring->use_doorbell = false;
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs

sdma_v2_4_ip_funcs

Quoted 32 lines

=

Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .get_rptr = sdma_v2_4_ring_get_rptr,
         .get_wptr = sdma_v2_4_ring_get_wptr,
         .set_wptr = sdma_v2_4_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void sdma_v3_0_ring_insert_nop(struct
 amdgpu_ring *ring, uint32_t count)
 
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static void sdma_v3_0_ring_insert_nop(struct · line 401

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring, ring->funcs->nop |
                                 SDMA_PKT_NOP_HEADER_COUNT(count -

1));

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
                 else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring, ring->funcs->nop);
  }
 

/**

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs

sdma_v3_0_ip_funcs

Quoted 47 lines

=

Quoted 46 lines
Quoted 46 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .get_rptr = sdma_v3_0_ring_get_rptr,
         .get_wptr = sdma_v3_0_ring_get_wptr,
         .set_wptr = sdma_v3_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/si_dma.c
b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
                 ring->use_doorbell = false;
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
 
  static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
         .get_rptr = si_dma_ring_get_rptr,
         .get_wptr = si_dma_ring_get_wptr,
         .set_wptr = si_dma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 55af8ac..1bab75a 100644

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1 -2
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c const struct amd_ip_funcs uvd_v4_2_ip_funcs =

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
         return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs =

{

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
  static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v4_2_ring_get_rptr,
         .get_wptr = uvd_v4_2_ring_get_wptr,
         .set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +1 -2
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c const struct amd_ip_funcs uvd_v5_0_ip_funcs =

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
         return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs =

{

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
  static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v5_0_ring_get_rptr,
         .get_wptr = uvd_v5_0_ring_get_wptr,
         .set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 -2
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0),
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
 
         return r;
  }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v6_0_ring_get_rptr,
         .get_wptr = uvd_v6_0_ring_get_wptr,
         .set_wptr = uvd_v6_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -0
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
         for (i = 0; i < adev->vce.num_rings; i++) {
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c const struct amd_ip_funcs vce_v2_0_ip_funcs =

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -1
                 ring = &adev->vce.ring[i];
                 sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
+                r = amdgpu_ring_init(adev, ring, 512,
                                      &adev->vce.irq, 0);
                 if (r)
                         return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs =

{

Quoted 46 lines
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
  static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_VCE,
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
         .get_rptr = vce_v2_0_ring_get_rptr,
         .get_wptr = vce_v2_0_ring_get_wptr,
         .set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 56a3feb..f7dbd0d 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -2
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
         for (i = 0; i < adev->vce.num_rings; i++) {
                 ring = &adev->vce.ring[i];
                 sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf,
-                                     &adev->vce.irq, 0);
+                r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
                 if (r)
                         return r;
         }
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
         .type = AMDGPU_RING_TYPE_VCE,
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
         .get_rptr = vce_v3_0_ring_get_rptr,
         .get_wptr = vce_v3_0_ring_get_wptr,
         .set_wptr = vce_v3_0_ring_set_wptr,

--
2.5.0

Quoted 4 lines
Quoted 4 lines

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

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

Quoted 8 lines
Quoted 4 lines

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

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

_______________________________________________
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): CADnq5_MS2dxbH64Q2mTv3fnqCF18bgBp7g=7EwLp9rR8Fw6tqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#30 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

Quoted 6 lines
Quoted 2 lines

What benefit to put the constant data into the structure?
If no, I'll create a new patch that create new structure for these constant

data.

The functions and the parameters should be const. I don't care how we arrange the structure(s). Feel free to re-arrange.

Yes, I know. I'll replace the pointer address of function structure not the member's content. I think this is best choice for making SRIOV code independent and easy to maintain.

Quoted 599 lines
Quoted 69 lines
Quoted 69 lines

Why not create a new structure for the constant data? It can make code more flexible.
Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 5 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 29 lines
Quoted 4 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

amdgpu_ring will lost the meaning.

Quoted 21 lines

Thanks!
Xiangliang Yu

Quoted 16 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19

+++++++++--------

--

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 ++++----

  drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
  drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
  14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring
 *ring, unsigned ndw)  {
         /* Align requested size with padding so unlock_commit can
          * pad safely */
-        ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+        ndw = (ndw + ring->funcs->align_mask) &
+ ~ring->funcs->align_mask;
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
         /* Make sure we aren't trying to allocate more space
          * than the maximum for one submission @@ -94,7 +94,7

@@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
         int i;

         for (i = 0; i < count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-                amdgpu_ring_write(ring, ring->nop);
+                amdgpu_ring_write(ring, ring->funcs->nop);
  }
 
  /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@
-106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)
*/
void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring,
struct amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-        while (ib->length_dw & ring->align_mask)
-                ib->ptr[ib->length_dw++] = ring->nop;
+        while (ib->length_dw & ring->funcs->align_mask)
+                ib->ptr[ib->length_dw++] = ring->funcs->nop;
  }
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct

Quoted 2 lines

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct

amdgpu_ring

Quoted 394 lines
Quoted 394 lines
Quoted 11 lines

*ring)

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
         uint32_t count;
 
         /* We pad to match fetch size */
-        count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-        count %= ring->align_mask + 1;
+        count = ring->funcs->align_mask + 1 -
+                (ring->wptr & ring->funcs->align_mask);
+        count %= ring->funcs->align_mask + 1;
         ring->funcs->insert_nop(ring, count);
 
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct amdgpu_ring

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
         mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring

*ring)

Quoted 81 lines
Quoted 43 lines
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -4
   * Returns 0 on success, error on failure.
   */
  int amdgpu_ring_init(struct amdgpu_device *adev, struct
 amdgpu_ring *ring,
-                     unsigned max_dw, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+                     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type)
  {
         int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device
 *adev, struct amdgpu_ring *ring,
 
         ring->ring_size = roundup_pow_of_two(max_dw * 4 *
                                              amdgpu_sched_hw_submission);
-        ring->align_mask = align_mask;
-        ring->nop = nop;
 
         /* Allocate ring buffer */
         if (ring->ring_obj == NULL) { diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 6cf89c9..1ee1b65 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
  /* provided by hw blocks that expose a ring buffer for
 commands */ struct amdgpu_ring_funcs {
         enum amdgpu_ring_type   type;
+        uint32_t                align_mask;
+        u32                     nop;
 
         /* ring read/write ptr handling */
         u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10
+151,8 @@ struct amdgpu_ring {
         unsigned                max_dw;
         int                     count_dw;
         uint64_t                gpu_addr;
-        uint32_t                align_mask;
         uint32_t                ptr_mask;
         bool                    ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-        u32                     nop;
         u32                     idx;
         u32                     me;
         u32                     pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-                     unsigned ring_size, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+                     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type);
  void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
  #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void

cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +4 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                           SDMA_NOP_COUNT(count - 1));
                 else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
  }
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines

/**

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "sdma%d", i);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs

cik_sdma_ip_funcs

=

Quoted 27 lines

{

Quoted 26 lines
Quoted 26 lines
  static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
+        .align_mask = 0xf,
+        .nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
         .get_rptr = cik_sdma_ring_get_rptr,
         .get_wptr = cik_sdma_ring_get_wptr,
         .set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "gfx");
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                      &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
                 if (r)
                         return r; @@ -2892,7 +2891,6 @@ static
int gfx_v6_0_sw_init(void *handle)
                 sprintf(ring->name, "comp %d.%d.%d", ring->me,

ring->pipe,
ring->queue);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                      &adev->gfx.eop_irq, irq_type);
                 if (r)
                         return r; @@ -3227,6 +3225,8 @@ const

struct amd_ip_funcs gfx_v6_0_ip_funcs

=

Quoted 14 lines

{

Quoted 13 lines
Quoted 13 lines
  static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
         .get_rptr = gfx_v6_0_ring_get_rptr,
         .get_wptr = gfx_v6_0_ring_get_wptr,
         .set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6
+3252,8 @@ static const struct amdgpu_ring_funcs

gfx_v6_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v6_0_ring_funcs_compute

= {

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
         .get_rptr = gfx_v6_0_ring_get_rptr,
         .get_wptr = gfx_v6_0_ring_get_wptr,
         .set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
                 ring->ring_obj = NULL;
                 sprintf(ring->name, "gfx");
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                      &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
                 if (r)
                         return r; @@ -4631,7 +4630,6 @@ static
int gfx_v7_0_sw_init(void *handle)
                 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                 /* type-2 packets are deprecated on MEC, use

type-3 instead

*/

Quoted 6 lines
Quoted 6 lines
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                      &adev->gfx.eop_irq, irq_type);
                 if (r)
                         return r; @@ -5102,6 +5100,8 @@ const

struct amd_ip_funcs gfx_v7_0_ip_funcs

=

Quoted 14 lines

{

Quoted 13 lines
Quoted 13 lines
  static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v7_0_ring_get_rptr,
         .get_wptr = gfx_v7_0_ring_get_wptr_gfx,
         .set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6
+5130,8 @@ static const struct amdgpu_ring_funcs

gfx_v7_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v7_0_ring_funcs_compute

= {

Quoted 34 lines
Quoted 28 lines
Quoted 28 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v7_0_ring_get_rptr,
         .get_wptr = gfx_v7_0_ring_get_wptr_compute,
         .set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
                         ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
                 }
 
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     AMDGPU_CP_IRQ_GFX_EOP);
                 if (r)
                         return r;
         }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
                 sprintf(ring->name, "comp_%d.%d.%d", ring->me,

ring-

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

pipe, ring->queue);

irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                 /* type-2 packets are deprecated on MEC, use

type-3 instead

*/

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq, irq_type);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     irq_type);
                 if (r)
                         return r;
         }
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs

gfx_v8_0_ip_funcs

=

Quoted 14 lines

{

Quoted 13 lines
Quoted 13 lines
  static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
         .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v8_0_ring_get_rptr,
         .get_wptr = gfx_v8_0_ring_get_wptr_gfx,
         .set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6
+6562,8 @@ static const struct amdgpu_ring_funcs

gfx_v8_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v8_0_ring_funcs_compute

= {

Quoted 29 lines
Quoted 15 lines
Quoted 15 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
         .get_rptr = gfx_v8_0_ring_get_rptr,
         .get_wptr = gfx_v8_0_ring_get_wptr_compute,
         .set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void

sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 7 lines

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

Quoted 7 lines
         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                 SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 6 lines
Quoted 6 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
  }
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs

Quoted 11 lines

/**

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
                 ring->use_doorbell = false;
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs

sdma_v2_4_ip_funcs

Quoted 36 lines

=

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .get_rptr = sdma_v2_4_ring_get_rptr,
         .get_wptr = sdma_v2_4_ring_get_wptr,
         .set_wptr = sdma_v2_4_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void

sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 7 lines

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

Quoted 7 lines
         for (i = 0; i < count; i++)
                 if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                 SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 9 lines
Quoted 9 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
  }
 
  /**
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs

sdma_v3_0_ip_funcs

Quoted 41 lines

=

Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
  static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
         .get_rptr = sdma_v3_0_ring_get_rptr,
         .get_wptr = sdma_v3_0_ring_get_wptr,
         .set_wptr = sdma_v3_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/si_dma.c
b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
                 ring->use_doorbell = false;
                 sprintf(ring->name, "sdma%d", i);
                 r = amdgpu_ring_init(adev, ring, 1024,
-                                     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
                                      &adev->sdma.trap_irq,
                                      (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs =
 {
 
  static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
         .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
         .get_rptr = si_dma_ring_get_rptr,
         .get_wptr = si_dma_ring_get_wptr,
         .set_wptr = si_dma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 55af8ac..1bab75a 100644

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -1
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
         return r;
  }
@@ -743,6 +742,8 @@ const struct amd_ip_funcs

uvd_v4_2_ip_funcs

Quoted 17 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
  static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v4_2_ring_get_rptr,
         .get_wptr = uvd_v4_2_ring_get_wptr,
         .set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c static int uvd_v5_0_sw_init(void *handle) · line 115

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -1
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
         return r;
  }
@@ -794,6 +793,8 @@ const struct amd_ip_funcs

uvd_v5_0_ip_funcs

Quoted 17 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
  static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v5_0_ring_get_rptr,
         .get_wptr = uvd_v5_0_ring_get_wptr,
         .set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -1
         ring = &adev->uvd.ring;
         sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
         return r;
  }
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
         .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
         .get_rptr = uvd_v6_0_ring_get_rptr,
         .get_wptr = uvd_v6_0_ring_get_wptr,
         .set_wptr = uvd_v6_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_sw_init(void *handle) · line 227

Quoted 8 lines

index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -1
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
         for (i = 0; i < adev->vce.num_rings; i++) {
                 ring = &adev->vce.ring[i];
                 sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 17 lines
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -0
+                r = amdgpu_ring_init(adev, ring, 512,
                                      &adev->vce.irq, 0);
                 if (r)
                         return r; @@ -611,6 +611,8 @@ const

struct amd_ip_funcs vce_v2_0_ip_funcs =

{

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
  static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
         .type = AMDGPU_RING_TYPE_VCE,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
         .get_rptr = vce_v2_0_ring_get_rptr,
         .get_wptr = vce_v2_0_ring_get_wptr,
         .set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 56a3feb..f7dbd0d 100644

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_sw_init(void *handle) · line 392

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -1
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
         for (i = 0; i < adev->vce.num_rings; i++) {
                 ring = &adev->vce.ring[i];
                 sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 37 lines
Quoted 29 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +4 -1
-                                     &adev->vce.irq, 0);
+                r = amdgpu_ring_init(adev, ring, 512,
+ &adev->vce.irq, 0);
                 if (r)
                         return r;
         }
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
  static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
         .type = AMDGPU_RING_TYPE_VCE,
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
         .get_rptr = vce_v3_0_ring_get_rptr,
         .get_wptr = vce_v3_0_ring_get_wptr,
         .set_wptr = vce_v3_0_ring_set_wptr,

--
2.5.0

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

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

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

Quoted 4 lines

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

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

_______________________________________________
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): CY4PR12MB1701B0BCB6F6BE8F5281B1C0EBAD0-rpdhrqHFk05QaJCA3gGb3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#32 lore raw

Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Am 28.10.2016 um 04:06 schrieb Yu, Xiangliang:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

What benefit to put the constant data into the structure?
If no, I'll create a new patch that create new structure for these constant

data.

The functions and the parameters should be const. I don't care how we arrange the structure(s). Feel free to re-arrange.

Yes, I know. I'll replace the pointer address of function structure not the member's content. I think this is best choice for making SRIOV code independent and easy to maintain.

I'm actually not sure if it is a good idea to make the SRIOV code independent, but anyway I clearly don't see the advantage of putting the constant members into a separate structure even with SRIOV.

On the other hand as Alex said feel free to rearrange the members in the structure or rename the structure to better match it's purpose.

Regards,
Christian.

Quoted 626 lines
Quoted 626 lines
Quoted 67 lines
Quoted 67 lines

Why not create a new structure for the constant data? It can make code more flexible.
Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 4 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 28 lines
Quoted 4 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

amdgpu_ring will lost the meaning.

Quoted 20 lines

Thanks!
Xiangliang Yu

Quoted 16 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

From: Christian König <[email protected]>

They are constant as well.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19

+++++++++--------

--

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
   drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
   drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
   drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
   drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
   14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring
 *ring, unsigned ndw)  {
          /* Align requested size with padding so unlock_commit can
           * pad safely */
-        ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+        ndw = (ndw + ring->funcs->align_mask) &
+ ~ring->funcs->align_mask;
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
          /* Make sure we aren't trying to allocate more space
           * than the maximum for one submission @@ -94,7 +94,7

@@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
          int i;

          for (i = 0; i < count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-                amdgpu_ring_write(ring, ring->nop);
+                amdgpu_ring_write(ring, ring->funcs->nop);
   }
 
   /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@
-106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)

    */

void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring,
struct amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-        while (ib->length_dw & ring->align_mask)
-                ib->ptr[ib->length_dw++] = ring->nop;
+        while (ib->length_dw & ring->funcs->align_mask)
+                ib->ptr[ib->length_dw++] = ring->funcs->nop;
   }
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct

Quoted 2 lines
   /**
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct

amdgpu_ring

Quoted 390 lines
Quoted 390 lines
Quoted 11 lines

*ring)

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
          uint32_t count;
 
          /* We pad to match fetch size */
-        count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-        count %= ring->align_mask + 1;
+        count = ring->funcs->align_mask + 1 -
+                (ring->wptr & ring->funcs->align_mask);
+        count %= ring->funcs->align_mask + 1;
          ring->funcs->insert_nop(ring, count);
 
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct amdgpu_ring

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
          mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring

*ring)

Quoted 81 lines
Quoted 43 lines
Quoted 43 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -4
    * Returns 0 on success, error on failure.
    */
   int amdgpu_ring_init(struct amdgpu_device *adev, struct
 amdgpu_ring *ring,
-                     unsigned max_dw, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+                     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type)
   {
          int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device
 *adev, struct amdgpu_ring *ring,
 
          ring->ring_size = roundup_pow_of_two(max_dw * 4 *
                                               amdgpu_sched_hw_submission);
-        ring->align_mask = align_mask;
-        ring->nop = nop;
 
          /* Allocate ring buffer */
          if (ring->ring_obj == NULL) { diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 6cf89c9..1ee1b65 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct
 amdgpu_ring *ring);
   /* provided by hw blocks that expose a ring buffer for
 commands */ struct amdgpu_ring_funcs {
          enum amdgpu_ring_type   type;
+        uint32_t                align_mask;
+        u32                     nop;
 
          /* ring read/write ptr handling */
          u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10
+151,8 @@ struct amdgpu_ring {
          unsigned                max_dw;
          int                     count_dw;
          uint64_t                gpu_addr;
-        uint32_t                align_mask;
          uint32_t                ptr_mask;
          bool                    ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-        u32                     nop;
          u32                     idx;
          u32                     me;
          u32                     pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-                     unsigned ring_size, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+                     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type);
   void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
   #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void

cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +4 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                            SDMA_NOP_COUNT(count - 1));
                  else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
   /**
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "sdma%d", i);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs

cik_sdma_ip_funcs

=

Quoted 26 lines

{

Quoted 25 lines
Quoted 25 lines
   static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
+        .align_mask = 0xf,
+        .nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
          .get_rptr = cik_sdma_ring_get_rptr,
          .get_wptr = cik_sdma_ring_get_wptr,
          .set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "gfx");
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                       &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
                  if (r)
                          return r; @@ -2892,7 +2891,6 @@ static
int gfx_v6_0_sw_init(void *handle)
                  sprintf(ring->name, "comp %d.%d.%d", ring->me,

ring->pipe,
ring->queue);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                       &adev->gfx.eop_irq, irq_type);
                  if (r)
                          return r; @@ -3227,6 +3225,8 @@ const

struct amd_ip_funcs gfx_v6_0_ip_funcs

=

Quoted 13 lines

{

Quoted 12 lines
Quoted 12 lines
   static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
          .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
          .get_rptr = gfx_v6_0_ring_get_rptr,
          .get_wptr = gfx_v6_0_ring_get_wptr,
          .set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6
+3252,8 @@ static const struct amdgpu_ring_funcs

gfx_v6_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v6_0_ring_funcs_compute

= {

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
          .get_rptr = gfx_v6_0_ring_get_rptr,
          .get_wptr = gfx_v6_0_ring_get_wptr,
          .set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "gfx");
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                       &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
                  if (r)
                          return r; @@ -4631,7 +4630,6 @@ static
int gfx_v7_0_sw_init(void *handle)
                  irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                  /* type-2 packets are deprecated on MEC, use

type-3 instead

*/

Quoted 6 lines
Quoted 6 lines
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                       &adev->gfx.eop_irq, irq_type);
                  if (r)
                          return r; @@ -5102,6 +5100,8 @@ const

struct amd_ip_funcs gfx_v7_0_ip_funcs

=

Quoted 13 lines

{

Quoted 12 lines
Quoted 12 lines
   static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
          .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v7_0_ring_get_rptr,
          .get_wptr = gfx_v7_0_ring_get_wptr_gfx,
          .set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6
+5130,8 @@ static const struct amdgpu_ring_funcs

gfx_v7_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v7_0_ring_funcs_compute

= {

Quoted 34 lines
Quoted 28 lines
Quoted 28 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v7_0_ring_get_rptr,
          .get_wptr = gfx_v7_0_ring_get_wptr_compute,
          .set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
                          ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
                  }
 
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     AMDGPU_CP_IRQ_GFX_EOP);
                  if (r)
                          return r;
          }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
                  sprintf(ring->name, "comp_%d.%d.%d", ring->me,

ring-

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

pipe, ring->queue);

irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                  /* type-2 packets are deprecated on MEC, use

type-3 instead

*/

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -3
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq, irq_type);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
+                                     irq_type);
                  if (r)
                          return r;
          }
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs

gfx_v8_0_ip_funcs

=

Quoted 13 lines

{

Quoted 12 lines
Quoted 12 lines
   static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
          .type = AMDGPU_RING_TYPE_GFX,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v8_0_ring_get_rptr,
          .get_wptr = gfx_v8_0_ring_get_wptr_gfx,
          .set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6
+6562,8 @@ static const struct amdgpu_ring_funcs

gfx_v8_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v8_0_ring_funcs_compute

= {

Quoted 29 lines
Quoted 15 lines
Quoted 15 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v8_0_ring_get_rptr,
          .get_wptr = gfx_v8_0_ring_get_wptr_compute,
          .set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void

sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 7 lines

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

Quoted 7 lines
          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                  SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 6 lines
Quoted 6 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs

Quoted 11 lines
   /**
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
                  ring->use_doorbell = false;
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs

sdma_v2_4_ip_funcs

Quoted 36 lines

=

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
   static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
          .get_rptr = sdma_v2_4_ring_get_rptr,
          .get_wptr = sdma_v2_4_ring_get_wptr,
          .set_wptr = sdma_v2_4_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void

sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 7 lines

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

Quoted 7 lines
          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                  SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 9 lines
Quoted 9 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
 
   /**
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void *handle)
 
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs

sdma_v3_0_ip_funcs

Quoted 41 lines

=

Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
   static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
          .get_rptr = sdma_v3_0_ring_get_rptr,
          .get_wptr = sdma_v3_0_ring_get_wptr,
          .set_wptr = sdma_v3_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/si_dma.c
b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
                  ring->use_doorbell = false;
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs =
 {
 
   static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
          .get_rptr = si_dma_ring_get_rptr,
          .get_wptr = si_dma_ring_get_wptr,
          .set_wptr = si_dma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 55af8ac..1bab75a 100644

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
          return r;
   }
@@ -743,6 +742,8 @@ const struct amd_ip_funcs

uvd_v4_2_ip_funcs

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
   static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
          .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v4_2_ring_get_rptr,
          .get_wptr = uvd_v4_2_ring_get_wptr,
          .set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c static int uvd_v5_0_sw_init(void *handle) · line 115

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
          return r;
   }
@@ -794,6 +793,8 @@ const struct amd_ip_funcs

uvd_v5_0_ip_funcs

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
   static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v5_0_ring_get_rptr,
          .get_wptr = uvd_v5_0_ring_get_wptr,
          .set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP,

0),

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +4 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
          return r;
   }
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
   static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
          .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v6_0_ring_get_rptr,
          .get_wptr = uvd_v6_0_ring_get_wptr,
          .set_wptr = uvd_v6_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_sw_init(void *handle) · line 227

Quoted 8 lines

index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -1
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
          for (i = 0; i < adev->vce.num_rings; i++) {
                  ring = &adev->vce.ring[i];
                  sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -0
+                r = amdgpu_ring_init(adev, ring, 512,
                                       &adev->vce.irq, 0);
                  if (r)
                          return r; @@ -611,6 +611,8 @@ const

struct amd_ip_funcs vce_v2_0_ip_funcs =

{

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
   static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_VCE,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
          .get_rptr = vce_v2_0_ring_get_rptr,
          .get_wptr = vce_v2_0_ring_get_wptr,
          .set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_sw_init(void *handle) · line 392

Quoted 8 lines

index 56a3feb..f7dbd0d 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -1
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
          for (i = 0; i < adev->vce.num_rings; i++) {
                  ring = &adev->vce.ring[i];
                  sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +4 -1
-                                     &adev->vce.irq, 0);
+                r = amdgpu_ring_init(adev, ring, 512,
+ &adev->vce.irq, 0);
                  if (r)
                          return r;
          }
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
   static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
          .type = AMDGPU_RING_TYPE_VCE,
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
          .get_rptr = vce_v3_0_ring_get_rptr,
          .get_wptr = vce_v3_0_ring_get_wptr,
          .set_wptr = vce_v3_0_ring_set_wptr,

--
2.5.0

Quoted 4 lines
Quoted 4 lines

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

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

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

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

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

_______________________________________________
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): dac6c3b7-6b15-7b0e-b9b0-a9bf5ad01832-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#34 lore raw

RE: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 23 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Friday, October 28, 2016 6:13 PM
To: Yu, Xiangliang <[email protected]>; Alex Deucher <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Am 28.10.2016 um 04:06 schrieb Yu, Xiangliang:

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines

NAK, we agreed upon moving the constant data into the functions structure as well.

How about renaming the amdgpu_ring_funcs structure to make clear that it isn't only functions any more? Something amdgpu_ring_params or something like that?

What benefit to put the constant data into the structure? If no, I'll create a new patch that create new structure for these constant

data.

The functions and the parameters should be const. I don't care how we arrange the structure(s). Feel free to re-arrange.

Quoted 8 lines
Quoted 1 line

Yes, I know. I'll replace the pointer address of function structure not the

member's content.

Quoted 1 line

I think this is best choice for making SRIOV code independent and easy to

maintain.

I'm actually not sure if it is a good idea to make the SRIOV code independent, but anyway I clearly don't see the advantage of putting the constant members into a separate structure even with SRIOV.

For you, there is not any advantage, but for me, I can use the structure for my code. And the constant structure can make the code very clear, and easy to be re-used or changed.

I have spent two weeks to design SRIOV, I think you can see the advantage after Reviewing my SRIOV patches.

Quoted 3 lines

On the other hand as Alex said feel free to rearrange the members in the structure or rename the structure to better match it's purpose.

I still think new structure is better, which benefit code reusing.

Quoted 628 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Why not create a new structure for the constant data? It can make code more flexible.
Actually, I'm working on SRIOV patches, I need the amdgpu_ring_funcs structure so That easy to inherint all of function.

Quoted 11 lines

Regards,
Christian.

Am 26.10.2016 um 09:34 schrieb Yu, Xiangliang:

Quoted 4 lines

Hi Christian,

Could you help put type, aligan_mask, nop of amdgpu_ring_funcs struct

field into amdgpu_ring struct?

Quoted 2 lines

I think amdgpu_ring_funcs should include function pointer, not attribute. Your patches is not follow the struct design, and the

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

amdgpu_ring will lost the meaning.

Quoted 6 lines

Thanks!
Xiangliang Yu

Quoted 2 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]]

On

Quoted 49 lines
Quoted 49 lines
Quoted 43 lines
Quoted 43 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Behalf Of Christian K?nig
Sent: Wednesday, October 05, 2016 10:13 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: move align_mask and nop into ring funcs as well

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: Christian König <[email protected]>

They are constant as well.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 19

+++++++++--------

--

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  8 ++++----
   drivers/gpu/drm/amd/amdgpu/cik_sdma.c    |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c    |  6 ++++--
   drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c    |  6 ++++--
   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c    | 14 ++++++++------
   drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c   |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c   |  7 ++++---
   drivers/gpu/drm/amd/amdgpu/si_dma.c      |  3 ++-
   drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c    |  5 +++--
   drivers/gpu/drm/amd/amdgpu/vce_v2_0.c    |  4 +++-
   drivers/gpu/drm/amd/amdgpu/vce_v3_0.c    |  5 +++--
   14 files changed, 58 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
index b2df735..a141b46 100644
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring
 *ring, unsigned ndw)  {
          /* Align requested size with padding so unlock_commit can
           * pad safely */
-        ndw = (ndw + ring->align_mask) & ~ring->align_mask;
+        ndw = (ndw + ring->funcs->align_mask) &
+ ~ring->funcs->align_mask;
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
          /* Make sure we aren't trying to allocate more space
           * than the maximum for one submission @@ -94,7 +94,7

@@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring,

uint32_t count)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
          int i;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

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

Quoted 8 lines
          for (i = 0; i < count; i++)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-                amdgpu_ring_write(ring, ring->nop);
+                amdgpu_ring_write(ring, ring->funcs->nop);
   }
 
   /** amdgpu_ring_generic_pad_ib - pad IB with NOP packets @@
-106,8
+106,8 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring

*ring,

Quoted 24 lines
Quoted 24 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

uint32_t count)

    */

void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring,
struct amdgpu_ib *ib) {

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -2
-        while (ib->length_dw & ring->align_mask)
-                ib->ptr[ib->length_dw++] = ring->nop;
+        while (ib->length_dw & ring->funcs->align_mask)
+                ib->ptr[ib->length_dw++] = ring->funcs->nop;
   }
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_commit(struct

Quoted 2 lines
   /**
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct

amdgpu_ring

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

*ring)

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
          uint32_t count;
 
          /* We pad to match fetch size */
-        count = ring->align_mask + 1 - (ring->wptr & ring->align_mask);
-        count %= ring->align_mask + 1;
+        count = ring->funcs->align_mask + 1 -
+                (ring->wptr & ring->funcs->align_mask);
+        count %= ring->funcs->align_mask + 1;
          ring->funcs->insert_nop(ring, count);
 
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
          mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct

amdgpu_ring

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

*ring)

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -4
    * Returns 0 on success, error on failure.
    */
   int amdgpu_ring_init(struct amdgpu_device *adev, struct
 amdgpu_ring *ring,
-                     unsigned max_dw, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type)
+                     unsigned max_dw, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type)
   {
          int r;
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device
 *adev, struct amdgpu_ring *ring,
 
          ring->ring_size = roundup_pow_of_two(max_dw * 4 *
                                               amdgpu_sched_hw_submission);
-        ring->align_mask = align_mask;
-        ring->nop = nop;
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h unsigned

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
          /* Allocate ring buffer */
          if (ring->ring_obj == NULL) { diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 6cf89c9..1ee1b65 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -0
@@ -93,6 +93,8 @@ unsigned

amdgpu_fence_count_emitted(struct

Quoted 103 lines
Quoted 103 lines
Quoted 103 lines
Quoted 103 lines
Quoted 54 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -0
 amdgpu_ring *ring);
   /* provided by hw blocks that expose a ring buffer for
 commands */ struct amdgpu_ring_funcs {
          enum amdgpu_ring_type   type;
+        uint32_t                align_mask;
+        u32                     nop;
 
          /* ring read/write ptr handling */
          u32 (*get_rptr)(struct amdgpu_ring *ring); @@ -149,10
+151,8 @@ struct amdgpu_ring {
          unsigned                max_dw;
          int                     count_dw;
          uint64_t                gpu_addr;
-        uint32_t                align_mask;
          uint32_t                ptr_mask;
          bool                    ready;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0 -1
-        u32                     nop;
          u32                     idx;
          u32                     me;
          u32                     pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct

amdgpu_ring *ring, struct amdgpu_ib *ib); void amdgpu_ring_commit(struct amdgpu_ring *ring); void amdgpu_ring_undo(struct amdgpu_ring *ring); int

amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -2
-                     unsigned ring_size, u32 nop, u32 align_mask,
-                     struct amdgpu_irq_src *irq_src, unsigned irq_type);
+                     unsigned ring_size, struct amdgpu_irq_src *irq_src,
+                     unsigned irq_type);
   void amdgpu_ring_fini(struct amdgpu_ring *ring);
 
   #endif
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
index f91f02f..664f894 100644
@@ -205,10 +205,10 @@ static void

cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +4 -2
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |
                                            SDMA_NOP_COUNT(count - 1));
                  else
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
   /**
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -942,7 +942,6 @@ static int cik_sdma_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "sdma%d", i);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -1
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     SDMA_PACKET(SDMA_OPCODE_NOP, 0,
 0), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/cik_sdma.c +0 -0
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs

cik_sdma_ip_funcs

=

Quoted 27 lines

{

Quoted 26 lines
Quoted 26 lines
   static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -0
+        .align_mask = 0xf,
+        .nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
          .get_rptr = cik_sdma_ring_get_rptr,
          .get_wptr = cik_sdma_ring_get_wptr,
          .set_wptr = cik_sdma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 1f8687fd..367b14e 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -1
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "gfx");
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                       &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
                  if (r)
                          return r; @@ -2892,7 +2891,6 @@ static
int gfx_v6_0_sw_init(void *handle)
                  sprintf(ring->name, "comp %d.%d.%d", ring->me,

ring->pipe,
ring->queue);
irq_type =

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     0x80000000, 0xff,
                                       &adev->gfx.eop_irq, irq_type);
                  if (r)
                          return r; @@ -3227,6 +3225,8 @@ const

struct amd_ip_funcs gfx_v6_0_ip_funcs

=

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

{

Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx =

{

Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

.type = AMDGPU_RING_TYPE_GFX,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
          .get_rptr = gfx_v6_0_ring_get_rptr,
          .get_wptr = gfx_v6_0_ring_get_wptr,
          .set_wptr = gfx_v6_0_ring_set_wptr_gfx, @@ -3252,6
+3252,8 @@ static const struct amdgpu_ring_funcs

gfx_v6_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v6_0_ring_funcs_compute

= {

Quoted 33 lines
Quoted 18 lines
Quoted 18 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = 0x80000000,
          .get_rptr = gfx_v6_0_ring_get_rptr,
          .get_wptr = gfx_v6_0_ring_get_wptr,
          .set_wptr = gfx_v6_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index be3881e..15f24bd 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -1
@@ -4605,7 +4605,6 @@ static int gfx_v7_0_sw_init(void *handle)
                  ring->ring_obj = NULL;
                  sprintf(ring->name, "gfx");
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                       &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
                  if (r)
                          return r; @@ -4631,7 +4630,6 @@ static
int gfx_v7_0_sw_init(void *handle)
                  irq_type =
AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
+ ring->pipe;
                  /* type-2 packets are deprecated on MEC, use

type-3 instead

*/

Quoted 6 lines
Quoted 6 lines
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
                                       &adev->gfx.eop_irq, irq_type);
                  if (r)
                          return r; @@ -5102,6 +5100,8 @@ const

struct amd_ip_funcs gfx_v7_0_ip_funcs

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

=

Quoted 2 lines

{

Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx =

{

Quoted 47 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

.type = AMDGPU_RING_TYPE_GFX,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v7_0_ring_get_rptr,
          .get_wptr = gfx_v7_0_ring_get_wptr_gfx,
          .set_wptr = gfx_v7_0_ring_set_wptr_gfx, @@ -5130,6
+5130,8 @@ static const struct amdgpu_ring_funcs

gfx_v7_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v7_0_ring_funcs_compute

= {

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v7_0_ring_get_rptr,
          .get_wptr = gfx_v7_0_ring_get_wptr_compute,
          .set_wptr = gfx_v7_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0d66f49..51f1139 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2061,9 +2061,8 @@ static int gfx_v8_0_sw_init(void *handle)
                          ring->doorbell_index =
 AMDGPU_DOORBELL_GFX_RING0;
                  }
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_sw_init(void *handle) · line 2066

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -3
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq,
 AMDGPU_CP_IRQ_GFX_EOP);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev-

gfx.eop_irq,

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+                                     AMDGPU_CP_IRQ_GFX_EOP);
                  if (r)
                          return r;
          }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -2087,9 +2086,8 @@ static int gfx_v8_0_sw_init(void *handle)
                  sprintf(ring->name, "comp_%d.%d.%d", ring->me,

ring-

Quoted 1 line

pipe, ring->queue);

irq_type =
AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP

+ ring->pipe;
                  /* type-2 packets are deprecated on MEC, use

type-3 instead

Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

*/

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -3
-                r = amdgpu_ring_init(adev, ring, 1024,
-                                     PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
-                                     &adev->gfx.eop_irq, irq_type);
+                r = amdgpu_ring_init(adev, ring, 1024, &adev-

gfx.eop_irq,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+                                     irq_type);
                  if (r)
                          return r;
          }
@@ -6532,6 +6530,8 @@ const struct amd_ip_funcs

gfx_v8_0_ip_funcs

=

Quoted 2 lines

{

Quoted 1 line
Quoted 1 line

static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx =

{

Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 82 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

.type = AMDGPU_RING_TYPE_GFX,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v8_0_ring_get_rptr,
          .get_wptr = gfx_v8_0_ring_get_wptr_gfx,
          .set_wptr = gfx_v8_0_ring_set_wptr_gfx, @@ -6562,6
+6562,8 @@ static const struct amdgpu_ring_funcs

gfx_v8_0_ring_funcs_gfx = {

static const struct amdgpu_ring_funcs
gfx_v8_0_ring_funcs_compute

= {

Quoted 30 lines
Quoted 15 lines
Quoted 15 lines

.type = AMDGPU_RING_TYPE_COMPUTE,

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+        .align_mask = 0xff,
+        .nop = PACKET3(PACKET3_NOP, 0x3FFF),
          .get_rptr = gfx_v8_0_ring_get_rptr,
          .get_wptr = gfx_v8_0_ring_get_wptr_compute,
          .set_wptr = gfx_v8_0_ring_set_wptr_compute, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index b11a81e..49c47d6 100644

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -236,10 +236,10 @@ static void

sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 8 lines
Quoted 8 lines
          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |

SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 6 lines
Quoted 6 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
Quoted 11 lines
Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c const struct amd_ip_funcs

Quoted 11 lines
   /**
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -1
@@ -953,7 +953,6 @@ static int sdma_v2_4_sw_init(void *handle)
                  ring->use_doorbell = false;
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +0 -0
@@ -1211,6 +1210,8 @@ const struct amd_ip_funcs

sdma_v2_4_ip_funcs

Quoted 28 lines

=

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +2 -0
 {
 
   static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
          .get_rptr = sdma_v2_4_ring_get_rptr,
          .get_wptr = sdma_v2_4_ring_get_wptr,
          .set_wptr = sdma_v2_4_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index accf4d1..f8ec370 100644

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -0
@@ -396,10 +396,10 @@ static void

sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)

Quoted 8 lines
Quoted 8 lines
          for (i = 0; i < count; i++)
                  if (sdma && sdma->burst_nop && (i == 0))
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop |
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop |

SDMA_PKT_NOP_HEADER_COUNT(count
-

1));

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c static int sdma_v3_0_sw_init(void

Quoted 8 lines

else

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
-                        amdgpu_ring_write(ring, ring->nop);
+                        amdgpu_ring_write(ring,
+ ring->funcs->nop);
   }
 
   /**
@@ -1165,7 +1165,6 @@ static int sdma_v3_0_sw_init(void

*handle)

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c const struct amd_ip_funcs

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +0 -1
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-
 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?
                                       AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1556,6 +1555,8 @@ const struct amd_ip_funcs

sdma_v3_0_ip_funcs

Quoted 17 lines

=

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -0
 {
 
   static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
          .get_rptr = sdma_v3_0_ring_get_rptr,
          .get_wptr = sdma_v3_0_ring_get_wptr,
          .set_wptr = sdma_v3_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/si_dma.c
b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 1aee45b..7fece1f 100644

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -0
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
                  ring->use_doorbell = false;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/si_dma.c const struct amd_ip_funcs si_dma_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -1
                  sprintf(ring->name, "sdma%d", i);
                  r = amdgpu_ring_init(adev, ring, 1024,
-                                     DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0,
 0), 0xf,
                                       &adev->sdma.trap_irq,
                                       (i == 0) ?

AMDGPU_SDMA_IRQ_TRAP0 :

drivers/gpu/drm/amd/amdgpu/si_dma.c +0 -0
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs

=

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -0
 {
 
   static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
          .type = AMDGPU_RING_TYPE_SDMA,
+        .align_mask = 0xf,
+        .nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
          .get_rptr = si_dma_ring_get_rptr,
          .get_wptr = si_dma_ring_get_wptr,
          .set_wptr = si_dma_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
index 55af8ac..1bab75a 100644

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512,

PACKET0(mmUVD_NO_OP,

Quoted 26 lines
Quoted 26 lines

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
          return r;
   }
@@ -743,6 +742,8 @@ const struct amd_ip_funcs

uvd_v4_2_ip_funcs

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
   static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
          .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v4_2_ring_get_rptr,
          .get_wptr = uvd_v4_2_ring_get_wptr,
          .set_wptr = uvd_v4_2_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
index 21e725b..ec848fc 100644

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -0
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c static int uvd_v5_0_sw_init(void *handle) · line 115

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512,

PACKET0(mmUVD_NO_OP,

Quoted 26 lines
Quoted 26 lines

0),

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c const struct amd_ip_funcs

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
          return r;
   }
@@ -794,6 +793,8 @@ const struct amd_ip_funcs

uvd_v5_0_ip_funcs

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

=

{

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
   static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_UVD,
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v5_0_ring_get_rptr,
          .get_wptr = uvd_v5_0_ring_get_wptr,
          .set_wptr = uvd_v5_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 2ce1818..15708f8 100644

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_sw_init(void *handle) · line 119

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -1
          ring = &adev->uvd.ring;
          sprintf(ring->name, "uvd");
-        r = amdgpu_ring_init(adev, ring, 512,

PACKET0(mmUVD_NO_OP,

Quoted 6 lines
Quoted 6 lines

0),

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -1
 0xf,
-                             &adev->uvd.irq, 0);
+        r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq,
+ 0);
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static const struct amdgpu_ring_funcs · line 1048

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0 -0
          return r;
   }
@@ -1047,6 +1046,8 @@ static const struct amdgpu_ring_funcs
 uvd_v6_0_ring_phys_funcs = {
 
   static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs

= {

Quoted 50 lines
Quoted 50 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -0
          .type = AMDGPU_RING_TYPE_UVD,
+        .align_mask = 0xf,
+        .nop = PACKET0(mmUVD_NO_OP, 0),
          .get_rptr = uvd_v6_0_ring_get_rptr,
          .get_wptr = uvd_v6_0_ring_get_wptr,
          .set_wptr = uvd_v6_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_sw_init(void *handle) · line 227

Quoted 8 lines

index cf0c68f..d585839 100644

drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0 -1
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
          for (i = 0; i < adev->vce.num_rings; i++) {
                  ring = &adev->vce.ring[i];
                  sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1 -0
+                r = amdgpu_ring_init(adev, ring, 512,
                                       &adev->vce.irq, 0);
                  if (r)
                          return r; @@ -611,6 +611,8 @@ const

struct amd_ip_funcs vce_v2_0_ip_funcs =

{

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
   static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
          .type = AMDGPU_RING_TYPE_VCE,
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +2 -0
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
          .get_rptr = vce_v2_0_ring_get_rptr,
          .get_wptr = vce_v2_0_ring_get_wptr,
          .set_wptr = vce_v2_0_ring_set_wptr, diff --git

a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_sw_init(void *handle) · line 392

Quoted 8 lines

index 56a3feb..f7dbd0d 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -1
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
          for (i = 0; i < adev->vce.num_rings; i++) {
                  ring = &adev->vce.ring[i];
                  sprintf(ring->name, "vce%d", i);
-                r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP,

0xf,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -1
-                                     &adev->vce.irq, 0);
+                r = amdgpu_ring_init(adev, ring, 512,
+ &adev->vce.irq, 0);
                  if (r)
                          return r;
          }
@@ -850,6 +849,8 @@ static const struct amdgpu_ring_funcs
 vce_v3_0_ring_phys_funcs = {
 
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static const struct amdgpu_ring_funcs · line 851

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -0
   static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs =

{

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -0
          .type = AMDGPU_RING_TYPE_VCE,
+        .align_mask = 0xf,
+        .nop = VCE_CMD_NO_OP,
          .get_rptr = vce_v3_0_ring_get_rptr,
          .get_wptr = vce_v3_0_ring_get_wptr,
          .set_wptr = vce_v3_0_ring_set_wptr,

--
2.5.0

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

Quoted 8 lines
Quoted 4 lines

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

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

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

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