intel_reset.h 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/*
 * SPDX-License-Identifier: MIT
 *
 * Copyright © 2008-2018 Intel Corporation
 */

#ifndef I915_RESET_H
#define I915_RESET_H

#include <linux/compiler.h>
#include <linux/types.h>
12
#include <linux/srcu.h>
13

14 15
#include "intel_engine_types.h"
#include "intel_reset_types.h"
16

17
struct i915_request;
18
struct intel_engine_cs;
19
struct intel_gt;
20 21
struct intel_guc;

22 23 24
void intel_gt_init_reset(struct intel_gt *gt);
void intel_gt_fini_reset(struct intel_gt *gt);

25
__printf(4, 5)
26 27 28 29
void intel_gt_handle_error(struct intel_gt *gt,
			   intel_engine_mask_t engine_mask,
			   unsigned long flags,
			   const char *fmt, ...);
30 31
#define I915_ERROR_CAPTURE BIT(0)

32 33 34 35 36
void intel_gt_reset(struct intel_gt *gt,
		    intel_engine_mask_t stalled_mask,
		    const char *reason);
int intel_engine_reset(struct intel_engine_cs *engine,
		       const char *reason);
37 38
int __intel_engine_reset_bh(struct intel_engine_cs *engine,
			    const char *reason);
39

40
void __i915_request_reset(struct i915_request *rq, bool guilty);
41

42
int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu);
43
void intel_gt_reset_unlock(struct intel_gt *gt, int tag);
44

45 46 47
void intel_gt_set_wedged(struct intel_gt *gt);
bool intel_gt_unset_wedged(struct intel_gt *gt);
int intel_gt_terminally_wedged(struct intel_gt *gt);
48

49 50 51
/*
 * There's no unset_wedged_on_init paired with this one.
 * Once we're wedged on init, there's no going back.
52
 * Same thing for unset_wedged_on_fini.
53 54
 */
void intel_gt_set_wedged_on_init(struct intel_gt *gt);
55
void intel_gt_set_wedged_on_fini(struct intel_gt *gt);
56

57
int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask);
58

59
int intel_reset_guc(struct intel_gt *gt);
60

61
struct intel_wedge_me {
62
	struct delayed_work work;
63
	struct intel_gt *gt;
64 65 66
	const char *name;
};

67 68 69 70 71
void __intel_init_wedge(struct intel_wedge_me *w,
			struct intel_gt *gt,
			long timeout,
			const char *name);
void __intel_fini_wedge(struct intel_wedge_me *w);
72

73 74 75 76 77
#define intel_wedge_on_timeout(W, GT, TIMEOUT)				\
	for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__);	\
	     (W)->gt;							\
	     __intel_fini_wedge((W)))

78 79
bool intel_has_gpu_reset(const struct intel_gt *gt);
bool intel_has_reset_engine(const struct intel_gt *gt);
80 81

#endif /* I915_RESET_H */