drm/amdgpu:fix the check in cs_ib_fill for SRIOV
authorMonk Liu <Monk.Liu@amd.com>
Mon, 27 Mar 2017 07:14:53 +0000 (15:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Mar 2017 03:55:34 +0000 (23:55 -0400)
1,the check is only appliable for SRIOV GFX engine.
2,use chunk_ib instead of ib.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Ken Wang <Qingqing.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

index cf44388b5bce6c460dd5fc02e43884c4b9a7bbb1..2957404bd44a5bf5c32e13ff4b902877d06c1e49 100644 (file)
@@ -903,17 +903,18 @@ 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++;
+               if (chunk_ib->ip_type == AMDGPU_HW_IP_GFX && amdgpu_sriov_vf(adev)) {
+                       if (chunk_ib->flags & AMDGPU_IB_FLAG_PREEMPT)
+                               if (chunk_ib->flags & AMDGPU_IB_FLAG_CE)
+                                       ce_preempt++;
+                               else
+                                       de_preempt++;
+
+                       /* each GFX command submit allows 0 or 1 IB preemptible for CE & DE */
+                       if (ce_preempt > 1 || de_preempt > 1)
+                               BUG();
                }
 
-               /* 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);