aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2017-06-06 05:25:13 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:10 -0400
commit8fdf074f1840eae838bbccbec37d0a1504ee432b (patch)
tree7bfca536bc87c4ae0e8ad6129f95bc72dd6bef9a /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
parentbdb8cd10b99d55d35b869fbf5cd6df9420b9bd85 (diff)
drm/amdgpu:fix world switch hang
for SR-IOV, we must keep the pipeline-sync in the protection of COND_EXEC, otherwise the command consumed by CPG is not consistent when world switch triggerd, e.g.: world switch hit and the IB frame is skipped so the fence won't signal, thus CP will jump to the next DMAframe's pipeline-sync command, and it will make CP hang foever. after pipelin-sync moved into COND_EXEC the consistency can be guaranteed Signed-off-by: Monk Liu <Monk.Liu@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/amd/amdgpu/amdgpu_ib.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 1b30d2ab9c51..659997bfff30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -130,6 +130,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
130 130
131 unsigned i; 131 unsigned i;
132 int r = 0; 132 int r = 0;
133 bool need_pipe_sync = false;
133 134
134 if (num_ibs == 0) 135 if (num_ibs == 0)
135 return -EINVAL; 136 return -EINVAL;
@@ -165,7 +166,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
165 if (ring->funcs->emit_pipeline_sync && job && 166 if (ring->funcs->emit_pipeline_sync && job &&
166 ((tmp = amdgpu_sync_get_fence(&job->sched_sync)) || 167 ((tmp = amdgpu_sync_get_fence(&job->sched_sync)) ||
167 amdgpu_vm_need_pipeline_sync(ring, job))) { 168 amdgpu_vm_need_pipeline_sync(ring, job))) {
168 amdgpu_ring_emit_pipeline_sync(ring); 169 need_pipe_sync = true;
169 dma_fence_put(tmp); 170 dma_fence_put(tmp);
170 } 171 }
171 172
@@ -173,7 +174,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
173 ring->funcs->insert_start(ring); 174 ring->funcs->insert_start(ring);
174 175
175 if (job) { 176 if (job) {
176 r = amdgpu_vm_flush(ring, job); 177 r = amdgpu_vm_flush(ring, job, need_pipe_sync);
177 if (r) { 178 if (r) {
178 amdgpu_ring_undo(ring); 179 amdgpu_ring_undo(ring);
179 return r; 180 return r;