xref: /linux/drivers/gpu/drm/xe/xe_pat.h (revision 41c177cf354126a22443b5c80cec9fdd313e67e1)
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 /**
35  * xe_pat_init_early - SW initialization, setting up data based on device
36  * @xe: xe device
37  */
38 void xe_pat_init_early(struct xe_device *xe);
39 
40 /**
41  * xe_pat_init - Program HW PAT table
42  * @gt: GT structure
43  */
44 void xe_pat_init(struct xe_gt *gt);
45 
46 /**
47  * xe_pat_dump - Dump PAT table
48  * @gt: GT structure
49  * @p: Printer to dump info to
50  */
51 void 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