aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2018-03-27 12:58:14 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-05-15 14:43:13 -0400
commit828536385ab0d25b5ddd7153347df04ea3a6961d (patch)
tree94745c42689a8b2a48bf012572eb4efae5094ad8 /drivers/gpu/drm
parent9da00630188da6e8ad1596c2b58809c833b16154 (diff)
drm/amdgpu: add emit_reg_write_reg_wait ring callback
This callback writes a value to a register and then reads back another register and waits for a value in a single operation. Provide a helper function using two operations for engines that don't support this opertion. Reviewed-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c20
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h7
3 files changed, 28 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 7eb0e4846a76..c25ee750c362 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1806,6 +1806,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
1806#define amdgpu_ring_emit_rreg(r, d) (r)->funcs->emit_rreg((r), (d)) 1806#define amdgpu_ring_emit_rreg(r, d) (r)->funcs->emit_rreg((r), (d))
1807#define amdgpu_ring_emit_wreg(r, d, v) (r)->funcs->emit_wreg((r), (d), (v)) 1807#define amdgpu_ring_emit_wreg(r, d, v) (r)->funcs->emit_wreg((r), (d), (v))
1808#define amdgpu_ring_emit_reg_wait(r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) 1808#define amdgpu_ring_emit_reg_wait(r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m))
1809#define amdgpu_ring_emit_reg_write_reg_wait(r, d0, d1, v, m) (r)->funcs->emit_reg_write_reg_wait((r), (d0), (d1), (v), (m))
1809#define amdgpu_ring_emit_tmz(r, b) (r)->funcs->emit_tmz((r), (b)) 1810#define amdgpu_ring_emit_tmz(r, b) (r)->funcs->emit_tmz((r), (b))
1810#define amdgpu_ring_pad_ib(r, ib) ((r)->funcs->pad_ib((r), (ib))) 1811#define amdgpu_ring_pad_ib(r, ib) ((r)->funcs->pad_ib((r), (ib)))
1811#define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r)) 1812#define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r))
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index d5f526f38e50..49cad08b5c16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -459,6 +459,26 @@ void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring)
459 spin_unlock(&adev->ring_lru_list_lock); 459 spin_unlock(&adev->ring_lru_list_lock);
460} 460}
461 461
462/**
463 * amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper
464 *
465 * @adev: amdgpu_device pointer
466 * @reg0: register to write
467 * @reg1: register to wait on
468 * @ref: reference value to write/wait on
469 * @mask: mask to wait on
470 *
471 * Helper for rings that don't support write and wait in a
472 * single oneshot packet.
473 */
474void amdgpu_ring_emit_reg_write_reg_wait_helper(struct amdgpu_ring *ring,
475 uint32_t reg0, uint32_t reg1,
476 uint32_t ref, uint32_t mask)
477{
478 amdgpu_ring_emit_wreg(ring, reg0, ref);
479 amdgpu_ring_emit_reg_wait(ring, reg1, mask, mask);
480}
481
462/* 482/*
463 * Debugfs info 483 * Debugfs info
464 */ 484 */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 1a5911882657..08fcdf6f7b53 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -154,6 +154,9 @@ struct amdgpu_ring_funcs {
154 void (*emit_wreg)(struct amdgpu_ring *ring, uint32_t reg, uint32_t val); 154 void (*emit_wreg)(struct amdgpu_ring *ring, uint32_t reg, uint32_t val);
155 void (*emit_reg_wait)(struct amdgpu_ring *ring, uint32_t reg, 155 void (*emit_reg_wait)(struct amdgpu_ring *ring, uint32_t reg,
156 uint32_t val, uint32_t mask); 156 uint32_t val, uint32_t mask);
157 void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring,
158 uint32_t reg0, uint32_t reg1,
159 uint32_t ref, uint32_t mask);
157 void (*emit_tmz)(struct amdgpu_ring *ring, bool start); 160 void (*emit_tmz)(struct amdgpu_ring *ring, bool start);
158 /* priority functions */ 161 /* priority functions */
159 void (*set_priority) (struct amdgpu_ring *ring, 162 void (*set_priority) (struct amdgpu_ring *ring,
@@ -228,6 +231,10 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type,
228 int *blacklist, int num_blacklist, 231 int *blacklist, int num_blacklist,
229 bool lru_pipe_order, struct amdgpu_ring **ring); 232 bool lru_pipe_order, struct amdgpu_ring **ring);
230void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring); 233void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring);
234void amdgpu_ring_emit_reg_write_reg_wait_helper(struct amdgpu_ring *ring,
235 uint32_t reg0, uint32_t val0,
236 uint32_t reg1, uint32_t val1);
237
231static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring) 238static inline void amdgpu_ring_clear_ring(struct amdgpu_ring *ring)
232{ 239{
233 int i = 0; 240 int i = 0;