aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorOded Gabbay <oded.gabbay@amd.com>2014-10-26 03:53:37 -0400
committerOded Gabbay <oded.gabbay@amd.com>2015-01-09 15:26:09 -0500
commit73a1da0bb3b32a552817c57dcaebef09bd2f3677 (patch)
treeb50fbaf1d4984ca46bee3781f5490b2c335d019d /drivers/gpu
parente18e794e6ba02e94edb386e6fcd4217773cb0ac8 (diff)
drm/amdkfd: Allocate gart memory using new interface
This patch changes the calls to allocate the gart memory for amdkfd from the old interface (radeon_sa) to the new one (kfd_gtt_sa) The new gart sub-allocator is initialized with chunk size equal to 512 bytes. This is because the KV MQD is 512 Bytes and most of the sub-allocations are MQDs. Signed-off-by: Oded Gabbay <oded.gabbay@amd.com> Reviewed-by: Alexey Skidanov <Alexey.skidanov@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index fdc7dff2bfa0..994a9c1bdd04 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -193,7 +193,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
193 /* add another 512KB for all other allocations on gart (HPD, fences) */ 193 /* add another 512KB for all other allocations on gart (HPD, fences) */
194 size += 512 * 1024; 194 size += 512 * 1024;
195 195
196 if (kfd2kgd->init_sa_manager(kfd->kgd, size)) { 196 if (kfd2kgd->init_gtt_mem_allocation(kfd->kgd, size, &kfd->gtt_mem,
197 &kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)) {
197 dev_err(kfd_device, 198 dev_err(kfd_device,
198 "Could not allocate %d bytes for device (%x:%x)\n", 199 "Could not allocate %d bytes for device (%x:%x)\n",
199 size, kfd->pdev->vendor, kfd->pdev->device); 200 size, kfd->pdev->vendor, kfd->pdev->device);
@@ -204,6 +205,13 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
204 "Allocated %d bytes on gart for device(%x:%x)\n", 205 "Allocated %d bytes on gart for device(%x:%x)\n",
205 size, kfd->pdev->vendor, kfd->pdev->device); 206 size, kfd->pdev->vendor, kfd->pdev->device);
206 207
208 /* Initialize GTT sa with 512 byte chunk size */
209 if (kfd_gtt_sa_init(kfd, size, 512) != 0) {
210 dev_err(kfd_device,
211 "Error initializing gtt sub-allocator\n");
212 goto kfd_gtt_sa_init_error;
213 }
214
207 kfd_doorbell_init(kfd); 215 kfd_doorbell_init(kfd);
208 216
209 if (kfd_topology_add_device(kfd) != 0) { 217 if (kfd_topology_add_device(kfd) != 0) {
@@ -262,7 +270,9 @@ device_iommu_pasid_error:
262kfd_interrupt_error: 270kfd_interrupt_error:
263 kfd_topology_remove_device(kfd); 271 kfd_topology_remove_device(kfd);
264kfd_topology_add_device_error: 272kfd_topology_add_device_error:
265 kfd2kgd->fini_sa_manager(kfd->kgd); 273 kfd_gtt_sa_fini(kfd);
274kfd_gtt_sa_init_error:
275 kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem);
266 dev_err(kfd_device, 276 dev_err(kfd_device,
267 "device (%x:%x) NOT added due to errors\n", 277 "device (%x:%x) NOT added due to errors\n",
268 kfd->pdev->vendor, kfd->pdev->device); 278 kfd->pdev->vendor, kfd->pdev->device);
@@ -277,6 +287,8 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)
277 amd_iommu_free_device(kfd->pdev); 287 amd_iommu_free_device(kfd->pdev);
278 kfd_interrupt_exit(kfd); 288 kfd_interrupt_exit(kfd);
279 kfd_topology_remove_device(kfd); 289 kfd_topology_remove_device(kfd);
290 kfd_gtt_sa_fini(kfd);
291 kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem);
280 } 292 }
281 293
282 kfree(kfd); 294 kfree(kfd);