linux/drivers/gpu/drm/i915/gt/intel_reset.h
<<
>>
Prefs
   1/*
   2 * SPDX-License-Identifier: MIT
   3 *
   4 * Copyright © 2008-2018 Intel Corporation
   5 */
   6
   7#ifndef I915_RESET_H
   8#define I915_RESET_H
   9
  10#include <linux/compiler.h>
  11#include <linux/types.h>
  12#include <linux/srcu.h>
  13
  14#include "intel_engine_types.h"
  15#include "intel_reset_types.h"
  16
  17struct i915_request;
  18struct intel_engine_cs;
  19struct intel_gt;
  20struct intel_guc;
  21
  22void intel_gt_init_reset(struct intel_gt *gt);
  23void intel_gt_fini_reset(struct intel_gt *gt);
  24
  25__printf(4, 5)
  26void intel_gt_handle_error(struct intel_gt *gt,
  27                           intel_engine_mask_t engine_mask,
  28                           unsigned long flags,
  29                           const char *fmt, ...);
  30#define I915_ERROR_CAPTURE BIT(0)
  31
  32void intel_gt_reset(struct intel_gt *gt,
  33                    intel_engine_mask_t stalled_mask,
  34                    const char *reason);
  35int intel_engine_reset(struct intel_engine_cs *engine,
  36                       const char *reason);
  37
  38void __i915_request_reset(struct i915_request *rq, bool guilty);
  39
  40int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu);
  41void intel_gt_reset_unlock(struct intel_gt *gt, int tag);
  42
  43void intel_gt_set_wedged(struct intel_gt *gt);
  44bool intel_gt_unset_wedged(struct intel_gt *gt);
  45int intel_gt_terminally_wedged(struct intel_gt *gt);
  46
  47/*
  48 * There's no unset_wedged_on_init paired with this one.
  49 * Once we're wedged on init, there's no going back.
  50 * Same thing for unset_wedged_on_fini.
  51 */
  52void intel_gt_set_wedged_on_init(struct intel_gt *gt);
  53void intel_gt_set_wedged_on_fini(struct intel_gt *gt);
  54
  55int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask);
  56
  57int intel_reset_guc(struct intel_gt *gt);
  58
  59struct intel_wedge_me {
  60        struct delayed_work work;
  61        struct intel_gt *gt;
  62        const char *name;
  63};
  64
  65void __intel_init_wedge(struct intel_wedge_me *w,
  66                        struct intel_gt *gt,
  67                        long timeout,
  68                        const char *name);
  69void __intel_fini_wedge(struct intel_wedge_me *w);
  70
  71#define intel_wedge_on_timeout(W, GT, TIMEOUT)                          \
  72        for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__);        \
  73             (W)->gt;                                                   \
  74             __intel_fini_wedge((W)))
  75
  76bool intel_has_gpu_reset(const struct intel_gt *gt);
  77bool intel_has_reset_engine(const struct intel_gt *gt);
  78
  79#endif /* I915_RESET_H */
  80