diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index edd2ea52dc00..78296d1a5b2f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "amdgpu_sync.h" | 32 | #include "amdgpu_sync.h" |
33 | #include "amdgpu_ring.h" | 33 | #include "amdgpu_ring.h" |
34 | #include "amdgpu_ids.h" | ||
34 | 35 | ||
35 | struct amdgpu_bo_va; | 36 | struct amdgpu_bo_va; |
36 | struct amdgpu_job; | 37 | struct amdgpu_job; |
@@ -40,9 +41,6 @@ struct amdgpu_bo_list_entry; | |||
40 | * GPUVM handling | 41 | * GPUVM handling |
41 | */ | 42 | */ |
42 | 43 | ||
43 | /* maximum number of VMIDs */ | ||
44 | #define AMDGPU_NUM_VM 16 | ||
45 | |||
46 | /* Maximum number of PTEs the hardware can write with one command */ | 44 | /* Maximum number of PTEs the hardware can write with one command */ |
47 | #define AMDGPU_VM_MAX_UPDATE_SIZE 0x3FFFF | 45 | #define AMDGPU_VM_MAX_UPDATE_SIZE 0x3FFFF |
48 | 46 | ||
@@ -197,7 +195,7 @@ struct amdgpu_vm { | |||
197 | u64 client_id; | 195 | u64 client_id; |
198 | unsigned int pasid; | 196 | unsigned int pasid; |
199 | /* dedicated to vm */ | 197 | /* dedicated to vm */ |
200 | struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; | 198 | struct amdgpu_vmid *reserved_vmid[AMDGPU_MAX_VMHUBS]; |
201 | 199 | ||
202 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ | 200 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ |
203 | bool use_cpu_for_update; | 201 | bool use_cpu_for_update; |
@@ -212,37 +210,9 @@ struct amdgpu_vm { | |||
212 | unsigned int fault_credit; | 210 | unsigned int fault_credit; |
213 | }; | 211 | }; |
214 | 212 | ||
215 | struct amdgpu_vm_id { | ||
216 | struct list_head list; | ||
217 | struct amdgpu_sync active; | ||
218 | struct dma_fence *last_flush; | ||
219 | atomic64_t owner; | ||
220 | |||
221 | uint64_t pd_gpu_addr; | ||
222 | /* last flushed PD/PT update */ | ||
223 | struct dma_fence *flushed_updates; | ||
224 | |||
225 | uint32_t current_gpu_reset_count; | ||
226 | |||
227 | uint32_t gds_base; | ||
228 | uint32_t gds_size; | ||
229 | uint32_t gws_base; | ||
230 | uint32_t gws_size; | ||
231 | uint32_t oa_base; | ||
232 | uint32_t oa_size; | ||
233 | }; | ||
234 | |||
235 | struct amdgpu_vm_id_manager { | ||
236 | struct mutex lock; | ||
237 | unsigned num_ids; | ||
238 | struct list_head ids_lru; | ||
239 | struct amdgpu_vm_id ids[AMDGPU_NUM_VM]; | ||
240 | atomic_t reserved_vmid_num; | ||
241 | }; | ||
242 | |||
243 | struct amdgpu_vm_manager { | 213 | struct amdgpu_vm_manager { |
244 | /* Handling of VMIDs */ | 214 | /* Handling of VMIDs */ |
245 | struct amdgpu_vm_id_manager id_mgr[AMDGPU_MAX_VMHUBS]; | 215 | struct amdgpu_vmid_mgr id_mgr[AMDGPU_MAX_VMHUBS]; |
246 | 216 | ||
247 | /* Handling of VM fences */ | 217 | /* Handling of VM fences */ |
248 | u64 fence_context; | 218 | u64 fence_context; |
@@ -280,8 +250,6 @@ struct amdgpu_vm_manager { | |||
280 | spinlock_t pasid_lock; | 250 | spinlock_t pasid_lock; |
281 | }; | 251 | }; |
282 | 252 | ||
283 | int amdgpu_vm_alloc_pasid(unsigned int bits); | ||
284 | void amdgpu_vm_free_pasid(unsigned int pasid); | ||
285 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); | 253 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); |
286 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); | 254 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); |
287 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 255 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
@@ -299,13 +267,7 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
299 | int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, | 267 | int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, |
300 | struct amdgpu_vm *vm, | 268 | struct amdgpu_vm *vm, |
301 | uint64_t saddr, uint64_t size); | 269 | uint64_t saddr, uint64_t size); |
302 | int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | ||
303 | struct amdgpu_sync *sync, struct dma_fence *fence, | ||
304 | struct amdgpu_job *job); | ||
305 | int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync); | 270 | int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync); |
306 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vmhub, | ||
307 | unsigned vmid); | ||
308 | void amdgpu_vm_reset_all_ids(struct amdgpu_device *adev); | ||
309 | int amdgpu_vm_update_directories(struct amdgpu_device *adev, | 271 | int amdgpu_vm_update_directories(struct amdgpu_device *adev, |
310 | struct amdgpu_vm *vm); | 272 | struct amdgpu_vm *vm); |
311 | int amdgpu_vm_clear_freed(struct amdgpu_device *adev, | 273 | int amdgpu_vm_clear_freed(struct amdgpu_device *adev, |