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 #define XE_PAT_INVALID_IDX U16_MAX 16 17 /** 18 * struct xe_pat_table_entry - The pat_index encoding and other meta information. 19 */ 20 struct xe_pat_table_entry { 21 /** 22 * @value: The platform specific value encoding the various memory 23 * attributes (this maps to some fixed pat_index). So things like 24 * caching, coherency, compression etc can be encoded here. 25 */ 26 u32 value; 27 28 /** 29 * @coh_mode: The GPU coherency mode that @value maps to. 30 */ 31 #define XE_COH_NONE 1 32 #define XE_COH_AT_LEAST_1WAY 2 33 u16 coh_mode; 34 35 /** 36 * @valid: Set to 1 if the entry is valid, 0 if it's reserved. 37 */ 38 u16 valid; 39 }; 40 41 /** 42 * xe_pat_init_early - SW initialization, setting up data based on device 43 * @xe: xe device 44 */ 45 void xe_pat_init_early(struct xe_device *xe); 46 47 /** 48 * xe_pat_init - Program HW PAT table 49 * @gt: GT structure 50 */ 51 void xe_pat_init(struct xe_gt *gt); 52 53 int xe_pat_dump(struct xe_gt *gt, struct drm_printer *p); 54 int xe_pat_dump_sw_config(struct xe_gt *gt, struct drm_printer *p); 55 56 /** 57 * xe_pat_index_get_coh_mode - Extract the coherency mode for the given 58 * pat_index. 59 * @xe: xe device 60 * @pat_index: The pat_index to query 61 */ 62 u16 xe_pat_index_get_coh_mode(struct xe_device *xe, u16 pat_index); 63 64 /** 65 * xe_pat_index_get_comp_en - Extract the compression enable flag for 66 * the given pat_index. 67 * @xe: xe device 68 * @pat_index: The pat_index to query 69 * 70 * Return: true if compression is enabled for this pat_index, false otherwise. 71 */ 72 bool xe_pat_index_get_comp_en(struct xe_device *xe, u16 pat_index); 73 74 #define XE_L3_POLICY_WB 0 /* Write-back */ 75 #define XE_L3_POLICY_XD 1 /* WB - Transient Display */ 76 #define XE_L3_POLICY_UC 3 /* Uncached */ 77 /** 78 * xe_pat_index_get_l3_policy - Extract the L3 policy for the given pat_index. 79 * @xe: xe device 80 * @pat_index: The pat_index to query 81 */ 82 u16 xe_pat_index_get_l3_policy(struct xe_device *xe, u16 pat_index); 83 84 #endif 85