diff options
author | Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> | 2017-06-09 11:26:57 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-06-09 11:29:38 -0400 |
commit | 9a4b7d4c769e7513dec8f441de1f521ec4ead4b6 (patch) | |
tree | 2484bc22632c27cba01ef82389ce8c82840d7181 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |
parent | b58c11314a1706bf094c489ef5cb28f76478c704 (diff) |
drm/amdgpu: Add vm context module param
Add VM update mode module param (amdgpu.vm_update_mode) that can used to
control how VM pde/pte are updated for Graphics and Compute.
BIT0 controls Graphics and BIT1 Compute.
BIT0 [= 0] Graphics updated by SDMA [= 1] by CPU
BIT1 [= 0] Compute updated by SDMA [= 1] by CPU
By default, only for large BAR system vm_update_mode = 2, indicating
that Graphics VMs will be updated via SDMA and Compute VMs will be
updated via CPU. And for all all other systems (by default)
vm_update_mode = 0
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.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.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index f5dba9cea587..936f158bc5ec 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | |||
@@ -87,6 +87,14 @@ struct amdgpu_bo_list_entry; | |||
87 | /* max vmids dedicated for process */ | 87 | /* max vmids dedicated for process */ |
88 | #define AMDGPU_VM_MAX_RESERVED_VMID 1 | 88 | #define AMDGPU_VM_MAX_RESERVED_VMID 1 |
89 | 89 | ||
90 | #define AMDGPU_VM_CONTEXT_GFX 0 | ||
91 | #define AMDGPU_VM_CONTEXT_COMPUTE 1 | ||
92 | |||
93 | /* See vm_update_mode */ | ||
94 | #define AMDGPU_VM_USE_CPU_FOR_GFX (1 << 0) | ||
95 | #define AMDGPU_VM_USE_CPU_FOR_COMPUTE (1 << 1) | ||
96 | |||
97 | |||
90 | struct amdgpu_vm_pt { | 98 | struct amdgpu_vm_pt { |
91 | struct amdgpu_bo *bo; | 99 | struct amdgpu_bo *bo; |
92 | uint64_t addr; | 100 | uint64_t addr; |
@@ -129,6 +137,9 @@ struct amdgpu_vm { | |||
129 | struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; | 137 | struct amdgpu_vm_id *reserved_vmid[AMDGPU_MAX_VMHUBS]; |
130 | /* each VM will map on CSA */ | 138 | /* each VM will map on CSA */ |
131 | struct amdgpu_bo_va *csa_bo_va; | 139 | struct amdgpu_bo_va *csa_bo_va; |
140 | |||
141 | /* Flag to indicate if VM tables are updated by CPU or GPU (SDMA) */ | ||
142 | bool use_cpu_for_update; | ||
132 | }; | 143 | }; |
133 | 144 | ||
134 | struct amdgpu_vm_id { | 145 | struct amdgpu_vm_id { |
@@ -184,11 +195,18 @@ struct amdgpu_vm_manager { | |||
184 | /* partial resident texture handling */ | 195 | /* partial resident texture handling */ |
185 | spinlock_t prt_lock; | 196 | spinlock_t prt_lock; |
186 | atomic_t num_prt_users; | 197 | atomic_t num_prt_users; |
198 | |||
199 | /* controls how VM page tables are updated for Graphics and Compute. | ||
200 | * BIT0[= 0] Graphics updated by SDMA [= 1] by CPU | ||
201 | * BIT1[= 0] Compute updated by SDMA [= 1] by CPU | ||
202 | */ | ||
203 | int vm_update_mode; | ||
187 | }; | 204 | }; |
188 | 205 | ||
189 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); | 206 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); |
190 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); | 207 | void amdgpu_vm_manager_fini(struct amdgpu_device *adev); |
191 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm); | 208 | int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
209 | int vm_context); | ||
192 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); | 210 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm); |
193 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, | 211 | void amdgpu_vm_get_pd_bo(struct amdgpu_vm *vm, |
194 | struct list_head *validated, | 212 | struct list_head *validated, |