drm/i915/selftests: Restore previous heartbeat interval
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Feb 2021 21:13:02 +0000 (21:13 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 24 Mar 2021 18:31:59 +0000 (19:31 +0100)
Use the defaults we store on the engine when resetting the heartbeat as
we may have had to adjust it from the config value during initialisation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210204211303.21347-1-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c

index b0bae667614075d9dbb6e864ea8e764e30f85ad4..b2c369317bf11a511ae6660c058bb781fd68a2a1 100644 (file)
 #include "i915_selftest.h"
 #include "selftest_engine_heartbeat.h"
 
+static void reset_heartbeat(struct intel_engine_cs *engine)
+{
+       intel_engine_set_heartbeat(engine,
+                                  engine->defaults.heartbeat_interval_ms);
+}
+
 static int timeline_sync(struct intel_timeline *tl)
 {
        struct dma_fence *fence;
@@ -269,7 +275,7 @@ static int __live_heartbeat_fast(struct intel_engine_cs *engine)
                err = -EINVAL;
        }
 
-       intel_engine_set_heartbeat(engine, CONFIG_DRM_I915_HEARTBEAT_INTERVAL);
+       reset_heartbeat(engine);
 err_pm:
        intel_engine_pm_put(engine);
        intel_context_put(ce);
@@ -284,7 +290,7 @@ static int live_heartbeat_fast(void *arg)
        int err = 0;
 
        /* Check that the heartbeat ticks at the desired rate. */
-       if (!CONFIG_DRM_I915_HEARTBEAT_INTERVAL)
+       if (!IS_ACTIVE(CONFIG_DRM_I915_HEARTBEAT_INTERVAL))
                return 0;
 
        for_each_engine(engine, gt, id) {
@@ -332,7 +338,7 @@ static int __live_heartbeat_off(struct intel_engine_cs *engine)
        }
 
 err_beat:
-       intel_engine_set_heartbeat(engine, CONFIG_DRM_I915_HEARTBEAT_INTERVAL);
+       reset_heartbeat(engine);
 err_pm:
        intel_engine_pm_put(engine);
        return err;
@@ -346,7 +352,7 @@ static int live_heartbeat_off(void *arg)
        int err = 0;
 
        /* Check that we can turn off heartbeat and not interrupt VIP */
-       if (!CONFIG_DRM_I915_HEARTBEAT_INTERVAL)
+       if (!IS_ACTIVE(CONFIG_DRM_I915_HEARTBEAT_INTERVAL))
                return 0;
 
        for_each_engine(engine, gt, id) {