Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * SPDX-License-Identifier: MIT
0003  *
0004  * Copyright © 2018 Intel Corporation
0005  */
0006 
0007 #include "igt_reset.h"
0008 
0009 #include "gt/intel_engine.h"
0010 #include "gt/intel_gt.h"
0011 
0012 #include "../i915_drv.h"
0013 
0014 void igt_global_reset_lock(struct intel_gt *gt)
0015 {
0016     struct intel_engine_cs *engine;
0017     enum intel_engine_id id;
0018 
0019     pr_debug("%s: current gpu_error=%08lx\n", __func__, gt->reset.flags);
0020 
0021     while (test_and_set_bit(I915_RESET_BACKOFF, &gt->reset.flags))
0022         wait_event(gt->reset.queue,
0023                !test_bit(I915_RESET_BACKOFF, &gt->reset.flags));
0024 
0025     for_each_engine(engine, gt, id) {
0026         while (test_and_set_bit(I915_RESET_ENGINE + id,
0027                     &gt->reset.flags))
0028             wait_on_bit(&gt->reset.flags, I915_RESET_ENGINE + id,
0029                     TASK_UNINTERRUPTIBLE);
0030     }
0031 }
0032 
0033 void igt_global_reset_unlock(struct intel_gt *gt)
0034 {
0035     struct intel_engine_cs *engine;
0036     enum intel_engine_id id;
0037 
0038     for_each_engine(engine, gt, id)
0039         clear_and_wake_up_bit(I915_RESET_ENGINE + id, &gt->reset.flags);
0040 
0041     clear_bit(I915_RESET_BACKOFF, &gt->reset.flags);
0042     wake_up_all(&gt->reset.queue);
0043 }
0044 
0045 bool igt_force_reset(struct intel_gt *gt)
0046 {
0047     intel_gt_set_wedged(gt);
0048     intel_gt_reset(gt, 0, NULL);
0049 
0050     return !intel_gt_is_wedged(gt);
0051 }