1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2022 Intel Corporation 4 */ 5 6 #ifndef _XE_PT_TYPES_H_ 7 #define _XE_PT_TYPES_H_ 8 9 #include <linux/types.h> 10 11 #include "xe_pt_walk.h" 12 13 struct xe_bo; 14 struct xe_device; 15 struct xe_vma; 16 17 enum xe_cache_level { 18 XE_CACHE_NONE, 19 XE_CACHE_WT, 20 XE_CACHE_WB, 21 XE_CACHE_NONE_COMPRESSION, /*UC + COH_NONE + COMPRESSION */ 22 __XE_CACHE_LEVEL_COUNT, 23 }; 24 25 #define XE_VM_MAX_LEVEL 4 26 27 struct xe_pt { 28 struct xe_ptw base; 29 struct xe_bo *bo; 30 unsigned int level; 31 unsigned int num_live; 32 bool rebind; 33 bool is_compact; 34 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM) 35 /** addr: Virtual address start address of the PT. */ 36 u64 addr; 37 #endif 38 }; 39 40 struct xe_pt_ops { 41 u64 (*pte_encode_bo)(struct xe_bo *bo, u64 bo_offset, 42 u16 pat_index, u32 pt_level); 43 u64 (*pte_encode_vma)(u64 pte, struct xe_vma *vma, 44 u16 pat_index, u32 pt_level); 45 u64 (*pte_encode_addr)(struct xe_device *xe, u64 addr, 46 u16 pat_index, 47 u32 pt_level, bool devmem, u64 flags); 48 u64 (*pde_encode_bo)(struct xe_bo *bo, u64 bo_offset, 49 u16 pat_index); 50 }; 51 52 struct xe_pt_entry { 53 struct xe_pt *pt; 54 u64 pte; 55 }; 56 57 struct xe_vm_pgtable_update { 58 /** @bo: page table bo to write to */ 59 struct xe_bo *pt_bo; 60 61 /** @ofs: offset inside this PTE to begin writing to (in qwords) */ 62 u32 ofs; 63 64 /** @qwords: number of PTE's to write */ 65 u32 qwords; 66 67 /** @pt: opaque pointer useful for the caller of xe_migrate_update_pgtables */ 68 struct xe_pt *pt; 69 70 /** @pt_entries: Newly added pagetable entries */ 71 struct xe_pt_entry *pt_entries; 72 73 /** @flags: Target flags */ 74 u32 flags; 75 }; 76 77 #endif 78