diff options
author | Monk Liu <Monk.Liu@amd.com> | 2017-03-08 15:51:13 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-03-29 23:55:33 -0400 |
commit | 9a1b3af10d6268a98076a4397cb1d47c4713efc7 (patch) | |
tree | 9e50e8d3461ccd5664188eb9b21961b9e0a48456 /drivers/gpu/drm/amd | |
parent | 2a9ceb8daab01a4ee27383e4d344e4a8b781c165 (diff) | |
download | op-kernel-dev-9a1b3af10d6268a98076a4397cb1d47c4713efc7.zip op-kernel-dev-9a1b3af10d6268a98076a4397cb1d47c4713efc7.tar.gz |
drm/amdgpu:protect cs submit
to prevent submit two or more IBs with PREEMPT flags.
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')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 63d6905..cf44388 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -888,7 +888,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv = parser->filp->driver_priv; struct amdgpu_vm *vm = &fpriv->vm; int i, j; - int r; + int r, ce_preempt = 0, de_preempt = 0; for (i = 0, j = 0; i < parser->nchunks && j < parser->job->num_ibs; i++) { struct amdgpu_cs_chunk *chunk; @@ -903,6 +903,17 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB) continue; + if (ib->flags & AMDGPU_IB_FLAG_PREEMPT) { + if (ib->flags & AMDGPU_IB_FLAG_CE) + ce_preempt++; + else + de_preempt++; + } + + /* only one preemptible IB per submit for me/ce */ + if (ce_preempt > 1 || de_preempt > 1) + return -EINVAL; + r = amdgpu_cs_get_ring(adev, chunk_ib->ip_type, chunk_ib->ip_instance, chunk_ib->ring, &ring); |