Commit ef3e1323 authored by Jack Xiao's avatar Jack Xiao Committed by Alex Deucher

drm/amdgpu: add the trailing fence per ring

The trailing fence for ring is used to track the
completion of preemption.
Acked-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent dfc98479
...@@ -712,6 +712,14 @@ static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data) ...@@ -712,6 +712,14 @@ static int amdgpu_debugfs_fence_info(struct seq_file *m, void *data)
seq_printf(m, "Last emitted 0x%08x\n", seq_printf(m, "Last emitted 0x%08x\n",
ring->fence_drv.sync_seq); ring->fence_drv.sync_seq);
if (ring->funcs->type == AMDGPU_RING_TYPE_GFX ||
ring->funcs->type == AMDGPU_RING_TYPE_SDMA) {
seq_printf(m, "Last signaled trailing fence 0x%08x\n",
le32_to_cpu(*ring->trail_fence_cpu_addr));
seq_printf(m, "Last emitted 0x%08x\n",
ring->trail_seq);
}
if (ring->funcs->type != AMDGPU_RING_TYPE_GFX) if (ring->funcs->type != AMDGPU_RING_TYPE_GFX)
continue; continue;
......
...@@ -281,6 +281,16 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, ...@@ -281,6 +281,16 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
return r; return r;
} }
r = amdgpu_device_wb_get(adev, &ring->trail_fence_offs);
if (r) {
dev_err(adev->dev,
"(%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); r = amdgpu_device_wb_get(adev, &ring->cond_exe_offs);
if (r) { if (r) {
dev_err(adev->dev, "(%d) ring cond_exec_polling wb alloc failed\n", r); dev_err(adev->dev, "(%d) ring cond_exec_polling wb alloc failed\n", r);
......
...@@ -206,6 +206,10 @@ struct amdgpu_ring { ...@@ -206,6 +206,10 @@ struct amdgpu_ring {
unsigned fence_offs; unsigned fence_offs;
uint64_t current_ctx; uint64_t current_ctx;
char name[16]; char name[16];
u32 trail_seq;
unsigned trail_fence_offs;
u64 trail_fence_gpu_addr;
volatile u32 *trail_fence_cpu_addr;
unsigned cond_exe_offs; unsigned cond_exe_offs;
u64 cond_exe_gpu_addr; u64 cond_exe_gpu_addr;
volatile u32 *cond_exe_cpu_addr; volatile u32 *cond_exe_cpu_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment