18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * SPDX-License-Identifier: MIT 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright © 2008-2018 Intel Corporation 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef I915_RESET_H 88c2ecf20Sopenharmony_ci#define I915_RESET_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/compiler.h> 118c2ecf20Sopenharmony_ci#include <linux/types.h> 128c2ecf20Sopenharmony_ci#include <linux/srcu.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include "intel_engine_types.h" 158c2ecf20Sopenharmony_ci#include "intel_reset_types.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistruct i915_request; 188c2ecf20Sopenharmony_cistruct intel_engine_cs; 198c2ecf20Sopenharmony_cistruct intel_gt; 208c2ecf20Sopenharmony_cistruct intel_guc; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_civoid intel_gt_init_reset(struct intel_gt *gt); 238c2ecf20Sopenharmony_civoid intel_gt_fini_reset(struct intel_gt *gt); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci__printf(4, 5) 268c2ecf20Sopenharmony_civoid intel_gt_handle_error(struct intel_gt *gt, 278c2ecf20Sopenharmony_ci intel_engine_mask_t engine_mask, 288c2ecf20Sopenharmony_ci unsigned long flags, 298c2ecf20Sopenharmony_ci const char *fmt, ...); 308c2ecf20Sopenharmony_ci#define I915_ERROR_CAPTURE BIT(0) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_civoid intel_gt_reset(struct intel_gt *gt, 338c2ecf20Sopenharmony_ci intel_engine_mask_t stalled_mask, 348c2ecf20Sopenharmony_ci const char *reason); 358c2ecf20Sopenharmony_ciint intel_engine_reset(struct intel_engine_cs *engine, 368c2ecf20Sopenharmony_ci const char *reason); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_civoid __i915_request_reset(struct i915_request *rq, bool guilty); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciint __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu); 418c2ecf20Sopenharmony_civoid intel_gt_reset_unlock(struct intel_gt *gt, int tag); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_civoid intel_gt_set_wedged(struct intel_gt *gt); 448c2ecf20Sopenharmony_cibool intel_gt_unset_wedged(struct intel_gt *gt); 458c2ecf20Sopenharmony_ciint intel_gt_terminally_wedged(struct intel_gt *gt); 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* 488c2ecf20Sopenharmony_ci * There's no unset_wedged_on_init paired with this one. 498c2ecf20Sopenharmony_ci * Once we're wedged on init, there's no going back. 508c2ecf20Sopenharmony_ci * Same thing for unset_wedged_on_fini. 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_civoid intel_gt_set_wedged_on_init(struct intel_gt *gt); 538c2ecf20Sopenharmony_civoid intel_gt_set_wedged_on_fini(struct intel_gt *gt); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciint __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask); 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciint intel_reset_guc(struct intel_gt *gt); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistruct intel_wedge_me { 608c2ecf20Sopenharmony_ci struct delayed_work work; 618c2ecf20Sopenharmony_ci struct intel_gt *gt; 628c2ecf20Sopenharmony_ci const char *name; 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_civoid __intel_init_wedge(struct intel_wedge_me *w, 668c2ecf20Sopenharmony_ci struct intel_gt *gt, 678c2ecf20Sopenharmony_ci long timeout, 688c2ecf20Sopenharmony_ci const char *name); 698c2ecf20Sopenharmony_civoid __intel_fini_wedge(struct intel_wedge_me *w); 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define intel_wedge_on_timeout(W, GT, TIMEOUT) \ 728c2ecf20Sopenharmony_ci for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__); \ 738c2ecf20Sopenharmony_ci (W)->gt; \ 748c2ecf20Sopenharmony_ci __intel_fini_wedge((W))) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_cibool intel_has_gpu_reset(const struct intel_gt *gt); 778c2ecf20Sopenharmony_cibool intel_has_reset_engine(const struct intel_gt *gt); 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci#endif /* I915_RESET_H */ 80