]> Git Repo - linux.git/blobdiff - drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
Merge tag 'drm-misc-next-2018-11-21' of git://anongit.freedesktop.org/drm/drm-misc...
[linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ib.c
index b8963b725dfa05baf9353f0859bde8af7c4e14f7..c48207b377bc5f5c64549eca69662896285971e5 100644 (file)
@@ -146,7 +146,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                fence_ctx = 0;
        }
 
-       if (!ring->ready) {
+       if (!ring->sched.ready) {
                dev_err(adev->dev, "couldn't schedule ib on ring <%s>\n", ring->name);
                return -EINVAL;
        }
@@ -221,8 +221,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
                        !amdgpu_sriov_vf(adev)) /* for SRIOV preemption, Preamble CE ib must be inserted anyway */
                        continue;
 
-               amdgpu_ring_emit_ib(ring, ib, job ? job->vmid : 0,
-                                   need_ctx_switch);
+               amdgpu_ring_emit_ib(ring, job, ib, need_ctx_switch);
                need_ctx_switch = false;
        }
 
@@ -347,19 +346,14 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
                tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT;
        }
 
-       for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
+       for (i = 0; i < adev->num_rings; ++i) {
                struct amdgpu_ring *ring = adev->rings[i];
                long tmo;
 
-               if (!ring || !ring->ready)
-                       continue;
-
-               /* skip IB tests for KIQ in general for the below reasons:
-                * 1. We never submit IBs to the KIQ
-                * 2. KIQ doesn't use the EOP interrupts,
-                *    we use some other CP interrupt.
+               /* KIQ rings don't have an IB test because we never submit IBs
+                * to them and they have no interrupt support.
                 */
-               if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ)
+               if (!ring->sched.ready || !ring->funcs->test_ib)
                        continue;
 
                /* MM engine need more time */
@@ -374,20 +368,23 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev)
                        tmo = tmo_gfx;
 
                r = amdgpu_ring_test_ib(ring, tmo);
-               if (r) {
-                       ring->ready = false;
-
-                       if (ring == &adev->gfx.gfx_ring[0]) {
-                               /* oh, oh, that's really bad */
-                               DRM_ERROR("amdgpu: failed testing IB on GFX ring (%d).\n", r);
-                               adev->accel_working = false;
-                               return r;
-
-                       } else {
-                               /* still not good, but we can live with it */
-                               DRM_ERROR("amdgpu: failed testing IB on ring %d (%d).\n", i, r);
-                               ret = r;
-                       }
+               if (!r) {
+                       DRM_DEV_DEBUG(adev->dev, "ib test on %s succeeded\n",
+                                     ring->name);
+                       continue;
+               }
+
+               ring->sched.ready = false;
+               DRM_DEV_ERROR(adev->dev, "IB test failed on %s (%d).\n",
+                         ring->name, r);
+
+               if (ring == &adev->gfx.gfx_ring[0]) {
+                       /* oh, oh, that's really bad */
+                       adev->accel_working = false;
+                       return r;
+
+               } else {
+                       ret = r;
                }
        }
        return ret;
This page took 0.038535 seconds and 4 git commands to generate.