drm/amdgpu: add emit_reg_write_reg_wait ring callback
Subsystems (2)
PATCH 1/8 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 20 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 7 +++++++ 3 files changed, 28 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1787,6 +1787,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_ring_emit_rreg (r, d) (r)->funcs->emit_rreg((r), (d))#define amdgpu_ring_emit_wreg (r, d, v) (r)->funcs->emit_wreg((r), (d), (v))#define amdgpu_ring_emit_reg_wait (r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) +#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))#define amdgpu_ring_emit_tmz (r, b) (r)->funcs->emit_tmz((r), (b))#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))
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +20 -0
@@ -459,6 +459,26 @@ void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring)spin_unlock (&adev->ring_lru_list_lock); } +/** +* amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper +* +* @adev: amdgpu_device pointer +* @reg0: register to write +* @reg1: register to wait on +* @ref: reference value to write/wait on +* @mask: mask to wait on +* +* Helper for rings that don't support write and wait in a +* single oneshot packet. +*/ +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +amdgpu_ring_emit_wreg (ring, reg0, ref); +amdgpu_ring_emit_reg_wait (ring, reg1, mask, mask); +} +/* * Debugfs info */
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7 -0
@@ -154,6 +154,9 @@ struct amdgpu_ring_funcs {void (*emit_wreg)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val);void (*emit_reg_wait)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val,uint32_t mask); +void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask);void (*emit_tmz)(struct amdgpu_ring *ring,bool start);/* priority functions */ void (*set_priority) (struct amdgpu_ring *ring,
@@ -228,6 +231,10 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, int *blacklist, int num_blacklist, bool lru_pipe_order, struct amdgpu_ring **ring);void amdgpu_ring_lru_touch (struct amdgpu_device *adev,struct amdgpu_ring *ring); +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t val0, +uint32_t reg1,uint32_t val1); +static inline void amdgpu_ring_clear_ring (struct amdgpu_ring *ring) {int i =0 ;
Signature · 6 lines
2.13.6 _______________________________________________ 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): 20180327223258.10638-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/8 drm/amdgpu/gfx9: add emit_reg_write_reg_wait ring callback
This adds support for writing and reading back in a single oneshot packet. This is needed to send a tlb invalidation and wait for ack in a single operation.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10 -0
@@ -4078,6 +4078,13 @@ static void gfx_v9_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,gfx_v9_0_wait_reg_mem (ring,0 ,0 ,0 , reg,0 , val, mask,0x20 ); } +static void gfx_v9_0_ring_emit_reg_write_reg_wait (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +gfx_v9_0_wait_reg_mem (ring,0 ,0 ,1 , reg0, reg1, ref, mask,0x20 ); +} +static void gfx_v9_0_set_gfx_eop_interrupt_state (struct amdgpu_device *adev,enum amdgpu_interrupt_state state) {
@@ -4399,6 +4406,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = { .emit_tmz = gfx_v9_0_ring_emit_tmz, .emit_wreg = gfx_v9_0_ring_emit_wreg, .emit_reg_wait = gfx_v9_0_ring_emit_reg_wait, + .emit_reg_write_reg_wait = gfx_v9_0_ring_emit_reg_write_reg_wait, };static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
@@ -4433,6 +4441,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { .set_priority = gfx_v9_0_ring_set_priority_compute, .emit_wreg = gfx_v9_0_ring_emit_wreg, .emit_reg_wait = gfx_v9_0_ring_emit_reg_wait, + .emit_reg_write_reg_wait = gfx_v9_0_ring_emit_reg_write_reg_wait, };static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
@@ -4463,6 +4472,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = { .emit_rreg = gfx_v9_0_ring_emit_rreg, .emit_wreg = gfx_v9_0_ring_emit_wreg, .emit_reg_wait = gfx_v9_0_ring_emit_reg_wait, + .emit_reg_write_reg_wait = gfx_v9_0_ring_emit_reg_write_reg_wait, };static void gfx_v9_0_set_ring_funcs (struct amdgpu_device *adev)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/8 drm/amdgpu/sdma4: use a helper for SDMA_OP_POLL_REGMEM
In reply to a message not in the archiveRather than opencoding it in a bunch of functions.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 62 +++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +34 -28
@@ -360,6 +360,31 @@ static void sdma_v4_0_ring_emit_ib(struct amdgpu_ring *ring, } +static void sdma_v4_0_wait_reg_mem (struct amdgpu_ring *ring, +int mem_space,int hdp, +uint32_t addr0,uint32_t addr1, +uint32_t ref,uint32_t mask, +uint32_t inv) +{ +amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_POLL_REGMEM ) | +SDMA_PKT_POLL_REGMEM_HEADER_HDP_FLUSH (hdp) | +SDMA_PKT_POLL_REGMEM_HEADER_MEM_POLL (mem_space) | +SDMA_PKT_POLL_REGMEM_HEADER_FUNC (3 ));/* == */ +if (mem_space) { +/* memory */ +amdgpu_ring_write (ring, addr0); +amdgpu_ring_write (ring, addr1); + }else { +/* registers */ +amdgpu_ring_write (ring, addr0 <<2 ); +amdgpu_ring_write (ring, addr1 <<2 ); + } +amdgpu_ring_write (ring, ref);/* reference */ +amdgpu_ring_write (ring, mask);/* mask */ +amdgpu_ring_write (ring,SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT (0xfff ) | +SDMA_PKT_POLL_REGMEM_DW5_INTERVAL (inv));/* retry count, poll interval */ +} +/** * sdma_v4_0_ring_emit_hdp_flush - emit an hdp flush on the DMA ring *
@@ -378,15 +403,10 @@ static void sdma_v4_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)else ref_and_mask = nbio_hf_reg->ref_and_mask_sdma1; -amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_POLL_REGMEM ) | -SDMA_PKT_POLL_REGMEM_HEADER_HDP_FLUSH (1 ) | -SDMA_PKT_POLL_REGMEM_HEADER_FUNC (3 ));/* == */ -amdgpu_ring_write (ring, (adev->nbio_funcs->get_hdp_flush_done_offset (adev)) <<2 ); -amdgpu_ring_write (ring, (adev->nbio_funcs->get_hdp_flush_req_offset (adev)) <<2 ); -amdgpu_ring_write (ring, ref_and_mask);/* reference */ -amdgpu_ring_write (ring, ref_and_mask);/* mask */ -amdgpu_ring_write (ring,SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT (0xfff ) | -SDMA_PKT_POLL_REGMEM_DW5_INTERVAL (10 ));/* retry count, poll interval */ +sdma_v4_0_wait_reg_mem (ring,0 ,1 , + adev->nbio_funcs->get_hdp_flush_done_offset (adev), + adev->nbio_funcs->get_hdp_flush_req_offset (adev), + ref_and_mask, ref_and_mask,10 ); }/**
@@ -1114,16 +1134,10 @@ static void sdma_v4_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)uint64_t addr = ring->fence_drv.gpu_addr;/* wait for idle */ -amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_POLL_REGMEM ) | -SDMA_PKT_POLL_REGMEM_HEADER_HDP_FLUSH (0 ) | -SDMA_PKT_POLL_REGMEM_HEADER_FUNC (3 ) |/* equal */ -SDMA_PKT_POLL_REGMEM_HEADER_MEM_POLL (1 )); -amdgpu_ring_write (ring, addr &0xfffffffc ); -amdgpu_ring_write (ring,upper_32_bits (addr) &0xffffffff ); -amdgpu_ring_write (ring, seq);/* reference */ -amdgpu_ring_write (ring,0xffffffff );/* mask */ -amdgpu_ring_write (ring,SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT (0xfff ) | -SDMA_PKT_POLL_REGMEM_DW5_INTERVAL (4 ));/* retry count, poll interval */ +sdma_v4_0_wait_reg_mem (ring,1 ,0 , + addr &0xfffffffc , +upper_32_bits (addr) &0xffffffff , + seq,0xffffffff ,4 ); }
@@ -1154,15 +1168,7 @@ static void sdma_v4_0_ring_emit_wreg(struct amdgpu_ring *ring,static void sdma_v4_0_ring_emit_reg_wait (struct amdgpu_ring *ring,uint32_t reg,uint32_t val,uint32_t mask) { -amdgpu_ring_write (ring,SDMA_PKT_HEADER_OP (SDMA_OP_POLL_REGMEM ) | -SDMA_PKT_POLL_REGMEM_HEADER_HDP_FLUSH (0 ) | -SDMA_PKT_POLL_REGMEM_HEADER_FUNC (3 ));/* equal */ -amdgpu_ring_write (ring, reg <<2 ); -amdgpu_ring_write (ring,0 ); -amdgpu_ring_write (ring, val);/* reference */ -amdgpu_ring_write (ring, mask);/* mask */ -amdgpu_ring_write (ring,SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT (0xfff ) | -SDMA_PKT_POLL_REGMEM_DW5_INTERVAL (10 )); +sdma_v4_0_wait_reg_mem (ring,0 ,0 , reg,0 , val, mask,10 ); }static int sdma_v4_0_early_init (void *handle)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/8 drm/amdgpu/sdma4: add emit_reg_write_reg_wait ring callback
In reply to a message not in the archiveThis adds support for writing and reading back in a single oneshot packet. This is needed to send a tlb invalidation and wait for ack in a single operation.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 -0
@@ -1171,6 +1171,13 @@ static void sdma_v4_0_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,sdma_v4_0_wait_reg_mem (ring,0 ,0 , reg,0 , val, mask,10 ); } +static void sdma_v4_0_ring_emit_reg_write_reg_wait (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +sdma_v4_0_wait_reg_mem (ring,0 ,1 , reg0, reg1, ref, mask,10 ); +} +static int sdma_v4_0_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1611,6 +1618,7 @@ static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = { .pad_ib = sdma_v4_0_ring_pad_ib, .emit_wreg = sdma_v4_0_ring_emit_wreg, .emit_reg_wait = sdma_v4_0_ring_emit_reg_wait, + .emit_reg_write_reg_wait = sdma_v4_0_ring_emit_reg_write_reg_wait, };static void sdma_v4_0_set_ring_funcs (struct amdgpu_device *adev)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/8 drm/amdgpu/uvd7: add emit_reg_write_reg_wait ring callback
In reply to a message not in the archiveThis adds support for writing and reading back using the helper since the engines doesn't have a oneshot packet.
--- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +1 -0
@@ -1702,6 +1702,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_enc_ring_vm_funcs = { .end_use = amdgpu_uvd_ring_end_use, .emit_wreg = uvd_v7_0_enc_ring_emit_wreg, .emit_reg_wait = uvd_v7_0_enc_ring_emit_reg_wait, + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, };static void uvd_v7_0_set_ring_funcs (struct amdgpu_device *adev)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/8 drm/amdgpu/vce4: add emit_reg_write_reg_wait ring callback
In reply to a message not in the archiveThis adds support for writing and reading back using the helper since the engines doesn't have a oneshot packet.
--- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -0
@@ -1081,6 +1081,7 @@ static const struct amdgpu_ring_funcs vce_v4_0_ring_vm_funcs = { .end_use = amdgpu_vce_ring_end_use, .emit_wreg = vce_v4_0_emit_wreg, .emit_reg_wait = vce_v4_0_emit_reg_wait, + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, };static void vce_v4_0_set_ring_funcs (struct amdgpu_device *adev)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/8 drm/amdgpu/vcn1: add emit_reg_write_reg_wait ring callback
In reply to a message not in the archiveThis adds support for writing and reading back using the helper since the engines doesn't have a oneshot packet.
--- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 -0
@@ -1139,6 +1139,7 @@ static const struct amdgpu_ring_funcs vcn_v1_0_enc_ring_vm_funcs = { .end_use = amdgpu_vcn_ring_end_use, .emit_wreg = vcn_v1_0_enc_ring_emit_wreg, .emit_reg_wait = vcn_v1_0_enc_ring_emit_reg_wait, + .emit_reg_write_reg_wait = amdgpu_ring_emit_reg_write_reg_wait_helper, };static void vcn_v1_0_set_dec_ring_funcs (struct amdgpu_device *adev)
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/8 drm/amdgpu/gmc9: use amdgpu_ring_emit_reg_write_reg_wait in gpu tlb flush
In reply to a message not in the archiveUse amdgpu_ring_emit_reg_write_reg_wait. On engines that support it, it provides a write and wait in a single packet which avoids a missed ack if a world switch happens between the request and waiting for the ack.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -5
@@ -385,11 +385,9 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,amdgpu_ring_emit_wreg (ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),upper_32_bits (pd_addr)); -amdgpu_ring_emit_wreg (ring, hub->vm_inv_eng0_req + eng, req); - -/* wait for the invalidate to complete */ -amdgpu_ring_emit_reg_wait (ring, hub->vm_inv_eng0_ack + eng, -1 << vmid,1 << vmid); +amdgpu_ring_emit_reg_write_reg_wait (ring, hub->vm_inv_eng0_req + eng, + hub->vm_inv_eng0_ack + eng, + req,1 << vmid);return pd_addr; }
Signature · 6 lines
2.13.6 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Huang Rui
Reviewed-byQuoted 8 lines · Alex Deucher
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.
Signed-off-by Alex Deucher <[email protected]>
For the whole series, patches are
Quoted 81 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 20 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 7 +++++++ 3 files changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1787,6 +1787,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_ring_emit_rreg (r, d) (r)->funcs->emit_rreg((r), (d))#define amdgpu_ring_emit_wreg (r, d, v) (r)->funcs->emit_wreg((r), (d), (v))#define amdgpu_ring_emit_reg_wait (r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) +#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))#define amdgpu_ring_emit_tmz (r, b) (r)->funcs->emit_tmz((r), (b))#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))drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +20
-0@@ -459,6 +459,26 @@ void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring)spin_unlock (&adev->ring_lru_list_lock); } +/** +* amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper +* +* @adev: amdgpu_device pointer +* @reg0: register to write +* @reg1: register to wait on +* @ref: reference value to write/wait on +* @mask: mask to wait on +* +* Helper for rings that don't support write and wait in a +* single oneshot packet. +*/ +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +amdgpu_ring_emit_wreg (ring, reg0, ref); +amdgpu_ring_emit_reg_wait (ring, reg1, mask, mask); +} +/* * Debugfs info */ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +7
-0@@ -154,6 +154,9 @@ struct amdgpu_ring_funcs {void (*emit_wreg)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val);void (*emit_reg_wait)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val,uint32_t mask); +void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask);void (*emit_tmz)(struct amdgpu_ring *ring,bool start);/* priority functions */ void (*set_priority) (struct amdgpu_ring *ring,@@ -228,6 +231,10 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, int *blacklist, int num_blacklist, bool lru_pipe_order, struct amdgpu_ring **ring);void amdgpu_ring_lru_touch (struct amdgpu_device *adev,struct amdgpu_ring *ring); +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t val0, +uint32_t reg1,uint32_t val1); +static inline void amdgpu_ring_clear_ring (struct amdgpu_ring *ring) {int i =0 ;Signature · 6 lines
2.13.6 _______________________________________________ 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
Am 28.03.2018 um 00:32 schrieb Alex Deucher:
Quoted 8 lines
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.
Signed-off-by Alex Deucher <[email protected]>
Series is Reviewed-by: Christian König <[email protected]>
Quoted 64 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 20 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 7 +++++++ 3 files changed, 28 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1787,6 +1787,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_ring_emit_rreg (r, d) (r)->funcs->emit_rreg((r), (d))#define amdgpu_ring_emit_wreg (r, d, v) (r)->funcs->emit_wreg((r), (d), (v))#define amdgpu_ring_emit_reg_wait (r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) +#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))#define amdgpu_ring_emit_tmz (r, b) (r)->funcs->emit_tmz((r), (b))#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))drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +20
-0@@ -459,6 +459,26 @@ void amdgpu_ring_lru_touch(struct amdgpu_device *adev, struct amdgpu_ring *ring)spin_unlock (&adev->ring_lru_list_lock); } +/** +* amdgpu_ring_emit_reg_write_reg_wait_helper - ring helper +* +* @adev: amdgpu_device pointer +* @reg0: register to write +* @reg1: register to wait on +* @ref: reference value to write/wait on +* @mask: mask to wait on +* +* Helper for rings that don't support write and wait in a +* single oneshot packet. +*/ +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +amdgpu_ring_emit_wreg (ring, reg0, ref); +amdgpu_ring_emit_reg_wait (ring, reg1, mask, mask); +} +/* * Debugfs info */ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +3
-0@@ -154,6 +154,9 @@ struct amdgpu_ring_funcs {void (*emit_wreg)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val);void (*emit_reg_wait)(struct amdgpu_ring *ring,uint32_t reg,uint32_t val,uint32_t mask); +void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask);void (*emit_tmz)(struct amdgpu_ring *ring,bool start);/* priority functions */ void (*set_priority) (struct amdgpu_ring *ring,
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, · line 240
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +4
-0@@ -228,6 +231,10 @@ int amdgpu_ring_lru_get(struct amdgpu_device *adev, int type, int *blacklist, int num_blacklist, bool lru_pipe_order, struct amdgpu_ring **ring);void amdgpu_ring_lru_touch (struct amdgpu_device *adev,struct amdgpu_ring *ring); +void amdgpu_ring_emit_reg_write_reg_wait_helper (struct amdgpu_ring *ring, +uint32_t reg0,uint32_t val0, +uint32_t reg1,uint32_t val1); +static inline void amdgpu_ring_clear_ring (struct amdgpu_ring *ring) {int i =0 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx