xref: /linux/drivers/gpu/drm/xe/xe_pat.h (revision 6dfafbd0299a60bfb5d5e277fdf100037c7ded07)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_PAT_H_
7 #define _XE_PAT_H_
8 
9 #include <linux/types.h>
10 
11 struct drm_printer;
12 struct xe_device;
13 struct xe_gt;
14 
15 /**
16  * struct xe_pat_table_entry - The pat_index encoding and other meta information.
17  */
18 struct xe_pat_table_entry {
19 	/**
20 	 * @value: The platform specific value encoding the various memory
21 	 * attributes (this maps to some fixed pat_index). So things like
22 	 * caching, coherency, compression etc can be encoded here.
23 	 */
24 	u32 value;
25 
26 	/**
27 	 * @coh_mode: The GPU coherency mode that @value maps to.
28 	 */
29 #define XE_COH_NONE          1
30 #define XE_COH_AT_LEAST_1WAY 2
31 	u16 coh_mode;
32 
33 	/**
34 	 * @valid: Set to 1 if the entry is valid, 0 if it's reserved.
35 	 */
36 	u16 valid;
37 };
38 
39 /**
40  * xe_pat_init_early - SW initialization, setting up data based on device
41  * @xe: xe device
42  */
43 void xe_pat_init_early(struct xe_device *xe);
44 
45 /**
46  * xe_pat_init - Program HW PAT table
47  * @gt: GT structure
48  */
49 void xe_pat_init(struct xe_gt *gt);
50 
51 int xe_pat_dump(struct xe_gt *gt, struct drm_printer *p);
52 
53 /**
54  * xe_pat_index_get_coh_mode - Extract the coherency mode for the given
55  * pat_index.
56  * @xe: xe device
57  * @pat_index: The pat_index to query
58  */
59 u16 xe_pat_index_get_coh_mode(struct xe_device *xe, u16 pat_index);
60 
61 #endif
62