drm/amdgpu: define ring structure to access rptr/wptr/fence
Subsystems (2)
PATCH 1/4 drm/amdgpu: define ring structure to access rptr/wptr/fence
Define ring structure to access the cpu/gpu address of rptr/wptr/fence instead of dynamic calculation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +6 -0
@@ -208,6 +208,8 @@ struct amdgpu_ring {struct amdgpu_bo *ring_obj;volatile uint32_t *ring;unsigned rptr_offs; +u64 rptr_gpu_addr; +volatile u32 *rptr_cpu_addr;u64 wptr;u64 wptr_old;unsigned ring_size;
@@ -228,7 +230,11 @@ struct amdgpu_ring {bool use_doorbell;bool use_pollmem;unsigned wptr_offs; +u64 wptr_gpu_addr; +volatile u32 *wptr_cpu_addr;unsigned fence_offs; +u64 fence_gpu_addr; +volatile u32 *fence_cpu_addr;uint64_t current_ctx;char name[16 ];u32 trail_seq;
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amdgpu: initialize the cpu/gpu address of rptr/wptr/fence
Initialize the cpu/gpu address of rptr/wptr/fence.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 37 ++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +32 -5
@@ -150,6 +150,12 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring) ring->funcs->end_use (ring); } +#define amdgpu_ring_get_gpu_addr (ring, offset) \ + (ring->adev->wb.gpu_addr + offset * 4) + +#define amdgpu_ring_get_cpu_addr (ring, offset) \ + (&ring->adev->wb.wb[offset]) +/** * amdgpu_ring_init - init driver ring struct. *
@@ -217,17 +223,38 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, "(%d) ring trail_fence_offs wb alloc failed\n", r);return r; } - ring->trail_fence_gpu_addr = - adev->wb.gpu_addr + (ring->trail_fence_offs *4 ); - ring->trail_fence_cpu_addr = &adev->wb.wb[ring->trail_fence_offs]; r =amdgpu_device_wb_get (adev, &ring->cond_exe_offs);if (r) {dev_err (adev->dev,"(%d) ring cond_exec_polling wb alloc failed\n" , r);return r; } - ring->cond_exe_gpu_addr = adev->wb.gpu_addr + (ring->cond_exe_offs *4 ); - ring->cond_exe_cpu_addr = &adev->wb.wb[ring->cond_exe_offs]; + + ring->fence_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->fence_offs); + ring->fence_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->fence_offs); + + ring->rptr_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->rptr_offs); + ring->rptr_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->rptr_offs); + + ring->wptr_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->wptr_offs); + ring->wptr_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->wptr_offs); + + ring->trail_fence_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->trail_fence_offs); + ring->trail_fence_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->trail_fence_offs); + + ring->cond_exe_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->cond_exe_offs); + ring->cond_exe_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->cond_exe_offs); +/* always set cond_exec_polling to CONTINUE */ *ring->cond_exe_cpu_addr =1 ;
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerRe: [PATCH 2/4] drm/amdgpu: initialize the cpu/gpu address of rptr/wptr/fence
Am 28.07.20 um 12:21 schrieb Jack Xiao:
Quoted 12 lines
Initialize the cpu/gpu address of rptr/wptr/fence.
Signed-off-by Jack Xiao <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 37 ++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c void amdgpu_ring_undo(struct amdgpu_ring *ring) · line 157
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +5
-0@@ -150,6 +150,12 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring) ring->funcs->end_use (ring); } +#define amdgpu_ring_get_gpu_addr (ring, offset) \ + (ring->adev->wb.gpu_addr + offset * 4) + +#define amdgpu_ring_get_cpu_addr (ring, offset) \ + (&ring->adev->wb.wb[offset])
Those are not ring functions, but rather wb functions. Please clean that up.
Christian.
Quoted 38 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +20
-5+/** * amdgpu_ring_init - init driver ring struct. * @@ -217,17 +223,38 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, "(%d) ring trail_fence_offs wb alloc failed\n", r);return r; } - ring->trail_fence_gpu_addr = - adev->wb.gpu_addr + (ring->trail_fence_offs *4 ); - ring->trail_fence_cpu_addr = &adev->wb.wb[ring->trail_fence_offs]; r =amdgpu_device_wb_get (adev, &ring->cond_exe_offs);if (r) {dev_err (adev->dev,"(%d) ring cond_exec_polling wb alloc failed\n" , r);return r; } - ring->cond_exe_gpu_addr = adev->wb.gpu_addr + (ring->cond_exe_offs *4 ); - ring->cond_exe_cpu_addr = &adev->wb.wb[ring->cond_exe_offs]; + + ring->fence_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->fence_offs); + ring->fence_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->fence_offs); + + ring->rptr_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->rptr_offs); + ring->rptr_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->rptr_offs); + + ring->wptr_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->wptr_offs); + ring->wptr_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->wptr_offs); + + ring->trail_fence_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->trail_fence_offs); + ring->trail_fence_cpu_addr =
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, · line 260
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +7
-0+amdgpu_ring_get_cpu_addr (ring, ring->trail_fence_offs); + + ring->cond_exe_gpu_addr = +amdgpu_ring_get_gpu_addr (ring, ring->cond_exe_offs); + ring->cond_exe_cpu_addr = +amdgpu_ring_get_cpu_addr (ring, ring->cond_exe_offs); +/* always set cond_exec_polling to CONTINUE */ *ring->cond_exe_cpu_addr =1 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: use ring structure to access rptr/wptr v2
In reply to Jack XiaoUse ring structure to access the cpu/gpu address of rptr/wptr.
v2: merge gfx10/sdma5/sdma5.2 patches
--- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 37 +++++++++++++------------- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 12 ++++----- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 20 +++++++------- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 25 +++++++++-------- drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 4 +-- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 4 +-- drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 4 +-- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 11 ++++---- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 8 +++--- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 16 +++++------ drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 28 ++++++++----------- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 16 +++++------ drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 16 +++++------ drivers/gpu/drm/amd/amdgpu/si_dma.c | 4 +-- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 6 ++--- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 6 ++--- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 12 ++++----- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 12 ++++----- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 12 ++++----- 21 files changed, 126 insertions(+), 143 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +3 -5
@@ -164,7 +164,7 @@ static uint64_t cik_sdma_ring_get_rptr(struct amdgpu_ring *ring) {u32 rptr; - rptr = ring->adev->wb.wb[ring->rptr_offs]; + rptr = *ring->rptr_cpu_addr;return (rptr &0x3fffc ) >>2 ; }
@@ -432,12 +432,10 @@ static int cik_sdma_gfx_resume(struct amdgpu_device *adev)struct amdgpu_ring *ring;u32 rb_cntl, ib_cntl;u32 rb_bufsz; -u32 wb_offset;int i, j, r;for (i =0 ; i < adev->sdma.num_instances; i++) { ring = &adev->sdma.instance[i].ring; - wb_offset = (ring->rptr_offs *4 );mutex_lock (&adev->srbm_mutex);for (j =0 ; j <16 ; j++) {
@@ -473,9 +471,9 @@ static int cik_sdma_gfx_resume(struct amdgpu_device *adev)/* set the wb address whether it's enabled or not */ WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i], -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_LO + sdma_offsets[i], - ((adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC )); + ((ring->rptr_gpu_addr) &0xFFFFFFFC )); rb_cntl |=SDMA0_GFX_RB_CNTL__RPTR_WRITEBACK_ENABLE_MASK ;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +19 -18
@@ -3205,9 +3205,8 @@ static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queuestatic void gfx10_kiq_map_queues (struct amdgpu_ring *kiq_ring,struct amdgpu_ring *ring) { -struct amdgpu_device *adev = kiq_ring->adev;uint64_t mqd_addr =amdgpu_bo_gpu_offset (ring->mqd_obj); -uint64_t wptr_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); +uint64_t wptr_addr = ring->wptr_gpu_addr;uint32_t eng_sel = ring->funcs->type ==AMDGPU_RING_TYPE_GFX ?4 :0 ;amdgpu_ring_write (kiq_ring,PACKET3 (PACKET3_MAP_QUEUES ,5 ));
@@ -5835,12 +5834,12 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR_HI,upper_32_bits (ring->wptr));/* set the wb address wether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32_SOC15 (GC ,0 , mmCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &CP_RB_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK ); - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr)); WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
@@ -5873,11 +5872,11 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , mmCP_RB1_WPTR,lower_32_bits (ring->wptr));WREG32_SOC15 (GC ,0 , mmCP_RB1_WPTR_HI,upper_32_bits (ring->wptr));/* Set the wb address wether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB1_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32_SOC15 (GC ,0 , mmCP_RB1_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK ); - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr)); WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
@@ -6083,13 +6082,13 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_ring *ring) mqd->cp_gfx_hqd_base_hi =upper_32_bits (hqd_gpu_addr);/* set up hqd_rptr_addr/_hi, similar as CP_RB_RPTR */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_gfx_hqd_rptr_addr = wb_gpu_addr &0xfffffffc ; mqd->cp_gfx_hqd_rptr_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* set up rb_wptr_poll addr */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_rb_wptr_poll_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_rb_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
@@ -6198,7 +6197,7 @@ static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)memcpy (mqd, adev->gfx.me.mqd_backup[mqd_idx],sizeof (*mqd));/* reset the ring */ ring->wptr =0 ; - adev->wb.wb[ring->wptr_offs] =0 ; + *ring->wptr_cpu_addr =0 ;amdgpu_ring_clear_ring (ring);#ifdef BRING_UP_DEBUG mutex_lock (&adev->srbm_mutex);
@@ -6372,13 +6371,13 @@ static int gfx_v10_0_compute_mqd_init(struct amdgpu_ring *ring) mqd->cp_hqd_pq_control = tmp;/* set the wb address whether it's enabled or not */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_hqd_pq_rptr_report_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* only used if CP_PQ_WPTR_POLL_CNTL.CP_PQ_WPTR_POLL_CNTL__EN_MASK=1 */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
@@ -6594,7 +6593,7 @@ static int gfx_v10_0_kcq_init_queue(struct amdgpu_ring *ring)/* reset ring buffer */ ring->wptr =0 ; -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs],0 ); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr,0 );amdgpu_ring_clear_ring (ring); }else {amdgpu_ring_clear_ring (ring);
@@ -7601,7 +7600,8 @@ static void gfx_v10_0_get_clockgating_state(void *handle, u32 *flags)static u64 gfx_v10_0_ring_get_rptr_gfx (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs];/* gfx10 is 32bit rptr*/ +/* gfx10 is 32bit rptr*/ +return *(uint32_t *)ring->rptr_cpu_addr; }static u64 gfx_v10_0_ring_get_wptr_gfx (struct amdgpu_ring *ring)
@@ -7611,7 +7611,7 @@ static u64 gfx_v10_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) { - wptr =atomic64_read ((atomic64_t *)&adev->wb.wb[ring->wptr_offs]); + wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); }else { wptr =RREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR); wptr += (u64 )RREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR_HI) <<32 ;
@@ -7626,7 +7626,7 @@ static void gfx_v10_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], ring->wptr); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else {WREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR,lower_32_bits (ring->wptr));
@@ -7636,7 +7636,8 @@ static void gfx_v10_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)static u64 gfx_v10_0_ring_get_rptr_compute (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs];/* gfx10 hardware is 32bit rptr */ +/* gfx10 hardware is 32bit rptr */ +return *(uint32_t *)ring->rptr_cpu_addr; }static u64 gfx_v10_0_ring_get_wptr_compute (struct amdgpu_ring *ring)
@@ -7645,7 +7646,7 @@ static u64 gfx_v10_0_ring_get_wptr_compute(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) - wptr =atomic64_read ((atomic64_t *)&ring->adev->wb.wb[ring->wptr_offs]); + wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr);else BUG ();return wptr;
@@ -7657,7 +7658,7 @@ static void gfx_v10_0_ring_set_wptr_compute(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) { -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], ring->wptr); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else {BUG ();/* only DOORBELL method supported on gfx10 now */
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +4 -4
@@ -2116,7 +2116,7 @@ static int gfx_v6_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32 (mmCP_RB0_WPTR, ring->wptr);/* set the wb address whether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (mmCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32 (mmCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &0xFF );
@@ -2138,7 +2138,7 @@ static int gfx_v6_0_cp_gfx_resume(struct amdgpu_device *adev)static u64 gfx_v6_0_ring_get_rptr (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs]; +return *ring->rptr_cpu_addr; }static u64 gfx_v6_0_ring_get_wptr (struct amdgpu_ring *ring)
@@ -2202,7 +2202,7 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev) ring->wptr =0 ;WREG32 (mmCP_RB1_WPTR, ring->wptr); - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (mmCP_RB1_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32 (mmCP_RB1_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &0xFF );
@@ -2221,7 +2221,7 @@ static int gfx_v6_0_cp_compute_resume(struct amdgpu_device *adev)WREG32 (mmCP_RB2_CNTL, tmp |CP_RB2_CNTL__RB_RPTR_WR_ENA_MASK ); ring->wptr =0 ;WREG32 (mmCP_RB2_WPTR, ring->wptr); - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (mmCP_RB2_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32 (mmCP_RB2_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &0xFF );
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +6 -6
@@ -2628,7 +2628,7 @@ static int gfx_v7_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32 (mmCP_RB0_WPTR,lower_32_bits (ring->wptr));/* set the wb address wether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (mmCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32 (mmCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &0xFF );
@@ -2653,7 +2653,7 @@ static int gfx_v7_0_cp_gfx_resume(struct amdgpu_device *adev)static u64 gfx_v7_0_ring_get_rptr (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs]; +return *ring->rptr_cpu_addr; }static u64 gfx_v7_0_ring_get_wptr_gfx (struct amdgpu_ring *ring)
@@ -2674,7 +2674,7 @@ static void gfx_v7_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)static u64 gfx_v7_0_ring_get_wptr_compute (struct amdgpu_ring *ring) {/* XXX check if swapping is necessary on BE */ -return ring->adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr; }static void gfx_v7_0_ring_set_wptr_compute (struct amdgpu_ring *ring)
@@ -2682,7 +2682,7 @@ static void gfx_v7_0_ring_set_wptr_compute(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }
@@ -2978,12 +2978,12 @@ static void gfx_v7_0_mqd_init(struct amdgpu_device *adev,CP_HQD_PQ_CONTROL__KMD_QUEUE_MASK ;/* assuming kernel queue control */ /* only used if CP_PQ_WPTR_POLL_CNTL.CP_PQ_WPTR_POLL_CNTL__EN_MASK=1 */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* set the wb address wether it's enabled or not */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_hqd_pq_rptr_report_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +10 -10
@@ -4296,11 +4296,11 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32 (mmCP_RB0_WPTR,lower_32_bits (ring->wptr));/* set the wb address wether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (mmCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32 (mmCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &0xFF ); - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32 (mmCP_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr));WREG32 (mmCP_RB_WPTR_POLL_ADDR_HI,upper_32_bits (wptr_gpu_addr));mdelay (1 );
@@ -4383,7 +4383,7 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev)for (i =0 ; i < adev->gfx.num_compute_rings; i++) {struct amdgpu_ring *ring = &adev->gfx.compute_ring[i];uint64_t mqd_addr =amdgpu_bo_gpu_offset (ring->mqd_obj); -uint64_t wptr_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); +uint64_t wptr_addr = ring->wptr_gpu_addr;/* map queues */ amdgpu_ring_write (kiq_ring,PACKET3 (PACKET3_MAP_QUEUES ,5 ));
@@ -4507,13 +4507,13 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring) mqd->cp_hqd_pq_control = tmp;/* set the wb address whether it's enabled or not */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_hqd_pq_rptr_report_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* only used if CP_PQ_WPTR_POLL_CNTL.CP_PQ_WPTR_POLL_CNTL__EN_MASK=1 */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
@@ -6043,7 +6043,7 @@ static int gfx_v8_0_set_clockgating_state(void *handle,static u64 gfx_v8_0_ring_get_rptr (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs]; +return *ring->rptr_cpu_addr; }static u64 gfx_v8_0_ring_get_wptr_gfx (struct amdgpu_ring *ring)
@@ -6052,7 +6052,7 @@ static u64 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)if (ring->use_doorbell)/* XXX check if swapping is necessary on BE */ -return ring->adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32 (mmCP_RB0_WPTR); }
@@ -6063,7 +6063,7 @@ static void gfx_v8_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32 (mmCP_RB0_WPTR,lower_32_bits (ring->wptr));
@@ -6263,7 +6263,7 @@ static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,static u64 gfx_v8_0_ring_get_wptr_compute (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr; }static void gfx_v8_0_ring_set_wptr_compute (struct amdgpu_ring *ring)
@@ -6271,7 +6271,7 @@ static void gfx_v8_0_ring_set_wptr_compute(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +12 -13
@@ -817,9 +817,8 @@ static void gfx_v9_0_kiq_set_resources(struct amdgpu_ring *kiq_ring,static void gfx_v9_0_kiq_map_queues (struct amdgpu_ring *kiq_ring,struct amdgpu_ring *ring) { -struct amdgpu_device *adev = kiq_ring->adev;uint64_t mqd_addr =amdgpu_bo_gpu_offset (ring->mqd_obj); -uint64_t wptr_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); +uint64_t wptr_addr = ring->wptr_gpu_addr;uint32_t eng_sel = ring->funcs->type ==AMDGPU_RING_TYPE_GFX ?4 :0 ;amdgpu_ring_write (kiq_ring,PACKET3 (PACKET3_MAP_QUEUES ,5 ));
@@ -3260,11 +3259,11 @@ static int gfx_v9_0_cp_gfx_resume(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR_HI,upper_32_bits (ring->wptr));/* set the wb address wether it's enabled or not */ - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr));WREG32_SOC15 (GC ,0 , mmCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) &CP_RB_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK ); - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr));WREG32_SOC15 (GC ,0 , mmCP_RB_WPTR_POLL_ADDR_HI,upper_32_bits (wptr_gpu_addr));
@@ -3476,13 +3475,13 @@ static int gfx_v9_0_mqd_init(struct amdgpu_ring *ring) mqd->cp_hqd_pq_control = tmp;/* set the wb address whether it's enabled or not */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_hqd_pq_rptr_report_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* only used if CP_PQ_WPTR_POLL_CNTL.CP_PQ_WPTR_POLL_CNTL__EN_MASK=1 */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
@@ -3741,7 +3740,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)/* reset ring buffer */ ring->wptr =0 ; -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs],0 ); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr,0 );amdgpu_ring_clear_ring (ring); }else {amdgpu_ring_clear_ring (ring);
@@ -5144,7 +5143,7 @@ static void gfx_v9_0_get_clockgating_state(void *handle, u32 *flags)static u64 gfx_v9_0_ring_get_rptr_gfx (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs];/* gfx9 is 32bit rptr*/ +return *ring->rptr_cpu_addr;/* gfx9 is 32bit rptr*/ }static u64 gfx_v9_0_ring_get_wptr_gfx (struct amdgpu_ring *ring)
@@ -5154,7 +5153,7 @@ static u64 gfx_v9_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) { - wptr =atomic64_read ((atomic64_t *)&adev->wb.wb[ring->wptr_offs]); + wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); }else { wptr =RREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR); wptr += (u64 )RREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR_HI) <<32 ;
@@ -5169,7 +5168,7 @@ static void gfx_v9_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], ring->wptr); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else {WREG32_SOC15 (GC ,0 , mmCP_RB0_WPTR,lower_32_bits (ring->wptr));
@@ -5334,7 +5333,7 @@ static void gfx_v9_0_ring_emit_vm_flush(struct amdgpu_ring *ring,static u64 gfx_v9_0_ring_get_rptr_compute (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs];/* gfx9 hardware is 32bit rptr */ +return *ring->rptr_cpu_addr;/* gfx9 hardware is 32bit rptr */ }static u64 gfx_v9_0_ring_get_wptr_compute (struct amdgpu_ring *ring)
@@ -5343,7 +5342,7 @@ static u64 gfx_v9_0_ring_get_wptr_compute(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) - wptr =atomic64_read ((atomic64_t *)&ring->adev->wb.wb[ring->wptr_offs]); + wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr);else BUG ();return wptr;
@@ -5355,7 +5354,7 @@ static void gfx_v9_0_ring_set_wptr_compute(struct amdgpu_ring *ring)/* XXX check if swapping is necessary on BE */ if (ring->use_doorbell) { -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], ring->wptr); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else {BUG ();/* only DOORBELL method supported on gfx9 now */
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c +2 -2
@@ -425,7 +425,7 @@ static uint64_t jpeg_v2_0_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (JPEG ,0 , mmUVD_JRBC_RB_WPTR); }
@@ -442,7 +442,7 @@ static void jpeg_v2_0_dec_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (JPEG ,0 , mmUVD_JRBC_RB_WPTR,lower_32_bits (ring->wptr));
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +2 -2
@@ -401,7 +401,7 @@ static uint64_t jpeg_v2_5_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (JPEG , ring->me, mmUVD_JRBC_RB_WPTR); }
@@ -418,7 +418,7 @@ static void jpeg_v2_5_dec_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (JPEG , ring->me, mmUVD_JRBC_RB_WPTR,lower_32_bits (ring->wptr));
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +2 -2
@@ -421,7 +421,7 @@ static uint64_t jpeg_v3_0_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (JPEG ,0 , mmUVD_JRBC_RB_WPTR); }
@@ -438,7 +438,7 @@ static void jpeg_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (JPEG ,0 , mmUVD_JRBC_RB_WPTR,lower_32_bits (ring->wptr));
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +5 -6
@@ -46,7 +46,7 @@ static void mes_v10_1_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { -atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else {
@@ -56,7 +56,7 @@ static void mes_v10_1_ring_set_wptr(struct amdgpu_ring *ring)static u64 mes_v10_1_ring_get_rptr (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs]; +return *ring->rptr_cpu_addr; }static u64 mes_v10_1_ring_get_wptr (struct amdgpu_ring *ring)
@@ -64,8 +64,7 @@ static u64 mes_v10_1_ring_get_wptr(struct amdgpu_ring *ring)u64 wptr;if (ring->use_doorbell) - wptr =atomic64_read ((atomic64_t *) - &ring->adev->wb.wb[ring->wptr_offs]); + wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr);else BUG ();return wptr;
@@ -673,13 +672,13 @@ static int mes_v10_1_mqd_init(struct amdgpu_ring *ring) mqd->cp_hqd_pq_control = tmp;/* set the wb address whether it's enabled or not */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + wb_gpu_addr = ring->rptr_gpu_addr; mqd->cp_hqd_pq_rptr_report_addr_lo = wb_gpu_addr &0xfffffffc ; mqd->cp_hqd_pq_rptr_report_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;/* only used if CP_PQ_WPTR_POLL_CNTL.CP_PQ_WPTR_POLL_CNTL__EN_MASK=1 */ - wb_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wb_gpu_addr = ring->wptr_gpu_addr; mqd->cp_hqd_pq_wptr_poll_addr_lo = wb_gpu_addr &0xfffffff8 ; mqd->cp_hqd_pq_wptr_poll_addr_hi =upper_32_bits (wb_gpu_addr) &0xffff ;
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +3 -5
@@ -194,7 +194,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev)static uint64_t sdma_v2_4_ring_get_rptr (struct amdgpu_ring *ring) {/* XXX check if swapping is necessary on BE */ -return ring->adev->wb.wb[ring->rptr_offs] >>2 ; +return *ring->rptr_cpu_addr >>2 ; }/**
@@ -410,12 +410,10 @@ static int sdma_v2_4_gfx_resume(struct amdgpu_device *adev)struct amdgpu_ring *ring;u32 rb_cntl, ib_cntl;u32 rb_bufsz; -u32 wb_offset;int i, j, r;for (i =0 ; i < adev->sdma.num_instances; i++) { ring = &adev->sdma.instance[i].ring; - wb_offset = (ring->rptr_offs *4 );mutex_lock (&adev->srbm_mutex);for (j =0 ; j <16 ; j++) {
@@ -451,9 +449,9 @@ static int sdma_v2_4_gfx_resume(struct amdgpu_device *adev)/* set the wb address whether it's enabled or not */ WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i], -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_LO + sdma_offsets[i], -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +7 -9
@@ -350,7 +350,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)static uint64_t sdma_v3_0_ring_get_rptr (struct amdgpu_ring *ring) {/* XXX check if swapping is necessary on BE */ -return ring->adev->wb.wb[ring->rptr_offs] >>2 ; +return *ring->rptr_cpu_addr >>2 ; }/**
@@ -367,7 +367,7 @@ static uint64_t sdma_v3_0_ring_get_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell || ring->use_pollmem) {/* XXX check if swapping is necessary on BE */ - wptr = ring->adev->wb.wb[ring->wptr_offs] >>2 ; + wptr = *ring->wptr_cpu_addr >>2 ; }else { wptr =RREG32 (mmSDMA0_GFX_RB_WPTR + sdma_offsets[ring->me]) >>2 ; }
@@ -387,12 +387,12 @@ static void sdma_v3_0_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { -u32 *wb = (u32 *)&adev->wb.wb[ring->wptr_offs]; +u32 *wb = (u32 *)ring->wptr_cpu_addr;/* XXX check if swapping is necessary on BE */ WRITE_ONCE (*wb, (lower_32_bits (ring->wptr) <<2 ));WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr) <<2 ); }else if (ring->use_pollmem) { -u32 *wb = (u32 *)&adev->wb.wb[ring->wptr_offs]; +u32 *wb = (u32 *)ring->wptr_cpu_addr;WRITE_ONCE (*wb, (lower_32_bits (ring->wptr) <<2 )); }else {
@@ -645,7 +645,6 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)struct amdgpu_ring *ring;u32 rb_cntl, ib_cntl, wptr_poll_cntl;u32 rb_bufsz; -u32 wb_offset;u32 doorbell;u64 wptr_gpu_addr;int i, j, r;
@@ -653,7 +652,6 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)for (i =0 ; i < adev->sdma.num_instances; i++) { ring = &adev->sdma.instance[i].ring;amdgpu_ring_clear_ring (ring); - wb_offset = (ring->rptr_offs *4 );mutex_lock (&adev->srbm_mutex);for (j =0 ; j <16 ; j++) {
@@ -690,9 +688,9 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)/* set the wb address whether it's enabled or not */ WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i], -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32 (mmSDMA0_GFX_RB_RPTR_ADDR_LO + sdma_offsets[i], -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
@@ -711,7 +709,7 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev)WREG32 (mmSDMA0_GFX_DOORBELL + sdma_offsets[i], doorbell);/* setup the wptr shadow polling */ - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32 (mmSDMA0_GFX_RB_WPTR_POLL_ADDR_LO + sdma_offsets[i],lower_32_bits (wptr_gpu_addr));
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +11 -17
@@ -687,7 +687,7 @@ static uint64_t sdma_v4_0_ring_get_rptr(struct amdgpu_ring *ring)u64 *rptr;/* XXX check if swapping is necessary on BE */ - rptr = ((u64 *)&ring->adev->wb.wb[ring->rptr_offs]); + rptr = ((u64 *)ring->rptr_cpu_addr);DRM_DEBUG ("rptr before shift == 0x%016llx\n" , *rptr);return ((*rptr) >>2 );
@@ -707,7 +707,7 @@ static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - wptr =READ_ONCE (*((u64 *)&adev->wb.wb[ring->wptr_offs])); + wptr =READ_ONCE (*((u64 *)ring->wptr_cpu_addr));DRM_DEBUG ("wptr/doorbell before shift == 0x%016llx\n" , wptr); }else { wptr =RREG32_SDMA (ring->me, mmSDMA0_GFX_RB_WPTR_HI);
@@ -733,7 +733,7 @@ static void sdma_v4_0_ring_set_wptr(struct amdgpu_ring *ring)DRM_DEBUG ("Setting write pointer\n" );if (ring->use_doorbell) { -u64 *wb = (u64 *)&adev->wb.wb[ring->wptr_offs]; +u64 *wb = (u64 *)ring->wptr_cpu_addr;DRM_DEBUG ("Using doorbell -- " "wptr_offs == 0x%08x "
@@ -776,7 +776,7 @@ static uint64_t sdma_v4_0_page_ring_get_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - wptr =READ_ONCE (*((u64 *)&adev->wb.wb[ring->wptr_offs])); + wptr =READ_ONCE (*((u64 *)ring->wptr_cpu_addr)); }else { wptr =RREG32_SDMA (ring->me, mmSDMA0_PAGE_RB_WPTR_HI); wptr = wptr <<32 ;
@@ -798,7 +798,7 @@ static void sdma_v4_0_page_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { -u64 *wb = (u64 *)&adev->wb.wb[ring->wptr_offs]; +u64 *wb = (u64 *)ring->wptr_cpu_addr;/* XXX check if swapping is necessary on BE */ WRITE_ONCE (*wb, (ring->wptr <<2 ));
@@ -1124,13 +1124,10 @@ static void sdma_v4_0_gfx_resume(struct amdgpu_device *adev, unsigned int i) {struct amdgpu_ring *ring = &adev->sdma.instance[i].ring;u32 rb_cntl, ib_cntl, wptr_poll_cntl; -u32 wb_offset;u32 doorbell;u32 doorbell_offset;u64 wptr_gpu_addr; - wb_offset = (ring->rptr_offs *4 ); - rb_cntl =RREG32_SDMA (i, mmSDMA0_GFX_RB_CNTL); rb_cntl =sdma_v4_0_rb_cntl (ring, rb_cntl);WREG32_SDMA (i, mmSDMA0_GFX_RB_CNTL, rb_cntl);
@@ -1143,9 +1140,9 @@ static void sdma_v4_0_gfx_resume(struct amdgpu_device *adev, unsigned int i)/* set the wb address whether it's enabled or not */ WREG32_SDMA (i, mmSDMA0_GFX_RB_RPTR_ADDR_HI, -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32_SDMA (i, mmSDMA0_GFX_RB_RPTR_ADDR_LO, -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
@@ -1175,7 +1172,7 @@ static void sdma_v4_0_gfx_resume(struct amdgpu_device *adev, unsigned int i)WREG32_SDMA (i, mmSDMA0_GFX_MINOR_PTR_UPDATE,0 );/* setup the wptr shadow polling */ - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32_SDMA (i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr)); WREG32_SDMA(i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI,
@@ -1214,13 +1211,10 @@ static void sdma_v4_0_page_resume(struct amdgpu_device *adev, unsigned int i) {struct amdgpu_ring *ring = &adev->sdma.instance[i].page;u32 rb_cntl, ib_cntl, wptr_poll_cntl; -u32 wb_offset;u32 doorbell;u32 doorbell_offset;u64 wptr_gpu_addr; - wb_offset = (ring->rptr_offs *4 ); - rb_cntl =RREG32_SDMA (i, mmSDMA0_PAGE_RB_CNTL); rb_cntl =sdma_v4_0_rb_cntl (ring, rb_cntl);WREG32_SDMA (i, mmSDMA0_PAGE_RB_CNTL, rb_cntl);
@@ -1233,9 +1227,9 @@ static void sdma_v4_0_page_resume(struct amdgpu_device *adev, unsigned int i)/* set the wb address whether it's enabled or not */ WREG32_SDMA (i, mmSDMA0_PAGE_RB_RPTR_ADDR_HI, -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32_SDMA (i, mmSDMA0_PAGE_RB_RPTR_ADDR_LO, -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_PAGE_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
@@ -1266,7 +1260,7 @@ static void sdma_v4_0_page_resume(struct amdgpu_device *adev, unsigned int i)WREG32_SDMA (i, mmSDMA0_PAGE_MINOR_PTR_UPDATE,0 );/* setup the wptr shadow polling */ - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32_SDMA (i, mmSDMA0_PAGE_RB_WPTR_POLL_ADDR_LO,lower_32_bits (wptr_gpu_addr)); WREG32_SDMA(i, mmSDMA0_PAGE_RB_WPTR_POLL_ADDR_HI,
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +7 -9
@@ -299,7 +299,7 @@ static uint64_t sdma_v5_0_ring_get_rptr(struct amdgpu_ring *ring)u64 *rptr;/* XXX check if swapping is necessary on BE */ - rptr = ((u64 *)&ring->adev->wb.wb[ring->rptr_offs]); + rptr = (u64 *)ring->rptr_cpu_addr;DRM_DEBUG ("rptr before shift == 0x%016llx\n" , *rptr);return ((*rptr) >>2 );
@@ -319,7 +319,7 @@ static uint64_t sdma_v5_0_ring_get_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - wptr =READ_ONCE (*((u64 *)&adev->wb.wb[ring->wptr_offs])); + wptr =READ_ONCE (*((u64 *)ring->wptr_cpu_addr));DRM_DEBUG ("wptr/doorbell before shift == 0x%016llx\n" , wptr); }else { wptr =RREG32 (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI));
@@ -352,8 +352,8 @@ static void sdma_v5_0_ring_set_wptr(struct amdgpu_ring *ring)lower_32_bits (ring->wptr <<2 ), upper_32_bits(ring->wptr << 2));/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr <<2 ); - adev->wb.wb[ring->wptr_offs +1 ] =upper_32_bits (ring->wptr <<2 ); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, + ring->wptr <<2 );DRM_DEBUG ("calling WDOORBELL64(0x%08x, 0x%016llx)\n" , ring->doorbell_index, ring->wptr <<2 );WDOORBELL64 (ring->doorbell_index, ring->wptr <<2 );
@@ -644,7 +644,6 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)struct amdgpu_ring *ring;u32 rb_cntl, ib_cntl;u32 rb_bufsz; -u32 wb_offset;u32 doorbell;u32 doorbell_offset;u32 temp;
@@ -654,7 +653,6 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)for (i =0 ; i < adev->sdma.num_instances; i++) { ring = &adev->sdma.instance[i].ring; - wb_offset = (ring->rptr_offs *4 );if (!amdgpu_sriov_vf (adev))WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_SEM_WAIT_FAIL_TIMER_CNTL),0 );
@@ -677,7 +675,7 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_WPTR_HI),0 );/* setup the wptr shadow polling */ - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_LO),lower_32_bits (wptr_gpu_addr)); WREG32(sdma_v5_0_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI),
@@ -692,9 +690,9 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)/* set the wb address whether it's enabled or not */ WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_RPTR_ADDR_HI), -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_RPTR_ADDR_LO), -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +7 -9
@@ -252,7 +252,7 @@ static uint64_t sdma_v5_2_ring_get_rptr(struct amdgpu_ring *ring)u64 *rptr;/* XXX check if swapping is necessary on BE */ - rptr = ((u64 *)&ring->adev->wb.wb[ring->rptr_offs]); + rptr = (u64 *)ring->rptr_cpu_addr;DRM_DEBUG ("rptr before shift == 0x%016llx\n" , *rptr);return ((*rptr) >>2 );
@@ -272,7 +272,7 @@ static uint64_t sdma_v5_2_ring_get_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - wptr =READ_ONCE (*((u64 *)&adev->wb.wb[ring->wptr_offs])); + wptr =READ_ONCE (*((u64 *)ring->wptr_cpu_addr));DRM_DEBUG ("wptr/doorbell before shift == 0x%016llx\n" , wptr); }else { wptr =RREG32 (sdma_v5_2_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_WPTR_HI));
@@ -305,8 +305,8 @@ static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)lower_32_bits (ring->wptr <<2 ), upper_32_bits(ring->wptr << 2));/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr <<2 ); - adev->wb.wb[ring->wptr_offs +1 ] =upper_32_bits (ring->wptr <<2 ); +atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, + ring->wptr <<2 );DRM_DEBUG ("calling WDOORBELL64(0x%08x, 0x%016llx)\n" , ring->doorbell_index, ring->wptr <<2 );WDOORBELL64 (ring->doorbell_index, ring->wptr <<2 );
@@ -584,7 +584,6 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)struct amdgpu_ring *ring;u32 rb_cntl, ib_cntl;u32 rb_bufsz; -u32 wb_offset;u32 doorbell;u32 doorbell_offset;u32 temp;
@@ -594,7 +593,6 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)for (i =0 ; i < adev->sdma.num_instances; i++) { ring = &adev->sdma.instance[i].ring; - wb_offset = (ring->rptr_offs *4 );WREG32 (sdma_v5_2_get_reg_offset (adev, i, mmSDMA0_SEM_WAIT_FAIL_TIMER_CNTL),0 );
@@ -616,7 +614,7 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)WREG32 (sdma_v5_2_get_reg_offset (adev, i, mmSDMA0_GFX_RB_WPTR_HI),0 );/* setup the wptr shadow polling */ - wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs *4 ); + wptr_gpu_addr = ring->wptr_gpu_addr;WREG32 (sdma_v5_2_get_reg_offset (adev, i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_LO),lower_32_bits (wptr_gpu_addr)); WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_RB_WPTR_POLL_ADDR_HI),
@@ -631,9 +629,9 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)/* set the wb address whether it's enabled or not */ WREG32 (sdma_v5_2_get_reg_offset (adev, i, mmSDMA0_GFX_RB_RPTR_ADDR_HI), -upper_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFF ); +upper_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFF );WREG32 (sdma_v5_2_get_reg_offset (adev, i, mmSDMA0_GFX_RB_RPTR_ADDR_LO), -lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); +lower_32_bits (ring->rptr_gpu_addr) &0xFFFFFFFC ); rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 );
drivers/gpu/drm/amd/amdgpu/si_dma.c +2 -2
@@ -40,7 +40,7 @@ static void si_dma_set_irq_funcs(struct amdgpu_device *adev);static uint64_t si_dma_ring_get_rptr (struct amdgpu_ring *ring) { -return ring->adev->wb.wb[ring->rptr_offs>>2 ]; +return *ring->rptr_cpu_addr; }static uint64_t si_dma_ring_get_wptr (struct amdgpu_ring *ring)
@@ -152,7 +152,7 @@ static int si_dma_start(struct amdgpu_device *adev)WREG32 (DMA_RB_RPTR + sdma_offsets[i],0 );WREG32 (DMA_RB_WPTR + sdma_offsets[i],0 ); - rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs *4 ); + rptr_addr = ring->rptr_gpu_addr;WREG32 (DMA_RB_RPTR_ADDR_LO + sdma_offsets[i],lower_32_bits (rptr_addr));WREG32 (DMA_RB_RPTR_ADDR_HI + sdma_offsets[i],upper_32_bits (rptr_addr) &0xFF );
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +3 -3
@@ -118,7 +118,7 @@ static uint64_t uvd_v7_0_enc_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;if (ring == &adev->uvd.inst[ring->me].ring_enc[0 ])return RREG32_SOC15 (UVD , ring->me, mmUVD_RB_WPTR);
@@ -153,7 +153,7 @@ static void uvd_v7_0_enc_ring_set_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr));return ; }
@@ -735,7 +735,7 @@ static int uvd_v7_0_mmsch_start(struct amdgpu_device *adev,if (adev->uvd.harvest_config & (1 << i))continue ;WDOORBELL32 (adev->uvd.inst[i].ring_enc[0 ].doorbell_index,0 ); - adev->wb.wb[adev->uvd.inst[i].ring_enc[0 ].wptr_offs] =0 ; + *adev->uvd.inst[i].ring_enc[0 ].wptr_cpu_addr =0 ; adev->uvd.inst[i].ring_enc[0 ].wptr =0 ; adev->uvd.inst[i].ring_enc[0 ].wptr_old =0 ; }
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +3 -3
@@ -82,7 +82,7 @@ static uint64_t vce_v4_0_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;if (ring->me ==0 )return RREG32 (SOC15_REG_OFFSET (VCE ,0 , mmVCE_RB_WPTR));
@@ -105,7 +105,7 @@ static void vce_v4_0_ring_set_wptr(struct amdgpu_ring *ring)if (ring->use_doorbell) {/* XXX check if swapping is necessary on BE */ - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr));return ; }
@@ -176,7 +176,7 @@ static int vce_v4_0_mmsch_start(struct amdgpu_device *adev,WREG32 (SOC15_REG_OFFSET (VCE ,0 , mmVCE_MMSCH_VF_MAILBOX_RESP),0 );WDOORBELL32 (adev->vce.ring[0 ].doorbell_index,0 ); - adev->wb.wb[adev->vce.ring[0 ].wptr_offs] =0 ; + *adev->vce.ring[0 ].wptr_cpu_addr =0 ; adev->vce.ring[0 ].wptr =0 ; adev->vce.ring[0 ].wptr_old =0 ;
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +6 -6
@@ -1333,7 +1333,7 @@ static uint64_t vcn_v2_0_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR); }
@@ -1354,7 +1354,7 @@ static void vcn_v2_0_dec_ring_set_wptr(struct amdgpu_ring *ring) lower_32_bits(ring->wptr) | 0x80000000);if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (UVD ,0 , mmUVD_RBC_RB_WPTR,lower_32_bits (ring->wptr));
@@ -1557,12 +1557,12 @@ static uint64_t vcn_v2_0_enc_ring_get_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst->ring_enc[0 ]) {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR); }else {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR2); }
@@ -1581,14 +1581,14 @@ static void vcn_v2_0_enc_ring_set_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst->ring_enc[0 ]) {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR,lower_32_bits (ring->wptr)); } }else {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (UVD ,0 , mmUVD_RB_WPTR2,lower_32_bits (ring->wptr));
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +6 -6
@@ -1491,7 +1491,7 @@ static uint64_t vcn_v2_5_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RBC_RB_WPTR); }
@@ -1508,7 +1508,7 @@ static void vcn_v2_5_dec_ring_set_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RBC_RB_WPTR,lower_32_bits (ring->wptr));
@@ -1575,12 +1575,12 @@ static uint64_t vcn_v2_5_enc_ring_get_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst[ring->me].ring_enc[0 ]) {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR); }else {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR2); }
@@ -1599,14 +1599,14 @@ static void vcn_v2_5_enc_ring_set_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst[ring->me].ring_enc[0 ]) {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR,lower_32_bits (ring->wptr)); } }else {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR2,lower_32_bits (ring->wptr));
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +6 -6
@@ -1614,7 +1614,7 @@ static uint64_t vcn_v3_0_dec_ring_get_wptr(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RBC_RB_WPTR); }
@@ -1635,7 +1635,7 @@ static void vcn_v3_0_dec_ring_set_wptr(struct amdgpu_ring *ring) lower_32_bits(ring->wptr) | 0x80000000);if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RBC_RB_WPTR,lower_32_bits (ring->wptr));
@@ -1702,12 +1702,12 @@ static uint64_t vcn_v3_0_enc_ring_get_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst[ring->me].ring_enc[0 ]) {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR); }else {if (ring->use_doorbell) -return adev->wb.wb[ring->wptr_offs]; +return *ring->wptr_cpu_addr;else return RREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR2); }
@@ -1726,14 +1726,14 @@ static void vcn_v3_0_enc_ring_set_wptr(struct amdgpu_ring *ring)if (ring == &adev->vcn.inst[ring->me].ring_enc[0 ]) {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR,lower_32_bits (ring->wptr)); } }else {if (ring->use_doorbell) { - adev->wb.wb[ring->wptr_offs] =lower_32_bits (ring->wptr); + *ring->wptr_cpu_addr =lower_32_bits (ring->wptr);WDOORBELL32 (ring->doorbell_index,lower_32_bits (ring->wptr)); }else {WREG32_SOC15 (VCN , ring->me, mmUVD_RB_WPTR2,lower_32_bits (ring->wptr));
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: assign the cpu/gpu address of fence from ring
In reply to Jack Xiaoassign the cpu/gpu address of fence for the normal or mes ring from ring structure.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -2
@@ -407,8 +407,8 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,uint64_t index;if (ring->funcs->type !=AMDGPU_RING_TYPE_UVD ) { - ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs]; - ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs *4 ); + ring->fence_drv.cpu_addr = ring->fence_cpu_addr; + ring->fence_drv.gpu_addr = ring->fence_gpu_addr; }else {/* put fence directly behind firmware */ index =ALIGN (adev->uvd.fw->size,8 );
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/4] drm/amdgpu: assign the cpu/gpu address of fence from ring
[AMD Public Use]
Series is Reviewed-by: Le Ma <[email protected]>
Regards,
Ma Le
-----Original Message-----
From: Xiao, Jack <[email protected]>
Sent: Tuesday, July 28, 2020 6:22 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>; Ma, Le <[email protected]>
Cc: Xiao, Jack <[email protected]>; Koenig, Christian <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: assign the cpu/gpu address of fence from ring
assign the cpu/gpu address of fence for the normal or mes ring from ring structure.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -2
@@ -407,8 +407,8 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,uint64_t index;if (ring->funcs->type !=AMDGPU_RING_TYPE_UVD ) { - ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs]; - ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs *4 ); + ring->fence_drv.cpu_addr = ring->fence_cpu_addr; + ring->fence_drv.gpu_addr = ring->fence_gpu_addr; }else {/* put fence directly behind firmware */ index =ALIGN (adev->uvd.fw->size,8 );
--
2.26.2
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerRe: [PATCH 4/4] drm/amdgpu: assign the cpu/gpu address of fence from ring
In reply to Jack XiaoAm 28.07.20 um 12:21 schrieb Jack Xiao:
Quoted 15 lines
assign the cpu/gpu address of fence for the normal or mes ring from ring structure.
Signed-off-by Jack Xiao <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Acked-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, · line 411
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2
-2@@ -407,8 +407,8 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,uint64_t index;if (ring->funcs->type !=AMDGPU_RING_TYPE_UVD ) { - ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs]; - ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs *4 ); + ring->fence_drv.cpu_addr = ring->fence_cpu_addr; + ring->fence_drv.gpu_addr = ring->fence_gpu_addr;
That doesn't look like a good idea to me. We should probably rather remove ring->fence_offs and move all the handling here instead.
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring, · line 414
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0
-0}else {/* put fence directly behind firmware */ index =ALIGN (adev->uvd.fw->size,8 );
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx