Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright © 2008-2018 Intel Corporation
0004  */
0005 
0006 #ifndef I915_RESET_H
0007 #define I915_RESET_H
0008 
0009 #include <linux/compiler.h>
0010 #include <linux/types.h>
0011 #include <linux/srcu.h>
0012 
0013 #include "intel_engine_types.h"
0014 #include "intel_reset_types.h"
0015 
0016 struct i915_request;
0017 struct intel_engine_cs;
0018 struct intel_gt;
0019 struct intel_guc;
0020 
0021 void intel_gt_init_reset(struct intel_gt *gt);
0022 void intel_gt_fini_reset(struct intel_gt *gt);
0023 
0024 __printf(4, 5)
0025 void intel_gt_handle_error(struct intel_gt *gt,
0026                intel_engine_mask_t engine_mask,
0027                unsigned long flags,
0028                const char *fmt, ...);
0029 #define I915_ERROR_CAPTURE BIT(0)
0030 
0031 void intel_gt_reset(struct intel_gt *gt,
0032             intel_engine_mask_t stalled_mask,
0033             const char *reason);
0034 int intel_engine_reset(struct intel_engine_cs *engine,
0035                const char *reason);
0036 int __intel_engine_reset_bh(struct intel_engine_cs *engine,
0037                 const char *reason);
0038 
0039 void __i915_request_reset(struct i915_request *rq, bool guilty);
0040 
0041 int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu);
0042 void intel_gt_reset_unlock(struct intel_gt *gt, int tag);
0043 
0044 void intel_gt_set_wedged(struct intel_gt *gt);
0045 bool intel_gt_unset_wedged(struct intel_gt *gt);
0046 int intel_gt_terminally_wedged(struct intel_gt *gt);
0047 
0048 /*
0049  * There's no unset_wedged_on_init paired with this one.
0050  * Once we're wedged on init, there's no going back.
0051  * Same thing for unset_wedged_on_fini.
0052  */
0053 void intel_gt_set_wedged_on_init(struct intel_gt *gt);
0054 void intel_gt_set_wedged_on_fini(struct intel_gt *gt);
0055 
0056 int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask);
0057 
0058 int intel_reset_guc(struct intel_gt *gt);
0059 
0060 struct intel_wedge_me {
0061     struct delayed_work work;
0062     struct intel_gt *gt;
0063     const char *name;
0064 };
0065 
0066 void __intel_init_wedge(struct intel_wedge_me *w,
0067             struct intel_gt *gt,
0068             long timeout,
0069             const char *name);
0070 void __intel_fini_wedge(struct intel_wedge_me *w);
0071 
0072 #define intel_wedge_on_timeout(W, GT, TIMEOUT)              \
0073     for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__);    \
0074          (W)->gt;                           \
0075          __intel_fini_wedge((W)))
0076 
0077 bool intel_has_gpu_reset(const struct intel_gt *gt);
0078 bool intel_has_reset_engine(const struct intel_gt *gt);
0079 
0080 #endif /* I915_RESET_H */