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 | |
| 27 | #include <linux/rbtree.h> |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 28 | #include <linux/idr.h> |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 29 | |
| 30 | #include "gpu_scheduler.h" |
| 31 | #include "amdgpu_sync.h" |
| 32 | #include "amdgpu_ring.h" |
| 33 | |
| 34 | struct amdgpu_bo_va; |
| 35 | struct amdgpu_job; |
| 36 | struct amdgpu_bo_list_entry; |
| 37 | |
| 38 | /* |
| 39 | * GPUVM handling |
| 40 | */ |
| 41 | |
| 42 | /* maximum number of VMIDs */ |
| 43 | #define AMDGPU_NUM_VM 16 |
| 44 | |
| 45 | /* Maximum number of PTEs the hardware can write with one command */ |
| 46 | #define AMDGPU_VM_MAX_UPDATE_SIZE 0x3FFFF |
| 47 | |
| 48 | /* number of entries in page table */ |
Zhang, Jerry | 36b32a6 | 2017-03-29 16:08:32 +0800 | [diff] [blame] | 49 | #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] | 50 | |
| 51 | /* PTBs (Page Table Blocks) need to be aligned to 32K */ |
| 52 | #define AMDGPU_VM_PTB_ALIGN_SIZE 32768 |
| 53 | |
Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 54 | #define AMDGPU_PTE_VALID (1ULL << 0) |
| 55 | #define AMDGPU_PTE_SYSTEM (1ULL << 1) |
| 56 | #define AMDGPU_PTE_SNOOPED (1ULL << 2) |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 57 | |
| 58 | /* VI only */ |
Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 59 | #define AMDGPU_PTE_EXECUTABLE (1ULL << 4) |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 60 | |
Christian König | 35ba15f | 2017-02-13 14:22:58 +0100 | [diff] [blame] | 61 | #define AMDGPU_PTE_READABLE (1ULL << 5) |
| 62 | #define AMDGPU_PTE_WRITEABLE (1ULL << 6) |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 63 | |
Alex Xie | 982a134 | 2017-02-15 14:10:19 -0500 | [diff] [blame] | 64 | #define AMDGPU_PTE_FRAG(x) ((x & 0x1fULL) << 7) |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 65 | |
Zhang, Jerry | d0766e9 | 2017-04-19 09:53:29 +0800 | [diff] [blame] | 66 | /* TILED for VEGA10, reserved for older ASICs */ |
| 67 | #define AMDGPU_PTE_PRT (1ULL << 51) |
Christian König | 284710f | 2017-01-30 11:09:31 +0100 | [diff] [blame] | 68 | |
Alex Deucher | cf2f0a3 | 2017-07-25 16:35:38 -0400 | [diff] [blame] | 69 | /* PDE is handled as PTE for VEGA10 */ |
| 70 | #define AMDGPU_PDE_PTE (1ULL << 54) |
| 71 | |
Alex Deucher | ca02061 | 2017-03-03 15:23:14 -0500 | [diff] [blame] | 72 | /* VEGA10 only */ |
| 73 | #define AMDGPU_PTE_MTYPE(a) ((uint64_t)a << 57) |
| 74 | #define AMDGPU_PTE_MTYPE_MASK AMDGPU_PTE_MTYPE(3ULL) |
| 75 | |
Yong Zhao | 6d16dac | 2017-08-31 15:55:00 -0400 | [diff] [blame] | 76 | /* For Raven */ |
| 77 | #define AMDGPU_MTYPE_CC 2 |
| 78 | |
| 79 | #define AMDGPU_PTE_DEFAULT_ATC (AMDGPU_PTE_SYSTEM \ |
| 80 | | AMDGPU_PTE_SNOOPED \ |
| 81 | | AMDGPU_PTE_EXECUTABLE \ |
| 82 | | AMDGPU_PTE_READABLE \ |
| 83 | | AMDGPU_PTE_WRITEABLE \ |
| 84 | | AMDGPU_PTE_MTYPE(AMDGPU_MTYPE_CC)) |
| 85 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 86 | /* How to programm VM fault handling */ |
| 87 | #define AMDGPU_VM_FAULT_STOP_NEVER 0 |
| 88 | #define AMDGPU_VM_FAULT_STOP_FIRST 1 |
| 89 | #define AMDGPU_VM_FAULT_STOP_ALWAYS 2 |
| 90 | |
Christian König | eb60ef2 | 2017-03-30 14:41:19 +0200 | [diff] [blame] | 91 | /* max number of VMHUB */ |
| 92 | #define AMDGPU_MAX_VMHUBS 2 |
| 93 | #define AMDGPU_GFXHUB 0 |
| 94 | #define AMDGPU_MMHUB 1 |
| 95 | |
| 96 | /* hardcode that limit for now */ |
Christian König | ff4cd38 | 2017-11-06 15:25:37 +0100 | [diff] [blame^] | 97 | #define AMDGPU_VA_RESERVED_SIZE (8ULL << 20) |
| 98 | |
Chunming Zhou | c350577 | 2017-04-21 15:51:04 +0800 | [diff] [blame] | 99 | /* max vmids dedicated for process */ |
| 100 | #define AMDGPU_VM_MAX_RESERVED_VMID 1 |
Christian König | eb60ef2 | 2017-03-30 14:41:19 +0200 | [diff] [blame] | 101 | |
Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 102 | #define AMDGPU_VM_CONTEXT_GFX 0 |
| 103 | #define AMDGPU_VM_CONTEXT_COMPUTE 1 |
| 104 | |
| 105 | /* See vm_update_mode */ |
| 106 | #define AMDGPU_VM_USE_CPU_FOR_GFX (1 << 0) |
| 107 | #define AMDGPU_VM_USE_CPU_FOR_COMPUTE (1 << 1) |
| 108 | |
Christian König | ec68154 | 2017-08-01 10:51:43 +0200 | [diff] [blame] | 109 | /* base structure for tracking BO usage in a VM */ |
| 110 | struct amdgpu_vm_bo_base { |
| 111 | /* constant after initialization */ |
| 112 | struct amdgpu_vm *vm; |
| 113 | struct amdgpu_bo *bo; |
| 114 | |
| 115 | /* protected by bo being reserved */ |
| 116 | struct list_head bo_list; |
| 117 | |
| 118 | /* protected by spinlock */ |
| 119 | struct list_head vm_status; |
Christian König | 3d7d4d3 | 2017-08-23 16:13:33 +0200 | [diff] [blame] | 120 | |
| 121 | /* protected by the BO being reserved */ |
| 122 | bool moved; |
Christian König | ec68154 | 2017-08-01 10:51:43 +0200 | [diff] [blame] | 123 | }; |
Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 124 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 125 | struct amdgpu_vm_pt { |
Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 126 | struct amdgpu_vm_bo_base base; |
| 127 | uint64_t addr; |
Christian König | 67003a1 | 2016-10-12 14:46:26 +0200 | [diff] [blame] | 128 | |
| 129 | /* array of page tables, one for each directory entry */ |
Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 130 | struct amdgpu_vm_pt *entries; |
| 131 | unsigned last_entry_used; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 132 | }; |
| 133 | |
Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 134 | #define AMDGPU_VM_FAULT(pasid, addr) (((u64)(pasid) << 48) | (addr)) |
| 135 | #define AMDGPU_VM_FAULT_PASID(fault) ((u64)(fault) >> 48) |
| 136 | #define AMDGPU_VM_FAULT_ADDR(fault) ((u64)(fault) & 0xfffffffff000ULL) |
| 137 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 138 | struct amdgpu_vm { |
| 139 | /* tree of virtual addresses mapped */ |
Davidlohr Bueso | f808c13 | 2017-09-08 16:15:08 -0700 | [diff] [blame] | 140 | struct rb_root_cached va; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 141 | |
| 142 | /* protecting invalidated */ |
| 143 | spinlock_t status_lock; |
| 144 | |
Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 145 | /* BOs who needs a validation */ |
| 146 | struct list_head evicted; |
| 147 | |
Christian König | ea09729 | 2017-08-09 14:15:46 +0200 | [diff] [blame] | 148 | /* PT BOs which relocated and their parent need an update */ |
| 149 | struct list_head relocated; |
| 150 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 151 | /* BOs moved, but not yet updated in the PT */ |
Christian König | 27c7b9a | 2017-08-01 11:27:36 +0200 | [diff] [blame] | 152 | struct list_head moved; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 153 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 154 | /* BO mappings freed, but not yet updated in the PT */ |
| 155 | struct list_head freed; |
| 156 | |
| 157 | /* contains the page directory */ |
Christian König | 67003a1 | 2016-10-12 14:46:26 +0200 | [diff] [blame] | 158 | struct amdgpu_vm_pt root; |
Christian König | d588451 | 2017-09-08 14:09:41 +0200 | [diff] [blame] | 159 | struct dma_fence *last_update; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 160 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 161 | /* protecting freed */ |
| 162 | spinlock_t freed_lock; |
| 163 | |
| 164 | /* Scheduler entity for page table updates */ |
| 165 | struct amd_sched_entity entity; |
| 166 | |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 167 | /* client id and PASID (TODO: replace client_id with PASID) */ |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 168 | u64 client_id; |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 169 | unsigned int pasid; |
Chunming Zhou | 36bbf3b | 2017-04-20 16:17:34 +0800 | [diff] [blame] | 170 | /* dedicated to vm */ |
| 171 | struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; |
Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 172 | |
| 173 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ |
| 174 | bool use_cpu_for_update; |
Yong Zhao | 51ac7ee | 2017-07-27 12:48:22 -0400 | [diff] [blame] | 175 | |
| 176 | /* Flag to indicate ATS support from PTE for GFX9 */ |
| 177 | bool pte_support_ats; |
Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 178 | |
Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 179 | /* Up to 128 pending retry page faults */ |
Felix Kuehling | a2f1482 | 2017-08-26 02:43:06 -0400 | [diff] [blame] | 180 | DECLARE_KFIFO(faults, u64, 128); |
Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 181 | |
| 182 | /* Limit non-retry fault storms */ |
| 183 | unsigned int fault_credit; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 184 | }; |
| 185 | |
| 186 | struct amdgpu_vm_id { |
| 187 | struct list_head list; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 188 | struct amdgpu_sync active; |
Dave Airlie | 220196b | 2016-10-28 11:33:52 +1000 | [diff] [blame] | 189 | struct dma_fence *last_flush; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 190 | atomic64_t owner; |
| 191 | |
| 192 | uint64_t pd_gpu_addr; |
| 193 | /* last flushed PD/PT update */ |
Dave Airlie | 220196b | 2016-10-28 11:33:52 +1000 | [diff] [blame] | 194 | struct dma_fence *flushed_updates; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 195 | |
| 196 | uint32_t current_gpu_reset_count; |
| 197 | |
| 198 | uint32_t gds_base; |
| 199 | uint32_t gds_size; |
| 200 | uint32_t gws_base; |
| 201 | uint32_t gws_size; |
| 202 | uint32_t oa_base; |
| 203 | uint32_t oa_size; |
| 204 | }; |
| 205 | |
Christian König | 7645670 | 2017-04-06 17:52:39 +0200 | [diff] [blame] | 206 | struct amdgpu_vm_id_manager { |
| 207 | struct mutex lock; |
| 208 | unsigned num_ids; |
| 209 | struct list_head ids_lru; |
| 210 | struct amdgpu_vm_id ids[AMDGPU_NUM_VM]; |
Chunming Zhou | c350577 | 2017-04-21 15:51:04 +0800 | [diff] [blame] | 211 | atomic_t reserved_vmid_num; |
Christian König | 7645670 | 2017-04-06 17:52:39 +0200 | [diff] [blame] | 212 | }; |
| 213 | |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 214 | struct amdgpu_vm_manager { |
| 215 | /* Handling of VMIDs */ |
Christian König | 7645670 | 2017-04-06 17:52:39 +0200 | [diff] [blame] | 216 | struct amdgpu_vm_id_manager id_mgr[AMDGPU_MAX_VMHUBS]; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 217 | |
| 218 | /* Handling of VM fences */ |
| 219 | u64 fence_context; |
| 220 | unsigned seqno[AMDGPU_MAX_RINGS]; |
| 221 | |
Felix Kuehling | 22770e5 | 2017-03-28 20:24:53 -0400 | [diff] [blame] | 222 | uint64_t max_pfn; |
Christian König | 8437a09 | 2016-10-17 15:08:10 +0200 | [diff] [blame] | 223 | uint32_t num_level; |
Zhang, Jerry | 36b32a6 | 2017-03-29 16:08:32 +0800 | [diff] [blame] | 224 | uint64_t vm_size; |
| 225 | uint32_t block_size; |
Roger He | e618d30 | 2017-08-11 20:00:41 +0800 | [diff] [blame] | 226 | uint32_t fragment_size; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 227 | /* vram base address for page table entry */ |
| 228 | u64 vram_base_offset; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 229 | /* vm pte handling */ |
| 230 | const struct amdgpu_vm_pte_funcs *vm_pte_funcs; |
| 231 | struct amdgpu_ring *vm_pte_rings[AMDGPU_MAX_RINGS]; |
| 232 | unsigned vm_pte_num_rings; |
| 233 | atomic_t vm_pte_next_ring; |
| 234 | /* client id counter */ |
| 235 | atomic64_t client_counter; |
Christian König | 284710f | 2017-01-30 11:09:31 +0100 | [diff] [blame] | 236 | |
| 237 | /* partial resident texture handling */ |
| 238 | spinlock_t prt_lock; |
Christian König | 451bc8e | 2017-02-14 16:02:52 +0100 | [diff] [blame] | 239 | atomic_t num_prt_users; |
Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 240 | |
| 241 | /* controls how VM page tables are updated for Graphics and Compute. |
| 242 | * BIT0[= 0] Graphics updated by SDMA [= 1] by CPU |
| 243 | * BIT1[= 0] Compute updated by SDMA [= 1] by CPU |
| 244 | */ |
| 245 | int vm_update_mode; |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 246 | |
| 247 | /* PASID to VM mapping, will be used in interrupt context to |
| 248 | * look up VM of a page fault |
| 249 | */ |
| 250 | struct idr pasid_idr; |
| 251 | spinlock_t pasid_lock; |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 252 | }; |
| 253 | |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 254 | int amdgpu_vm_alloc_pasid(unsigned int bits); |
| 255 | void amdgpu_vm_free_pasid(unsigned int pasid); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 256 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); |
| 257 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); |
Harish Kasiviswanathan | 9a4b7d4 | 2017-06-09 11:26:57 -0400 | [diff] [blame] | 258 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
Felix Kuehling | 0220844 | 2017-08-25 20:40:26 -0400 | [diff] [blame] | 259 | int vm_context, unsigned int pasid); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 260 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); |
Felix Kuehling | c98171c | 2017-09-21 16:26:41 -0400 | [diff] [blame] | 261 | bool amdgpu_vm_pasid_fault_credit(struct amdgpu_device *adev, |
| 262 | unsigned int pasid); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 263 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, |
| 264 | struct list_head *validated, |
| 265 | struct amdgpu_bo_list_entry *entry); |
Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 266 | bool amdgpu_vm_ready(struct amdgpu_vm *vm); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 267 | int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
| 268 | int (*callback)(void *p, struct amdgpu_bo *bo), |
| 269 | void *param); |
Christian König | 663e457 | 2017-03-13 10:13:37 +0100 | [diff] [blame] | 270 | int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, |
| 271 | struct amdgpu_vm *vm, |
| 272 | uint64_t saddr, uint64_t size); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 273 | int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, |
Dave Airlie | 220196b | 2016-10-28 11:33:52 +1000 | [diff] [blame] | 274 | struct amdgpu_sync *sync, struct dma_fence *fence, |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 275 | struct amdgpu_job *job); |
Monk Liu | 8fdf074 | 2017-06-06 17:25:13 +0800 | [diff] [blame] | 276 | int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync); |
Christian König | 7645670 | 2017-04-06 17:52:39 +0200 | [diff] [blame] | 277 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vmhub, |
| 278 | unsigned vmid); |
Christian König | 32601d4 | 2017-05-10 20:06:58 +0200 | [diff] [blame] | 279 | void amdgpu_vm_reset_all_ids(struct amdgpu_device *adev); |
Christian König | 194d216 | 2016-10-12 15:13:52 +0200 | [diff] [blame] | 280 | int amdgpu_vm_update_directories(struct amdgpu_device *adev, |
| 281 | struct amdgpu_vm *vm); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 282 | int amdgpu_vm_clear_freed(struct amdgpu_device *adev, |
Nicolai Hähnle | f346781 | 2017-03-23 19:36:31 +0100 | [diff] [blame] | 283 | struct amdgpu_vm *vm, |
| 284 | struct dma_fence **fence); |
Christian König | 73fb16e | 2017-08-16 11:13:48 +0200 | [diff] [blame] | 285 | int amdgpu_vm_handle_moved(struct amdgpu_device *adev, |
Christian König | 4e55eb3 | 2017-09-11 16:54:59 +0200 | [diff] [blame] | 286 | struct amdgpu_vm *vm); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 287 | int amdgpu_vm_bo_update(struct amdgpu_device *adev, |
| 288 | struct amdgpu_bo_va *bo_va, |
| 289 | bool clear); |
| 290 | void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, |
Christian König | 3f3333f | 2017-08-03 14:02:13 +0200 | [diff] [blame] | 291 | struct amdgpu_bo *bo, bool evicted); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 292 | struct amdgpu_bo_va *amdgpu_vm_bo_find(struct amdgpu_vm *vm, |
| 293 | struct amdgpu_bo *bo); |
| 294 | struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, |
| 295 | struct amdgpu_vm *vm, |
| 296 | struct amdgpu_bo *bo); |
| 297 | int amdgpu_vm_bo_map(struct amdgpu_device *adev, |
| 298 | struct amdgpu_bo_va *bo_va, |
| 299 | uint64_t addr, uint64_t offset, |
Christian König | 268c300 | 2017-01-18 14:49:43 +0100 | [diff] [blame] | 300 | uint64_t size, uint64_t flags); |
Christian König | 80f95c5 | 2017-03-13 10:13:39 +0100 | [diff] [blame] | 301 | int amdgpu_vm_bo_replace_map(struct amdgpu_device *adev, |
| 302 | struct amdgpu_bo_va *bo_va, |
| 303 | uint64_t addr, uint64_t offset, |
| 304 | uint64_t size, uint64_t flags); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 305 | int amdgpu_vm_bo_unmap(struct amdgpu_device *adev, |
| 306 | struct amdgpu_bo_va *bo_va, |
| 307 | uint64_t addr); |
Christian König | dc54d3d | 2017-03-13 10:13:38 +0100 | [diff] [blame] | 308 | int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, |
| 309 | struct amdgpu_vm *vm, |
| 310 | uint64_t saddr, uint64_t size); |
Christian König | aebc5e6 | 2017-09-06 16:55:16 +0200 | [diff] [blame] | 311 | struct amdgpu_bo_va_mapping *amdgpu_vm_bo_lookup_mapping(struct amdgpu_vm *vm, |
| 312 | uint64_t addr); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 313 | void amdgpu_vm_bo_rmv(struct amdgpu_device *adev, |
| 314 | struct amdgpu_bo_va *bo_va); |
Roger He | d07f14b | 2017-08-15 16:05:59 +0800 | [diff] [blame] | 315 | void amdgpu_vm_set_fragment_size(struct amdgpu_device *adev, |
| 316 | uint32_t fragment_size_default); |
| 317 | void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint64_t vm_size, |
| 318 | uint32_t fragment_size_default); |
Chunming Zhou | cfbcacf | 2017-04-24 11:09:04 +0800 | [diff] [blame] | 319 | 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] | 320 | bool amdgpu_vm_need_pipeline_sync(struct amdgpu_ring *ring, |
| 321 | struct amdgpu_job *job); |
Alex Xie | e59c020 | 2017-06-01 09:42:59 -0400 | [diff] [blame] | 322 | void amdgpu_vm_check_compute_bug(struct amdgpu_device *adev); |
Christian König | 073440d | 2016-09-28 15:41:50 +0200 | [diff] [blame] | 323 | |
| 324 | #endif |