| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright 2016 Advanced Micro Devices, Inc. | 
|  | 3 | * | 
|  | 4 | * Permission is hereby granted, free of charge, to any person obtaining a | 
|  | 5 | * copy of this software and associated documentation files (the "Software"), | 
|  | 6 | * to deal in the Software without restriction, including without limitation | 
|  | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
|  | 8 | * and/or sell copies of the Software, and to permit persons to whom the | 
|  | 9 | * Software is furnished to do so, subject to the following conditions: | 
|  | 10 | * | 
|  | 11 | * The above copyright notice and this permission notice shall be included in | 
|  | 12 | * all copies or substantial portions of the Software. | 
|  | 13 | * | 
|  | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
|  | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|  | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
|  | 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | 
|  | 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 
|  | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 
|  | 20 | * OTHER DEALINGS IN THE SOFTWARE. | 
|  | 21 | * | 
|  | 22 | * Authors: Christian König | 
|  | 23 | */ | 
|  | 24 | #ifndef __AMDGPU_VM_H__ | 
|  | 25 | #define __AMDGPU_VM_H__ | 
|  | 26 |  | 
| Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 27 | #include <linux/idr.h> | 
| Lucas Stach | 1b1f42d | 2017-12-06 17:49:39 +0100 | [diff] [blame] | 28 | #include <linux/kfifo.h> | 
|  | 29 | #include <linux/rbtree.h> | 
|  | 30 | #include <drm/gpu_scheduler.h> | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 31 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 32 | #include "amdgpu_sync.h" | 
|  | 33 | #include "amdgpu_ring.h" | 
| Christian König | 620f774 | 2017-12-18 16:53:03 +0100 | [diff] [blame] | 34 | #include "amdgpu_ids.h" | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 35 |  | 
|  | 36 | struct amdgpu_bo_va; | 
|  | 37 | struct amdgpu_job; | 
|  | 38 | struct amdgpu_bo_list_entry; | 
|  | 39 |  | 
|  | 40 | /* | 
|  | 41 | * GPUVM handling | 
|  | 42 | */ | 
|  | 43 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 44 | /* Maximum number of PTEs the hardware can write with one command */ | 
|  | 45 | #define AMDGPU_VM_MAX_UPDATE_SIZE	0x3FFFF | 
|  | 46 |  | 
|  | 47 | /* number of entries in page table */ | 
| Zhang, Jerry | 36b32a6 | 2017-03-29 16:08:32 +0800 | [diff] [blame] | 48 | #define AMDGPU_VM_PTE_COUNT(adev) (1 << (adev)->vm_manager.block_size) | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 49 |  | 
|  | 50 | /* PTBs (Page Table Blocks) need to be aligned to 32K */ | 
|  | 51 | #define AMDGPU_VM_PTB_ALIGN_SIZE   32768 | 
|  | 52 |  | 
| Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 53 | #define AMDGPU_PTE_VALID	(1ULL << 0) | 
|  | 54 | #define AMDGPU_PTE_SYSTEM	(1ULL << 1) | 
|  | 55 | #define AMDGPU_PTE_SNOOPED	(1ULL << 2) | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 56 |  | 
|  | 57 | /* VI only */ | 
| Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 58 | #define AMDGPU_PTE_EXECUTABLE	(1ULL << 4) | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 59 |  | 
| Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 60 | #define AMDGPU_PTE_READABLE	(1ULL << 5) | 
|  | 61 | #define AMDGPU_PTE_WRITEABLE	(1ULL << 6) | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 62 |  | 
| Alex Xie | 982a134 | 2017-02-15 14:10:19 -0500 | [diff] [blame] | 63 | #define AMDGPU_PTE_FRAG(x)	((x & 0x1fULL) << 7) | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 64 |  | 
| Zhang, Jerry | d0766e9 | 2017-04-19 09:53:29 +0800 | [diff] [blame] | 65 | /* TILED for VEGA10, reserved for older ASICs  */ | 
|  | 66 | #define AMDGPU_PTE_PRT		(1ULL << 51) | 
| Christian König | 284710f | 2017-01-30 11:09:31 +0100 | [diff] [blame] | 67 |  | 
| Alex Deucher | cf2f0a3 | 2017-07-25 16:35:38 -0400 | [diff] [blame] | 68 | /* PDE is handled as PTE for VEGA10 */ | 
|  | 69 | #define AMDGPU_PDE_PTE		(1ULL << 54) | 
|  | 70 |  | 
| Christian König | 6a42fd6 | 2017-12-05 15:23:26 +0100 | [diff] [blame] | 71 | /* PTE is handled as PDE for VEGA10 (Translate Further) */ | 
|  | 72 | #define AMDGPU_PTE_TF		(1ULL << 56) | 
|  | 73 |  | 
|  | 74 | /* PDE Block Fragment Size for VEGA10 */ | 
|  | 75 | #define AMDGPU_PDE_BFS(a)	((uint64_t)a << 59) | 
|  | 76 |  | 
| Alex Deucher | ca02061 | 2017-03-03 15:23:14 -0500 | [diff] [blame] | 77 | /* VEGA10 only */ | 
|  | 78 | #define AMDGPU_PTE_MTYPE(a)    ((uint64_t)a << 57) | 
|  | 79 | #define AMDGPU_PTE_MTYPE_MASK	AMDGPU_PTE_MTYPE(3ULL) | 
|  | 80 |  | 
| Yong Zhao | 6d16dac | 2017-08-31 15:55:00 -0400 | [diff] [blame] | 81 | /* For Raven */ | 
|  | 82 | #define AMDGPU_MTYPE_CC 2 | 
|  | 83 |  | 
|  | 84 | #define AMDGPU_PTE_DEFAULT_ATC  (AMDGPU_PTE_SYSTEM      \ | 
|  | 85 | | AMDGPU_PTE_SNOOPED    \ | 
|  | 86 | | AMDGPU_PTE_EXECUTABLE \ | 
|  | 87 | | AMDGPU_PTE_READABLE   \ | 
|  | 88 | | AMDGPU_PTE_WRITEABLE  \ | 
|  | 89 | | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC)) | 
|  | 90 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 91 | /* How to programm VM fault handling */ | 
|  | 92 | #define AMDGPU_VM_FAULT_STOP_NEVER	0 | 
|  | 93 | #define AMDGPU_VM_FAULT_STOP_FIRST	1 | 
|  | 94 | #define AMDGPU_VM_FAULT_STOP_ALWAYS	2 | 
|  | 95 |  | 
| Christian König | eb60ef2 | 2017-03-30 14:41:19 +0200 | [diff] [blame] | 96 | /* max number of VMHUB */ | 
|  | 97 | #define AMDGPU_MAX_VMHUBS			2 | 
|  | 98 | #define AMDGPU_GFXHUB				0 | 
|  | 99 | #define AMDGPU_MMHUB				1 | 
|  | 100 |  | 
|  | 101 | /* hardcode that limit for now */ | 
| Christian König | ff4cd38 | 2017-11-06 15:25:37 +0100 | [diff] [blame] | 102 | #define AMDGPU_VA_RESERVED_SIZE			(8ULL << 20) | 
|  | 103 |  | 
| Christian König | bb7939b | 2017-11-06 15:37:01 +0100 | [diff] [blame] | 104 | /* VA hole for 48bit addresses on Vega10 */ | 
|  | 105 | #define AMDGPU_VA_HOLE_START			0x0000800000000000ULL | 
|  | 106 | #define AMDGPU_VA_HOLE_END			0xffff800000000000ULL | 
|  | 107 |  | 
|  | 108 | /* | 
|  | 109 | * Hardware is programmed as if the hole doesn't exists with start and end | 
|  | 110 | * address values. | 
|  | 111 | * | 
|  | 112 | * This mask is used to remove the upper 16bits of the VA and so come up with | 
|  | 113 | * the linear addr value. | 
|  | 114 | */ | 
|  | 115 | #define AMDGPU_VA_HOLE_MASK			0x0000ffffffffffffULL | 
|  | 116 |  | 
| Chunming Zhou | c350577 | 2017-04-21 15:51:04 +0800 | [diff] [blame] | 117 | /* max vmids dedicated for process */ | 
|  | 118 | #define AMDGPU_VM_MAX_RESERVED_VMID	1 | 
| Christian König | eb60ef2 | 2017-03-30 14:41:19 +0200 | [diff] [blame] | 119 |  | 
| Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 120 | #define AMDGPU_VM_CONTEXT_GFX 0 | 
|  | 121 | #define AMDGPU_VM_CONTEXT_COMPUTE 1 | 
|  | 122 |  | 
|  | 123 | /* See vm_update_mode */ | 
|  | 124 | #define AMDGPU_VM_USE_CPU_FOR_GFX (1 << 0) | 
|  | 125 | #define AMDGPU_VM_USE_CPU_FOR_COMPUTE (1 << 1) | 
|  | 126 |  | 
| Chunming Zhou | 196f748 | 2017-12-13 14:22:54 +0800 | [diff] [blame] | 127 | /* VMPT level enumerate, and the hiberachy is: | 
|  | 128 | * PDB2->PDB1->PDB0->PTB | 
|  | 129 | */ | 
|  | 130 | enum amdgpu_vm_level { | 
|  | 131 | AMDGPU_VM_PDB2, | 
|  | 132 | AMDGPU_VM_PDB1, | 
|  | 133 | AMDGPU_VM_PDB0, | 
|  | 134 | AMDGPU_VM_PTB | 
|  | 135 | }; | 
|  | 136 |  | 
| Christian König | ec68154 | 2017-08-01 10:51:43 +0200 | [diff] [blame] | 137 | /* base structure for tracking BO usage in a VM */ | 
|  | 138 | struct amdgpu_vm_bo_base { | 
|  | 139 | /* constant after initialization */ | 
|  | 140 | struct amdgpu_vm		*vm; | 
|  | 141 | struct amdgpu_bo		*bo; | 
|  | 142 |  | 
|  | 143 | /* protected by bo being reserved */ | 
|  | 144 | struct list_head		bo_list; | 
|  | 145 |  | 
|  | 146 | /* protected by spinlock */ | 
|  | 147 | struct list_head		vm_status; | 
| Christian König | 3d7d4d3 | 2017-08-23 16:13:33 +0200 | [diff] [blame] | 148 |  | 
|  | 149 | /* protected by the BO being reserved */ | 
|  | 150 | bool				moved; | 
| Christian König | ec68154 | 2017-08-01 10:51:43 +0200 | [diff] [blame] | 151 | }; | 
| Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 152 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 153 | struct amdgpu_vm_pt { | 
| Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 154 | struct amdgpu_vm_bo_base	base; | 
| Christian König | 78eb2f0 | 2017-11-30 15:41:28 +0100 | [diff] [blame] | 155 | bool				huge; | 
| Christian König | 67003a1 | 2016-10-12 14:46:26 +0200 | [diff] [blame] | 156 |  | 
|  | 157 | /* array of page tables, one for each directory entry */ | 
| Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 158 | struct amdgpu_vm_pt		*entries; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 159 | }; | 
|  | 160 |  | 
| Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 161 | #define AMDGPU_VM_FAULT(pasid, addr) (((u64)(pasid) << 48) | (addr)) | 
|  | 162 | #define AMDGPU_VM_FAULT_PASID(fault) ((u64)(fault) >> 48) | 
|  | 163 | #define AMDGPU_VM_FAULT_ADDR(fault)  ((u64)(fault) & 0xfffffffff000ULL) | 
|  | 164 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 165 | struct amdgpu_vm { | 
|  | 166 | /* tree of virtual addresses mapped */ | 
| Davidlohr Bueso | f808c13 | 2017-09-08 16:15:08 -0700 | [diff] [blame] | 167 | struct rb_root_cached	va; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 168 |  | 
|  | 169 | /* protecting invalidated */ | 
|  | 170 | spinlock_t		status_lock; | 
|  | 171 |  | 
| Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 172 | /* BOs who needs a validation */ | 
|  | 173 | struct list_head	evicted; | 
|  | 174 |  | 
| Christian König | ea09729 | 2017-08-09 14:15:46 +0200 | [diff] [blame] | 175 | /* PT BOs which relocated and their parent need an update */ | 
|  | 176 | struct list_head	relocated; | 
|  | 177 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 178 | /* BOs moved, but not yet updated in the PT */ | 
| Christian König | 27c7b9a | 2017-08-01 11:27:36 +0200 | [diff] [blame] | 179 | struct list_head	moved; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 180 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 181 | /* BO mappings freed, but not yet updated in the PT */ | 
|  | 182 | struct list_head	freed; | 
|  | 183 |  | 
|  | 184 | /* contains the page directory */ | 
| Christian König | 67003a1 | 2016-10-12 14:46:26 +0200 | [diff] [blame] | 185 | struct amdgpu_vm_pt     root; | 
| Christian König | d588451 | 2017-09-08 14:09:41 +0200 | [diff] [blame] | 186 | struct dma_fence	*last_update; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 187 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 188 | /* protecting freed */ | 
|  | 189 | spinlock_t		freed_lock; | 
|  | 190 |  | 
|  | 191 | /* Scheduler entity for page table updates */ | 
| Lucas Stach | 1b1f42d | 2017-12-06 17:49:39 +0100 | [diff] [blame] | 192 | struct drm_sched_entity	entity; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 193 |  | 
| Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 194 | unsigned int		pasid; | 
| Chunming Zhou | 36bbf3b | 2017-04-20 16:17:34 +0800 | [diff] [blame] | 195 | /* dedicated to vm */ | 
| Christian König | 620f774 | 2017-12-18 16:53:03 +0100 | [diff] [blame] | 196 | struct amdgpu_vmid	*reserved_vmid[AMDGPU_MAX_VMHUBS]; | 
| Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 197 |  | 
|  | 198 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ | 
|  | 199 | bool                    use_cpu_for_update; | 
| Yong Zhao | 51ac7ee | 2017-07-27 12:48:22 -0400 | [diff] [blame] | 200 |  | 
|  | 201 | /* Flag to indicate ATS support from PTE for GFX9 */ | 
|  | 202 | bool			pte_support_ats; | 
| Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 203 |  | 
| Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 204 | /* Up to 128 pending retry page faults */ | 
| Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 205 | DECLARE_KFIFO(faults, u64, 128); | 
| Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 206 |  | 
|  | 207 | /* Limit non-retry fault storms */ | 
|  | 208 | unsigned int		fault_credit; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 209 | }; | 
|  | 210 |  | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 211 | struct amdgpu_vm_manager { | 
|  | 212 | /* Handling of VMIDs */ | 
| Christian König | 620f774 | 2017-12-18 16:53:03 +0100 | [diff] [blame] | 213 | struct amdgpu_vmid_mgr			id_mgr[AMDGPU_MAX_VMHUBS]; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 214 |  | 
|  | 215 | /* Handling of VM fences */ | 
|  | 216 | u64					fence_context; | 
|  | 217 | unsigned				seqno[AMDGPU_MAX_RINGS]; | 
|  | 218 |  | 
| Felix Kuehling | 22770e5 | 2017-03-28 20:24:53 -0400 | [diff] [blame] | 219 | uint64_t				max_pfn; | 
| Christian König | 8437a09 | 2016-10-17 15:08:10 +0200 | [diff] [blame] | 220 | uint32_t				num_level; | 
| Zhang, Jerry | 36b32a6 | 2017-03-29 16:08:32 +0800 | [diff] [blame] | 221 | uint32_t				block_size; | 
| Roger He | e618d30 | 2017-08-11 20:00:41 +0800 | [diff] [blame] | 222 | uint32_t				fragment_size; | 
| Chunming Zhou | 196f748 | 2017-12-13 14:22:54 +0800 | [diff] [blame] | 223 | enum amdgpu_vm_level			root_level; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 224 | /* vram base address for page table entry  */ | 
|  | 225 | u64					vram_base_offset; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 226 | /* vm pte handling */ | 
|  | 227 | const struct amdgpu_vm_pte_funcs        *vm_pte_funcs; | 
|  | 228 | struct amdgpu_ring                      *vm_pte_rings[AMDGPU_MAX_RINGS]; | 
|  | 229 | unsigned				vm_pte_num_rings; | 
|  | 230 | atomic_t				vm_pte_next_ring; | 
| Christian König | 284710f | 2017-01-30 11:09:31 +0100 | [diff] [blame] | 231 |  | 
|  | 232 | /* partial resident texture handling */ | 
|  | 233 | spinlock_t				prt_lock; | 
| Christian König | 451bc8e | 2017-02-14 16:02:52 +0100 | [diff] [blame] | 234 | atomic_t				num_prt_users; | 
| Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 235 |  | 
|  | 236 | /* controls how VM page tables are updated for Graphics and Compute. | 
|  | 237 | * BIT0[= 0] Graphics updated by SDMA [= 1] by CPU | 
|  | 238 | * BIT1[= 0] Compute updated by SDMA [= 1] by CPU | 
|  | 239 | */ | 
|  | 240 | int					vm_update_mode; | 
| Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 241 |  | 
|  | 242 | /* PASID to VM mapping, will be used in interrupt context to | 
|  | 243 | * look up VM of a page fault | 
|  | 244 | */ | 
|  | 245 | struct idr				pasid_idr; | 
|  | 246 | spinlock_t				pasid_lock; | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 247 | }; | 
|  | 248 |  | 
|  | 249 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); | 
|  | 250 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); | 
| Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 251 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 
| Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 252 | int vm_context, unsigned int pasid); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 253 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); | 
| Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 254 | bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev, | 
|  | 255 | unsigned int pasid); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 256 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, | 
|  | 257 | struct list_head *validated, | 
|  | 258 | struct amdgpu_bo_list_entry *entry); | 
| Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 259 | bool amdgpu_vm_ready(struct amdgpu_vm *vm); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 260 | int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 
|  | 261 | int (*callback)(void *p, struct amdgpu_bo *bo), | 
|  | 262 | void *param); | 
| Christian König | 663e457 | 2017-03-13 10:13:37 +0100 | [diff] [blame] | 263 | int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, | 
|  | 264 | struct amdgpu_vm *vm, | 
|  | 265 | uint64_t saddr, uint64_t size); | 
| Monk Liu | 8fdf074 | 2017-06-06 17:25:13 +0800 | [diff] [blame] | 266 | int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync); | 
| Christian König | 194d216 | 2016-10-12 15:13:52 +0200 | [diff] [blame] | 267 | int amdgpu_vm_update_directories(struct amdgpu_device *adev, | 
|  | 268 | struct amdgpu_vm *vm); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 269 | int amdgpu_vm_clear_freed(struct amdgpu_device *adev, | 
| Nicolai Hähnle | f346781 | 2017-03-23 19:36:31 +0100 | [diff] [blame] | 270 | struct amdgpu_vm *vm, | 
|  | 271 | struct dma_fence **fence); | 
| Christian König | 73fb16e | 2017-08-16 11:13:48 +0200 | [diff] [blame] | 272 | int amdgpu_vm_handle_moved(struct amdgpu_device *adev, | 
| Christian König | 4e55eb3 | 2017-09-11 16:54:59 +0200 | [diff] [blame] | 273 | struct amdgpu_vm *vm); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 274 | int amdgpu_vm_bo_update(struct amdgpu_device *adev, | 
|  | 275 | struct amdgpu_bo_va *bo_va, | 
|  | 276 | bool clear); | 
|  | 277 | void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, | 
| Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 278 | struct amdgpu_bo *bo, bool evicted); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 279 | struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm, | 
|  | 280 | struct amdgpu_bo *bo); | 
|  | 281 | struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, | 
|  | 282 | struct amdgpu_vm *vm, | 
|  | 283 | struct amdgpu_bo *bo); | 
|  | 284 | int amdgpu_vm_bo_map(struct amdgpu_device *adev, | 
|  | 285 | struct amdgpu_bo_va *bo_va, | 
|  | 286 | uint64_t addr, uint64_t offset, | 
| Christian König | 268c300 | 2017-01-18 14:49:43 +0100 | [diff] [blame] | 287 | uint64_t size, uint64_t flags); | 
| Christian König | 80f95c5 | 2017-03-13 10:13:39 +0100 | [diff] [blame] | 288 | int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev, | 
|  | 289 | struct amdgpu_bo_va *bo_va, | 
|  | 290 | uint64_t addr, uint64_t offset, | 
|  | 291 | uint64_t size, uint64_t flags); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 292 | int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, | 
|  | 293 | struct amdgpu_bo_va *bo_va, | 
|  | 294 | uint64_t addr); | 
| Christian König | dc54d3d | 2017-03-13 10:13:38 +0100 | [diff] [blame] | 295 | int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, | 
|  | 296 | struct amdgpu_vm *vm, | 
|  | 297 | uint64_t saddr, uint64_t size); | 
| Christian König | aebc5e6 | 2017-09-06 16:55:16 +0200 | [diff] [blame] | 298 | struct amdgpu_bo_va_mapping *amdgpu_vm_bo_lookup_mapping(struct amdgpu_vm *vm, | 
|  | 299 | uint64_t addr); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 300 | void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, | 
|  | 301 | struct amdgpu_bo_va *bo_va); | 
| Christian König | fdd5faa | 2017-11-04 16:51:44 +0100 | [diff] [blame] | 302 | void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t vm_size, | 
| Christian König | f336812 | 2017-11-23 12:57:18 +0100 | [diff] [blame] | 303 | uint32_t fragment_size_default, unsigned max_level, | 
|  | 304 | unsigned max_bits); | 
| Chunming Zhou | cfbcacf | 2017-04-24 11:09:04 +0800 | [diff] [blame] | 305 | int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); | 
| Chunming Zhou | b9bf33d | 2017-05-11 14:52:48 -0400 | [diff] [blame] | 306 | bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring, | 
|  | 307 | struct amdgpu_job *job); | 
| Alex Xie | e59c020 | 2017-06-01 09:42:59 -0400 | [diff] [blame] | 308 | void amdgpu_vm_check_compute_bug(struct amdgpu_device *adev); | 
| Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 309 |  | 
|  | 310 | #endif |