aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-10-05 10:09:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-10-25 14:38:38 -0400
commit7988714237c6a548011dcd7dcce84e9f16dda427 (patch)
treec7775a907d7a03822a4edc7477c22a0bbeeef776
parent21cd942e5c471941769cd0515164b169d012ad8a (diff)
drm/amdgpu: move align_mask and nop into ring funcs as well (v2)
They are constant as well. v2: update uvd and vce phys ring structures as well Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik_sdma.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c14
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dma.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v2_0.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v3_0.c7
14 files changed, 62 insertions, 43 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index b81b1244a120..4c992826d2d6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -65,7 +65,7 @@ int amdgpu_ring_alloc(struct amdgpu_ring *ring, unsigned ndw)
65{ 65{
66 /* Align requested size with padding so unlock_commit can 66 /* Align requested size with padding so unlock_commit can
67 * pad safely */ 67 * pad safely */
68 ndw = (ndw + ring->align_mask) & ~ring->align_mask; 68 ndw = (ndw + ring->funcs->align_mask) & ~ring->funcs->align_mask;
69 69
70 /* Make sure we aren't trying to allocate more space 70 /* Make sure we aren't trying to allocate more space
71 * than the maximum for one submission 71 * than the maximum for one submission
@@ -94,7 +94,7 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
94 int i; 94 int i;
95 95
96 for (i = 0; i < count; i++) 96 for (i = 0; i < count; i++)
97 amdgpu_ring_write(ring, ring->nop); 97 amdgpu_ring_write(ring, ring->funcs->nop);
98} 98}
99 99
100/** amdgpu_ring_generic_pad_ib - pad IB with NOP packets 100/** 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)
106 */ 106 */
107void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib) 107void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib)
108{ 108{
109 while (ib->length_dw & ring->align_mask) 109 while (ib->length_dw & ring->funcs->align_mask)
110 ib->ptr[ib->length_dw++] = ring->nop; 110 ib->ptr[ib->length_dw++] = ring->funcs->nop;
111} 111}
112 112
113/** 113/**
@@ -125,8 +125,9 @@ void amdgpu_ring_commit(struct amdgpu_ring *ring)
125 uint32_t count; 125 uint32_t count;
126 126
127 /* We pad to match fetch size */ 127 /* We pad to match fetch size */
128 count = ring->align_mask + 1 - (ring->wptr & ring->align_mask); 128 count = ring->funcs->align_mask + 1 -
129 count %= ring->align_mask + 1; 129 (ring->wptr & ring->funcs->align_mask);
130 count %= ring->funcs->align_mask + 1;
130 ring->funcs->insert_nop(ring, count); 131 ring->funcs->insert_nop(ring, count);
131 132
132 mb(); 133 mb();
@@ -163,8 +164,8 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
163 * Returns 0 on success, error on failure. 164 * Returns 0 on success, error on failure.
164 */ 165 */
165int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, 166int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
166 unsigned max_dw, u32 nop, u32 align_mask, 167 unsigned max_dw, struct amdgpu_irq_src *irq_src,
167 struct amdgpu_irq_src *irq_src, unsigned irq_type) 168 unsigned irq_type)
168{ 169{
169 int r; 170 int r;
170 171
@@ -215,8 +216,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
215 216
216 ring->ring_size = roundup_pow_of_two(max_dw * 4 * 217 ring->ring_size = roundup_pow_of_two(max_dw * 4 *
217 amdgpu_sched_hw_submission); 218 amdgpu_sched_hw_submission);
218 ring->align_mask = align_mask;
219 ring->nop = nop;
220 219
221 /* Allocate ring buffer */ 220 /* Allocate ring buffer */
222 if (ring->ring_obj == NULL) { 221 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 6cf89c97ef8e..1ee1b65d7eff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -93,6 +93,8 @@ unsigned amdgpu_fence_count_emitted(struct amdgpu_ring *ring);
93/* provided by hw blocks that expose a ring buffer for commands */ 93/* provided by hw blocks that expose a ring buffer for commands */
94struct amdgpu_ring_funcs { 94struct amdgpu_ring_funcs {
95 enum amdgpu_ring_type type; 95 enum amdgpu_ring_type type;
96 uint32_t align_mask;
97 u32 nop;
96 98
97 /* ring read/write ptr handling */ 99 /* ring read/write ptr handling */
98 u32 (*get_rptr)(struct amdgpu_ring *ring); 100 u32 (*get_rptr)(struct amdgpu_ring *ring);
@@ -149,10 +151,8 @@ struct amdgpu_ring {
149 unsigned max_dw; 151 unsigned max_dw;
150 int count_dw; 152 int count_dw;
151 uint64_t gpu_addr; 153 uint64_t gpu_addr;
152 uint32_t align_mask;
153 uint32_t ptr_mask; 154 uint32_t ptr_mask;
154 bool ready; 155 bool ready;
155 u32 nop;
156 u32 idx; 156 u32 idx;
157 u32 me; 157 u32 me;
158 u32 pipe; 158 u32 pipe;
@@ -178,8 +178,8 @@ void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib);
178void amdgpu_ring_commit(struct amdgpu_ring *ring); 178void amdgpu_ring_commit(struct amdgpu_ring *ring);
179void amdgpu_ring_undo(struct amdgpu_ring *ring); 179void amdgpu_ring_undo(struct amdgpu_ring *ring);
180int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, 180int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
181 unsigned ring_size, u32 nop, u32 align_mask, 181 unsigned ring_size, struct amdgpu_irq_src *irq_src,
182 struct amdgpu_irq_src *irq_src, unsigned irq_type); 182 unsigned irq_type);
183void amdgpu_ring_fini(struct amdgpu_ring *ring); 183void amdgpu_ring_fini(struct amdgpu_ring *ring);
184 184
185#endif 185#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index 472cfff28ccf..b96ef20e871f 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -206,10 +206,10 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
206 206
207 for (i = 0; i < count; i++) 207 for (i = 0; i < count; i++)
208 if (sdma && sdma->burst_nop && (i == 0)) 208 if (sdma && sdma->burst_nop && (i == 0))
209 amdgpu_ring_write(ring, ring->nop | 209 amdgpu_ring_write(ring, ring->funcs->nop |
210 SDMA_NOP_COUNT(count - 1)); 210 SDMA_NOP_COUNT(count - 1));
211 else 211 else
212 amdgpu_ring_write(ring, ring->nop); 212 amdgpu_ring_write(ring, ring->funcs->nop);
213} 213}
214 214
215/** 215/**
@@ -943,7 +943,6 @@ static int cik_sdma_sw_init(void *handle)
943 ring->ring_obj = NULL; 943 ring->ring_obj = NULL;
944 sprintf(ring->name, "sdma%d", i); 944 sprintf(ring->name, "sdma%d", i);
945 r = amdgpu_ring_init(adev, ring, 1024, 945 r = amdgpu_ring_init(adev, ring, 1024,
946 SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0), 0xf,
947 &adev->sdma.trap_irq, 946 &adev->sdma.trap_irq,
948 (i == 0) ? 947 (i == 0) ?
949 AMDGPU_SDMA_IRQ_TRAP0 : 948 AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1210,6 +1209,8 @@ const struct amd_ip_funcs cik_sdma_ip_funcs = {
1210 1209
1211static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = { 1210static const struct amdgpu_ring_funcs cik_sdma_ring_funcs = {
1212 .type = AMDGPU_RING_TYPE_SDMA, 1211 .type = AMDGPU_RING_TYPE_SDMA,
1212 .align_mask = 0xf,
1213 .nop = SDMA_PACKET(SDMA_OPCODE_NOP, 0, 0),
1213 .get_rptr = cik_sdma_ring_get_rptr, 1214 .get_rptr = cik_sdma_ring_get_rptr,
1214 .get_wptr = cik_sdma_ring_get_wptr, 1215 .get_wptr = cik_sdma_ring_get_wptr,
1215 .set_wptr = cik_sdma_ring_set_wptr, 1216 .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 1f8687fd8662..367b14e16e53 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -2869,7 +2869,6 @@ static int gfx_v6_0_sw_init(void *handle)
2869 ring->ring_obj = NULL; 2869 ring->ring_obj = NULL;
2870 sprintf(ring->name, "gfx"); 2870 sprintf(ring->name, "gfx");
2871 r = amdgpu_ring_init(adev, ring, 1024, 2871 r = amdgpu_ring_init(adev, ring, 1024,
2872 0x80000000, 0xff,
2873 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP); 2872 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
2874 if (r) 2873 if (r)
2875 return r; 2874 return r;
@@ -2892,7 +2891,6 @@ static int gfx_v6_0_sw_init(void *handle)
2892 sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue); 2891 sprintf(ring->name, "comp %d.%d.%d", ring->me, ring->pipe, ring->queue);
2893 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; 2892 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
2894 r = amdgpu_ring_init(adev, ring, 1024, 2893 r = amdgpu_ring_init(adev, ring, 1024,
2895 0x80000000, 0xff,
2896 &adev->gfx.eop_irq, irq_type); 2894 &adev->gfx.eop_irq, irq_type);
2897 if (r) 2895 if (r)
2898 return r; 2896 return r;
@@ -3227,6 +3225,8 @@ const struct amd_ip_funcs gfx_v6_0_ip_funcs = {
3227 3225
3228static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = { 3226static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_gfx = {
3229 .type = AMDGPU_RING_TYPE_GFX, 3227 .type = AMDGPU_RING_TYPE_GFX,
3228 .align_mask = 0xff,
3229 .nop = 0x80000000,
3230 .get_rptr = gfx_v6_0_ring_get_rptr, 3230 .get_rptr = gfx_v6_0_ring_get_rptr,
3231 .get_wptr = gfx_v6_0_ring_get_wptr, 3231 .get_wptr = gfx_v6_0_ring_get_wptr,
3232 .set_wptr = gfx_v6_0_ring_set_wptr_gfx, 3232 .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 = {
3252 3252
3253static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = { 3253static const struct amdgpu_ring_funcs gfx_v6_0_ring_funcs_compute = {
3254 .type = AMDGPU_RING_TYPE_COMPUTE, 3254 .type = AMDGPU_RING_TYPE_COMPUTE,
3255 .align_mask = 0xff,
3256 .nop = 0x80000000,
3255 .get_rptr = gfx_v6_0_ring_get_rptr, 3257 .get_rptr = gfx_v6_0_ring_get_rptr,
3256 .get_wptr = gfx_v6_0_ring_get_wptr, 3258 .get_wptr = gfx_v6_0_ring_get_wptr,
3257 .set_wptr = gfx_v6_0_ring_set_wptr_compute, 3259 .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 cb2fc826f95c..388649734b36 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4611,7 +4611,6 @@ static int gfx_v7_0_sw_init(void *handle)
4611 ring->ring_obj = NULL; 4611 ring->ring_obj = NULL;
4612 sprintf(ring->name, "gfx"); 4612 sprintf(ring->name, "gfx");
4613 r = amdgpu_ring_init(adev, ring, 1024, 4613 r = amdgpu_ring_init(adev, ring, 1024,
4614 PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
4615 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP); 4614 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
4616 if (r) 4615 if (r)
4617 return r; 4616 return r;
@@ -4637,7 +4636,6 @@ static int gfx_v7_0_sw_init(void *handle)
4637 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; 4636 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
4638 /* type-2 packets are deprecated on MEC, use type-3 instead */ 4637 /* type-2 packets are deprecated on MEC, use type-3 instead */
4639 r = amdgpu_ring_init(adev, ring, 1024, 4638 r = amdgpu_ring_init(adev, ring, 1024,
4640 PACKET3(PACKET3_NOP, 0x3FFF), 0xff,
4641 &adev->gfx.eop_irq, irq_type); 4639 &adev->gfx.eop_irq, irq_type);
4642 if (r) 4640 if (r)
4643 return r; 4641 return r;
@@ -5108,6 +5106,8 @@ const struct amd_ip_funcs gfx_v7_0_ip_funcs = {
5108 5106
5109static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = { 5107static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
5110 .type = AMDGPU_RING_TYPE_GFX, 5108 .type = AMDGPU_RING_TYPE_GFX,
5109 .align_mask = 0xff,
5110 .nop = PACKET3(PACKET3_NOP, 0x3FFF),
5111 .get_rptr = gfx_v7_0_ring_get_rptr, 5111 .get_rptr = gfx_v7_0_ring_get_rptr,
5112 .get_wptr = gfx_v7_0_ring_get_wptr_gfx, 5112 .get_wptr = gfx_v7_0_ring_get_wptr_gfx,
5113 .set_wptr = gfx_v7_0_ring_set_wptr_gfx, 5113 .set_wptr = gfx_v7_0_ring_set_wptr_gfx,
@@ -5136,6 +5136,8 @@ static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = {
5136 5136
5137static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = { 5137static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = {
5138 .type = AMDGPU_RING_TYPE_COMPUTE, 5138 .type = AMDGPU_RING_TYPE_COMPUTE,
5139 .align_mask = 0xff,
5140 .nop = PACKET3(PACKET3_NOP, 0x3FFF),
5139 .get_rptr = gfx_v7_0_ring_get_rptr, 5141 .get_rptr = gfx_v7_0_ring_get_rptr,
5140 .get_wptr = gfx_v7_0_ring_get_wptr_compute, 5142 .get_wptr = gfx_v7_0_ring_get_wptr_compute,
5141 .set_wptr = gfx_v7_0_ring_set_wptr_compute, 5143 .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 637dbc1a2e48..6f3996f6d39a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -2034,9 +2034,8 @@ static int gfx_v8_0_sw_init(void *handle)
2034 ring->doorbell_index = AMDGPU_DOORBELL_GFX_RING0; 2034 ring->doorbell_index = AMDGPU_DOORBELL_GFX_RING0;
2035 } 2035 }
2036 2036
2037 r = amdgpu_ring_init(adev, ring, 1024, 2037 r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
2038 PACKET3(PACKET3_NOP, 0x3FFF), 0xff, 2038 AMDGPU_CP_IRQ_GFX_EOP);
2039 &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP);
2040 if (r) 2039 if (r)
2041 return r; 2040 return r;
2042 } 2041 }
@@ -2060,9 +2059,8 @@ static int gfx_v8_0_sw_init(void *handle)
2060 sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue); 2059 sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue);
2061 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; 2060 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe;
2062 /* type-2 packets are deprecated on MEC, use type-3 instead */ 2061 /* type-2 packets are deprecated on MEC, use type-3 instead */
2063 r = amdgpu_ring_init(adev, ring, 1024, 2062 r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
2064 PACKET3(PACKET3_NOP, 0x3FFF), 0xff, 2063 irq_type);
2065 &adev->gfx.eop_irq, irq_type);
2066 if (r) 2064 if (r)
2067 return r; 2065 return r;
2068 } 2066 }
@@ -6528,6 +6526,8 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = {
6528 6526
6529static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { 6527static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
6530 .type = AMDGPU_RING_TYPE_GFX, 6528 .type = AMDGPU_RING_TYPE_GFX,
6529 .align_mask = 0xff,
6530 .nop = PACKET3(PACKET3_NOP, 0x3FFF),
6531 .get_rptr = gfx_v8_0_ring_get_rptr, 6531 .get_rptr = gfx_v8_0_ring_get_rptr,
6532 .get_wptr = gfx_v8_0_ring_get_wptr_gfx, 6532 .get_wptr = gfx_v8_0_ring_get_wptr_gfx,
6533 .set_wptr = gfx_v8_0_ring_set_wptr_gfx, 6533 .set_wptr = gfx_v8_0_ring_set_wptr_gfx,
@@ -6558,6 +6558,8 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = {
6558 6558
6559static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { 6559static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = {
6560 .type = AMDGPU_RING_TYPE_COMPUTE, 6560 .type = AMDGPU_RING_TYPE_COMPUTE,
6561 .align_mask = 0xff,
6562 .nop = PACKET3(PACKET3_NOP, 0x3FFF),
6561 .get_rptr = gfx_v8_0_ring_get_rptr, 6563 .get_rptr = gfx_v8_0_ring_get_rptr,
6562 .get_wptr = gfx_v8_0_ring_get_wptr_compute, 6564 .get_wptr = gfx_v8_0_ring_get_wptr_compute,
6563 .set_wptr = gfx_v8_0_ring_set_wptr_compute, 6565 .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 36a135de44fe..5859a106608b 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -232,10 +232,10 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
232 232
233 for (i = 0; i < count; i++) 233 for (i = 0; i < count; i++)
234 if (sdma && sdma->burst_nop && (i == 0)) 234 if (sdma && sdma->burst_nop && (i == 0))
235 amdgpu_ring_write(ring, ring->nop | 235 amdgpu_ring_write(ring, ring->funcs->nop |
236 SDMA_PKT_NOP_HEADER_COUNT(count - 1)); 236 SDMA_PKT_NOP_HEADER_COUNT(count - 1));
237 else 237 else
238 amdgpu_ring_write(ring, ring->nop); 238 amdgpu_ring_write(ring, ring->funcs->nop);
239} 239}
240 240
241/** 241/**
@@ -949,7 +949,6 @@ static int sdma_v2_4_sw_init(void *handle)
949 ring->use_doorbell = false; 949 ring->use_doorbell = false;
950 sprintf(ring->name, "sdma%d", i); 950 sprintf(ring->name, "sdma%d", i);
951 r = amdgpu_ring_init(adev, ring, 1024, 951 r = amdgpu_ring_init(adev, ring, 1024,
952 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
953 &adev->sdma.trap_irq, 952 &adev->sdma.trap_irq,
954 (i == 0) ? 953 (i == 0) ?
955 AMDGPU_SDMA_IRQ_TRAP0 : 954 AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1207,6 +1206,8 @@ const struct amd_ip_funcs sdma_v2_4_ip_funcs = {
1207 1206
1208static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = { 1207static const struct amdgpu_ring_funcs sdma_v2_4_ring_funcs = {
1209 .type = AMDGPU_RING_TYPE_SDMA, 1208 .type = AMDGPU_RING_TYPE_SDMA,
1209 .align_mask = 0xf,
1210 .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
1210 .get_rptr = sdma_v2_4_ring_get_rptr, 1211 .get_rptr = sdma_v2_4_ring_get_rptr,
1211 .get_wptr = sdma_v2_4_ring_get_wptr, 1212 .get_wptr = sdma_v2_4_ring_get_wptr,
1212 .set_wptr = sdma_v2_4_ring_set_wptr, 1213 .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 e4f59c36f989..24642f92b4b5 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -392,10 +392,10 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
392 392
393 for (i = 0; i < count; i++) 393 for (i = 0; i < count; i++)
394 if (sdma && sdma->burst_nop && (i == 0)) 394 if (sdma && sdma->burst_nop && (i == 0))
395 amdgpu_ring_write(ring, ring->nop | 395 amdgpu_ring_write(ring, ring->funcs->nop |
396 SDMA_PKT_NOP_HEADER_COUNT(count - 1)); 396 SDMA_PKT_NOP_HEADER_COUNT(count - 1));
397 else 397 else
398 amdgpu_ring_write(ring, ring->nop); 398 amdgpu_ring_write(ring, ring->funcs->nop);
399} 399}
400 400
401/** 401/**
@@ -1161,7 +1161,6 @@ static int sdma_v3_0_sw_init(void *handle)
1161 1161
1162 sprintf(ring->name, "sdma%d", i); 1162 sprintf(ring->name, "sdma%d", i);
1163 r = amdgpu_ring_init(adev, ring, 1024, 1163 r = amdgpu_ring_init(adev, ring, 1024,
1164 SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP), 0xf,
1165 &adev->sdma.trap_irq, 1164 &adev->sdma.trap_irq,
1166 (i == 0) ? 1165 (i == 0) ?
1167 AMDGPU_SDMA_IRQ_TRAP0 : 1166 AMDGPU_SDMA_IRQ_TRAP0 :
@@ -1550,6 +1549,8 @@ const struct amd_ip_funcs sdma_v3_0_ip_funcs = {
1550 1549
1551static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = { 1550static const struct amdgpu_ring_funcs sdma_v3_0_ring_funcs = {
1552 .type = AMDGPU_RING_TYPE_SDMA, 1551 .type = AMDGPU_RING_TYPE_SDMA,
1552 .align_mask = 0xf,
1553 .nop = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP),
1553 .get_rptr = sdma_v3_0_ring_get_rptr, 1554 .get_rptr = sdma_v3_0_ring_get_rptr,
1554 .get_wptr = sdma_v3_0_ring_get_wptr, 1555 .get_wptr = sdma_v3_0_ring_get_wptr,
1555 .set_wptr = sdma_v3_0_ring_set_wptr, 1556 .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 1aee45b0bb9e..7fece1fe4130 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
@@ -531,7 +531,6 @@ static int si_dma_sw_init(void *handle)
531 ring->use_doorbell = false; 531 ring->use_doorbell = false;
532 sprintf(ring->name, "sdma%d", i); 532 sprintf(ring->name, "sdma%d", i);
533 r = amdgpu_ring_init(adev, ring, 1024, 533 r = amdgpu_ring_init(adev, ring, 1024,
534 DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0), 0xf,
535 &adev->sdma.trap_irq, 534 &adev->sdma.trap_irq,
536 (i == 0) ? 535 (i == 0) ?
537 AMDGPU_SDMA_IRQ_TRAP0 : 536 AMDGPU_SDMA_IRQ_TRAP0 :
@@ -765,6 +764,8 @@ const struct amd_ip_funcs si_dma_ip_funcs = {
765 764
766static const struct amdgpu_ring_funcs si_dma_ring_funcs = { 765static const struct amdgpu_ring_funcs si_dma_ring_funcs = {
767 .type = AMDGPU_RING_TYPE_SDMA, 766 .type = AMDGPU_RING_TYPE_SDMA,
767 .align_mask = 0xf,
768 .nop = DMA_PACKET(DMA_PACKET_NOP, 0, 0, 0, 0),
768 .get_rptr = si_dma_ring_get_rptr, 769 .get_rptr = si_dma_ring_get_rptr,
769 .get_wptr = si_dma_ring_get_wptr, 770 .get_wptr = si_dma_ring_get_wptr,
770 .set_wptr = si_dma_ring_set_wptr, 771 .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 55af8aca4b2a..1bab75afba5d 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
@@ -116,8 +116,7 @@ static int uvd_v4_2_sw_init(void *handle)
116 116
117 ring = &adev->uvd.ring; 117 ring = &adev->uvd.ring;
118 sprintf(ring->name, "uvd"); 118 sprintf(ring->name, "uvd");
119 r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf, 119 r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
120 &adev->uvd.irq, 0);
121 120
122 return r; 121 return r;
123} 122}
@@ -743,6 +742,8 @@ const struct amd_ip_funcs uvd_v4_2_ip_funcs = {
743 742
744static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = { 743static const struct amdgpu_ring_funcs uvd_v4_2_ring_funcs = {
745 .type = AMDGPU_RING_TYPE_UVD, 744 .type = AMDGPU_RING_TYPE_UVD,
745 .align_mask = 0xf,
746 .nop = PACKET0(mmUVD_NO_OP, 0),
746 .get_rptr = uvd_v4_2_ring_get_rptr, 747 .get_rptr = uvd_v4_2_ring_get_rptr,
747 .get_wptr = uvd_v4_2_ring_get_wptr, 748 .get_wptr = uvd_v4_2_ring_get_wptr,
748 .set_wptr = uvd_v4_2_ring_set_wptr, 749 .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 21e725b50a90..ec848fc57f70 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
@@ -112,8 +112,7 @@ static int uvd_v5_0_sw_init(void *handle)
112 112
113 ring = &adev->uvd.ring; 113 ring = &adev->uvd.ring;
114 sprintf(ring->name, "uvd"); 114 sprintf(ring->name, "uvd");
115 r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf, 115 r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
116 &adev->uvd.irq, 0);
117 116
118 return r; 117 return r;
119} 118}
@@ -794,6 +793,8 @@ const struct amd_ip_funcs uvd_v5_0_ip_funcs = {
794 793
795static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = { 794static const struct amdgpu_ring_funcs uvd_v5_0_ring_funcs = {
796 .type = AMDGPU_RING_TYPE_UVD, 795 .type = AMDGPU_RING_TYPE_UVD,
796 .align_mask = 0xf,
797 .nop = PACKET0(mmUVD_NO_OP, 0),
797 .get_rptr = uvd_v5_0_ring_get_rptr, 798 .get_rptr = uvd_v5_0_ring_get_rptr,
798 .get_wptr = uvd_v5_0_ring_get_wptr, 799 .get_wptr = uvd_v5_0_ring_get_wptr,
799 .set_wptr = uvd_v5_0_ring_set_wptr, 800 .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 65df5b208243..be912933b073 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -116,8 +116,7 @@ static int uvd_v6_0_sw_init(void *handle)
116 116
117 ring = &adev->uvd.ring; 117 ring = &adev->uvd.ring;
118 sprintf(ring->name, "uvd"); 118 sprintf(ring->name, "uvd");
119 r = amdgpu_ring_init(adev, ring, 512, PACKET0(mmUVD_NO_OP, 0), 0xf, 119 r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.irq, 0);
120 &adev->uvd.irq, 0);
121 120
122 return r; 121 return r;
123} 122}
@@ -1024,6 +1023,8 @@ const struct amd_ip_funcs uvd_v6_0_ip_funcs = {
1024 1023
1025static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = { 1024static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = {
1026 .type = AMDGPU_RING_TYPE_UVD, 1025 .type = AMDGPU_RING_TYPE_UVD,
1026 .align_mask = 0xf,
1027 .nop = PACKET0(mmUVD_NO_OP, 0),
1027 .get_rptr = uvd_v6_0_ring_get_rptr, 1028 .get_rptr = uvd_v6_0_ring_get_rptr,
1028 .get_wptr = uvd_v6_0_ring_get_wptr, 1029 .get_wptr = uvd_v6_0_ring_get_wptr,
1029 .set_wptr = uvd_v6_0_ring_set_wptr, 1030 .set_wptr = uvd_v6_0_ring_set_wptr,
@@ -1048,6 +1049,8 @@ static const struct amdgpu_ring_funcs uvd_v6_0_ring_phys_funcs = {
1048 1049
1049static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = { 1050static const struct amdgpu_ring_funcs uvd_v6_0_ring_vm_funcs = {
1050 .type = AMDGPU_RING_TYPE_UVD, 1051 .type = AMDGPU_RING_TYPE_UVD,
1052 .align_mask = 0xf,
1053 .nop = PACKET0(mmUVD_NO_OP, 0),
1051 .get_rptr = uvd_v6_0_ring_get_rptr, 1054 .get_rptr = uvd_v6_0_ring_get_rptr,
1052 .get_wptr = uvd_v6_0_ring_get_wptr, 1055 .get_wptr = uvd_v6_0_ring_get_wptr,
1053 .set_wptr = uvd_v6_0_ring_set_wptr, 1056 .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 cf0c68fda20e..d58583983b11 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
@@ -224,7 +224,7 @@ static int vce_v2_0_sw_init(void *handle)
224 for (i = 0; i < adev->vce.num_rings; i++) { 224 for (i = 0; i < adev->vce.num_rings; i++) {
225 ring = &adev->vce.ring[i]; 225 ring = &adev->vce.ring[i];
226 sprintf(ring->name, "vce%d", i); 226 sprintf(ring->name, "vce%d", i);
227 r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf, 227 r = amdgpu_ring_init(adev, ring, 512,
228 &adev->vce.irq, 0); 228 &adev->vce.irq, 0);
229 if (r) 229 if (r)
230 return r; 230 return r;
@@ -611,6 +611,8 @@ const struct amd_ip_funcs vce_v2_0_ip_funcs = {
611 611
612static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = { 612static const struct amdgpu_ring_funcs vce_v2_0_ring_funcs = {
613 .type = AMDGPU_RING_TYPE_VCE, 613 .type = AMDGPU_RING_TYPE_VCE,
614 .align_mask = 0xf,
615 .nop = VCE_CMD_NO_OP,
614 .get_rptr = vce_v2_0_ring_get_rptr, 616 .get_rptr = vce_v2_0_ring_get_rptr,
615 .get_wptr = vce_v2_0_ring_get_wptr, 617 .get_wptr = vce_v2_0_ring_get_wptr,
616 .set_wptr = vce_v2_0_ring_set_wptr, 618 .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 95fe8a8bda12..589fff19aa78 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -389,8 +389,7 @@ static int vce_v3_0_sw_init(void *handle)
389 for (i = 0; i < adev->vce.num_rings; i++) { 389 for (i = 0; i < adev->vce.num_rings; i++) {
390 ring = &adev->vce.ring[i]; 390 ring = &adev->vce.ring[i];
391 sprintf(ring->name, "vce%d", i); 391 sprintf(ring->name, "vce%d", i);
392 r = amdgpu_ring_init(adev, ring, 512, VCE_CMD_NO_OP, 0xf, 392 r = amdgpu_ring_init(adev, ring, 512, &adev->vce.irq, 0);
393 &adev->vce.irq, 0);
394 if (r) 393 if (r)
395 return r; 394 return r;
396 } 395 }
@@ -830,6 +829,8 @@ const struct amd_ip_funcs vce_v3_0_ip_funcs = {
830 829
831static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = { 830static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
832 .type = AMDGPU_RING_TYPE_VCE, 831 .type = AMDGPU_RING_TYPE_VCE,
832 .align_mask = 0xf,
833 .nop = VCE_CMD_NO_OP,
833 .get_rptr = vce_v3_0_ring_get_rptr, 834 .get_rptr = vce_v3_0_ring_get_rptr,
834 .get_wptr = vce_v3_0_ring_get_wptr, 835 .get_wptr = vce_v3_0_ring_get_wptr,
835 .set_wptr = vce_v3_0_ring_set_wptr, 836 .set_wptr = vce_v3_0_ring_set_wptr,
@@ -850,6 +851,8 @@ static const struct amdgpu_ring_funcs vce_v3_0_ring_phys_funcs = {
850 851
851static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = { 852static const struct amdgpu_ring_funcs vce_v3_0_ring_vm_funcs = {
852 .type = AMDGPU_RING_TYPE_VCE, 853 .type = AMDGPU_RING_TYPE_VCE,
854 .align_mask = 0xf,
855 .nop = VCE_CMD_NO_OP,
853 .get_rptr = vce_v3_0_ring_get_rptr, 856 .get_rptr = vce_v3_0_ring_get_rptr,
854 .get_wptr = vce_v3_0_ring_get_wptr, 857 .get_wptr = vce_v3_0_ring_get_wptr,
855 .set_wptr = vce_v3_0_ring_set_wptr, 858 .set_wptr = vce_v3_0_ring_set_wptr,