1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2022 Intel Corporation
4 */
5
6#ifndef _XE_WA_
7#define _XE_WA_
8
9#include "xe_assert.h"
10
11struct drm_printer;
12struct xe_gt;
13struct xe_hw_engine;
14struct xe_tile;
15
16int xe_wa_device_init(struct xe_device *xe);
17int xe_wa_gt_init(struct xe_gt *gt);
18void xe_wa_process_device_oob(struct xe_device *xe);
19void xe_wa_process_gt_oob(struct xe_gt *gt);
20void xe_wa_process_gt(struct xe_gt *gt);
21void xe_wa_process_engine(struct xe_hw_engine *hwe);
22void xe_wa_process_lrc(struct xe_hw_engine *hwe);
23void xe_wa_apply_tile_workarounds(struct xe_tile *tile);
24void xe_wa_device_dump(struct xe_device *xe, struct drm_printer *p);
25int xe_wa_gt_dump(struct xe_gt *gt, struct drm_printer *p);
26
27/**
28 * XE_GT_WA - Out-of-band GT workarounds, to be queried and called as needed.
29 * @gt__: gt instance
30 * @id__: XE_OOB_<id__>, as generated by build system in generated/xe_wa_oob.h
31 */
32#define XE_GT_WA(gt__, id__) ({ \
33 xe_gt_assert(gt__, (gt__)->wa_active.oob_initialized); \
34 test_bit(XE_WA_OOB_ ## id__, (gt__)->wa_active.oob); \
35})
36
37/**
38 * XE_DEVICE_WA - Out-of-band Device workarounds, to be queried and called
39 * as needed.
40 * @xe__: xe_device
41 * @id__: XE_DEVICE_WA_OOB_<id__>, as generated by build system in generated/xe_device_wa_oob.h
42 */
43#define XE_DEVICE_WA(xe__, id__) ({ \
44 xe_assert(xe__, (xe__)->wa_active.oob_initialized); \
45 test_bit(XE_DEVICE_WA_OOB_ ## id__, (xe__)->wa_active.oob); \
46})
47
48#define XE_DEVICE_WA_DISABLE(xe__, id__) ({ \
49 xe_assert(xe__, (xe__)->wa_active.oob_initialized); \
50 clear_bit(XE_DEVICE_WA_OOB_ ## id__, (xe__)->wa_active.oob); \
51})
52
53#endif
54

source code of linux/drivers/gpu/drm/xe/xe_wa.h