1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2022 Intel Corporation 4 */ 5 #ifndef _XE_PT_H_ 6 #define _XE_PT_H_ 7 8 #include <linux/types.h> 9 10 #include "xe_pt_types.h" 11 12 struct dma_fence; 13 struct xe_bo; 14 struct xe_device; 15 struct xe_engine; 16 struct xe_gt; 17 struct xe_sync_entry; 18 struct xe_vm; 19 struct xe_vma; 20 21 #define xe_pt_write(xe, map, idx, data) \ 22 xe_map_wr(xe, map, (idx) * sizeof(u64), u64, data) 23 24 unsigned int xe_pt_shift(unsigned int level); 25 26 struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_gt *gt, 27 unsigned int level); 28 29 int xe_pt_create_scratch(struct xe_device *xe, struct xe_gt *gt, 30 struct xe_vm *vm); 31 32 void xe_pt_populate_empty(struct xe_gt *gt, struct xe_vm *vm, 33 struct xe_pt *pt); 34 35 void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred); 36 37 struct dma_fence * 38 __xe_pt_bind_vma(struct xe_gt *gt, struct xe_vma *vma, struct xe_engine *e, 39 struct xe_sync_entry *syncs, u32 num_syncs, 40 bool rebind); 41 42 struct dma_fence * 43 __xe_pt_unbind_vma(struct xe_gt *gt, struct xe_vma *vma, struct xe_engine *e, 44 struct xe_sync_entry *syncs, u32 num_syncs); 45 46 bool xe_pt_zap_ptes(struct xe_gt *gt, struct xe_vma *vma); 47 48 u64 gen8_pde_encode(struct xe_bo *bo, u64 bo_offset, 49 const enum xe_cache_level level); 50 51 u64 gen8_pte_encode(struct xe_vma *vma, struct xe_bo *bo, 52 u64 offset, enum xe_cache_level cache, 53 u32 flags, u32 pt_level); 54 #endif 55