aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
diff options
context:
space:
mode:
authorFelix Kuehling <Felix.Kuehling@amd.com>2017-08-25 20:40:26 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-26 13:07:02 -0400
commit02208441cc3a5110191996bb129db39ff10e7395 (patch)
treebb228597c2413583efc368295dcb2b5ad173b135 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
parentca290da8f6345c8e8e180256fbe092c751fa9654 (diff)
drm/amdgpu: Add PASID management
Allows assigning a PASID to a VM for identifying VMs involved in page faults. The global PASID manager is also exported in the KFD interface so that AMDGPU and KFD can share the PASID space. PASIDs of different sizes can be requested. On APUs, the PASID size is deterined by the capabilities of the IOMMU. So KFD must be able to allocate PASIDs in a smaller range. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 48c58ae4bb3a..7873dfa8c0f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -25,6 +25,7 @@
25#define __AMDGPU_VM_H__ 25#define __AMDGPU_VM_H__
26 26
27#include <linux/rbtree.h> 27#include <linux/rbtree.h>
28#include <linux/idr.h>
28 29
29#include "gpu_scheduler.h" 30#include "gpu_scheduler.h"
30#include "amdgpu_sync.h" 31#include "amdgpu_sync.h"
@@ -148,8 +149,9 @@ struct amdgpu_vm {
148 /* Scheduler entity for page table updates */ 149 /* Scheduler entity for page table updates */
149 struct amd_sched_entity entity; 150 struct amd_sched_entity entity;
150 151
151 /* client id */ 152 /* client id and PASID (TODO: replace client_id with PASID) */
152 u64 client_id; 153 u64 client_id;
154 unsigned int pasid;
153 /* dedicated to vm */ 155 /* dedicated to vm */
154 struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; 156 struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS];
155 157
@@ -220,12 +222,20 @@ struct amdgpu_vm_manager {
220 * BIT1[= 0] Compute updated by SDMA [= 1] by CPU 222 * BIT1[= 0] Compute updated by SDMA [= 1] by CPU
221 */ 223 */
222 int vm_update_mode; 224 int vm_update_mode;
225
226 /* PASID to VM mapping, will be used in interrupt context to
227 * look up VM of a page fault
228 */
229 struct idr pasid_idr;
230 spinlock_t pasid_lock;
223}; 231};
224 232
233int amdgpu_vm_alloc_pasid(unsigned int bits);
234void amdgpu_vm_free_pasid(unsigned int pasid);
225void amdgpu_vm_manager_init(struct amdgpu_device *adev); 235void amdgpu_vm_manager_init(struct amdgpu_device *adev);
226void amdgpu_vm_manager_fini(struct amdgpu_device *adev); 236void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
227int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, 237int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
228 int vm_context); 238 int vm_context, unsigned int pasid);
229void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); 239void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
230void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, 240void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm,
231 struct list_head *validated, 241 struct list_head *validated,