]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/selftests: Distinguish mock device from no wakeref
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 27 Sep 2019 21:17:48 +0000 (22:17 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 27 Sep 2019 22:25:30 +0000 (23:25 +0100)
On systems that have no runtime-pm, we mark the wakeref as being -1. We
therefore cannot use that value for the mock-gt indicator, so opt for
-ENODEV instead. The wakeref should never be an error value -- one
hopes!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190927211749.2181-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_gt_pm.h
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index ab794e853356191a4bfcf86c3c8b9978213b9b13..997770d3a968223e427c5e0c62a50966024aa3bd 100644 (file)
@@ -57,7 +57,7 @@ int intel_gt_runtime_resume(struct intel_gt *gt);
 
 static inline bool is_mock_gt(const struct intel_gt *gt)
 {
-       return I915_SELFTEST_ONLY(gt->awake == -1);
+       return I915_SELFTEST_ONLY(gt->awake == -ENODEV);
 }
 
 #endif /* INTEL_GT_PM_H */
index 91f15fa728cd095fc685f6bc128c1ea8e0ce80f1..2448067822aff686f06e55ea4db34673109409b9 100644 (file)
@@ -182,6 +182,7 @@ struct drm_i915_private *mock_gem_device(void)
        i915_gem_init__mm(i915);
        intel_gt_init_early(&i915->gt, i915);
        atomic_inc(&i915->gt.wakeref.count); /* disable; no hw support */
+       i915->gt.awake = -ENODEV;
 
        i915->wq = alloc_ordered_workqueue("mock", 0);
        if (!i915->wq)
@@ -192,8 +193,6 @@ struct drm_i915_private *mock_gem_device(void)
        INIT_DELAYED_WORK(&i915->gem.retire_work, mock_retire_work_handler);
        INIT_WORK(&i915->gem.idle_work, mock_idle_work_handler);
 
-       i915->gt.awake = -1;
-
        intel_timelines_init(i915);
 
        mutex_lock(&i915->drm.struct_mutex);