Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / selftests / igt_reset.c
blob9f8590b868a973e3be063add73fa9feadc15f5fb
1 /*
2 * SPDX-License-Identifier: MIT
4 * Copyright © 2018 Intel Corporation
5 */
7 #include "igt_reset.h"
9 #include "gt/intel_engine.h"
10 #include "gt/intel_gt.h"
12 #include "../i915_drv.h"
14 void igt_global_reset_lock(struct intel_gt *gt)
16 struct intel_engine_cs *engine;
17 enum intel_engine_id id;
19 pr_debug("%s: current gpu_error=%08lx\n", __func__, gt->reset.flags);
21 while (test_and_set_bit(I915_RESET_BACKOFF, &gt->reset.flags))
22 wait_event(gt->reset.queue,
23 !test_bit(I915_RESET_BACKOFF, &gt->reset.flags));
25 for_each_engine(engine, gt, id) {
26 while (test_and_set_bit(I915_RESET_ENGINE + id,
27 &gt->reset.flags))
28 wait_on_bit(&gt->reset.flags, I915_RESET_ENGINE + id,
29 TASK_UNINTERRUPTIBLE);
33 void igt_global_reset_unlock(struct intel_gt *gt)
35 struct intel_engine_cs *engine;
36 enum intel_engine_id id;
38 for_each_engine(engine, gt, id)
39 clear_bit(I915_RESET_ENGINE + id, &gt->reset.flags);
41 clear_bit(I915_RESET_BACKOFF, &gt->reset.flags);
42 wake_up_all(&gt->reset.queue);
45 bool igt_force_reset(struct intel_gt *gt)
47 intel_gt_set_wedged(gt);
48 intel_gt_reset(gt, 0, NULL);
50 return !intel_gt_is_wedged(gt);