mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-03 11:13:56 +08:00
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>
This commit is contained in:
parent
e18e794e6b
commit
73a1da0bb3
@ -193,7 +193,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|||||||
/* add another 512KB for all other allocations on gart (HPD, fences) */
|
/* add another 512KB for all other allocations on gart (HPD, fences) */
|
||||||
size += 512 * 1024;
|
size += 512 * 1024;
|
||||||
|
|
||||||
if (kfd2kgd->init_sa_manager(kfd->kgd, size)) {
|
if (kfd2kgd->init_gtt_mem_allocation(kfd->kgd, size, &kfd->gtt_mem,
|
||||||
|
&kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr)) {
|
||||||
dev_err(kfd_device,
|
dev_err(kfd_device,
|
||||||
"Could not allocate %d bytes for device (%x:%x)\n",
|
"Could not allocate %d bytes for device (%x:%x)\n",
|
||||||
size, kfd->pdev->vendor, kfd->pdev->device);
|
size, kfd->pdev->vendor, kfd->pdev->device);
|
||||||
@ -204,6 +205,13 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
|
|||||||
"Allocated %d bytes on gart for device(%x:%x)\n",
|
"Allocated %d bytes on gart for device(%x:%x)\n",
|
||||||
size, kfd->pdev->vendor, kfd->pdev->device);
|
size, kfd->pdev->vendor, kfd->pdev->device);
|
||||||
|
|
||||||
|
/* Initialize GTT sa with 512 byte chunk size */
|
||||||
|
if (kfd_gtt_sa_init(kfd, size, 512) != 0) {
|
||||||
|
dev_err(kfd_device,
|
||||||
|
"Error initializing gtt sub-allocator\n");
|
||||||
|
goto kfd_gtt_sa_init_error;
|
||||||
|
}
|
||||||
|
|
||||||
kfd_doorbell_init(kfd);
|
kfd_doorbell_init(kfd);
|
||||||
|
|
||||||
if (kfd_topology_add_device(kfd) != 0) {
|
if (kfd_topology_add_device(kfd) != 0) {
|
||||||
@ -262,7 +270,9 @@ device_iommu_pasid_error:
|
|||||||
kfd_interrupt_error:
|
kfd_interrupt_error:
|
||||||
kfd_topology_remove_device(kfd);
|
kfd_topology_remove_device(kfd);
|
||||||
kfd_topology_add_device_error:
|
kfd_topology_add_device_error:
|
||||||
kfd2kgd->fini_sa_manager(kfd->kgd);
|
kfd_gtt_sa_fini(kfd);
|
||||||
|
kfd_gtt_sa_init_error:
|
||||||
|
kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem);
|
||||||
dev_err(kfd_device,
|
dev_err(kfd_device,
|
||||||
"device (%x:%x) NOT added due to errors\n",
|
"device (%x:%x) NOT added due to errors\n",
|
||||||
kfd->pdev->vendor, kfd->pdev->device);
|
kfd->pdev->vendor, kfd->pdev->device);
|
||||||
@ -277,6 +287,8 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)
|
|||||||
amd_iommu_free_device(kfd->pdev);
|
amd_iommu_free_device(kfd->pdev);
|
||||||
kfd_interrupt_exit(kfd);
|
kfd_interrupt_exit(kfd);
|
||||||
kfd_topology_remove_device(kfd);
|
kfd_topology_remove_device(kfd);
|
||||||
|
kfd_gtt_sa_fini(kfd);
|
||||||
|
kfd2kgd->free_gtt_mem(kfd->kgd, kfd->gtt_mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(kfd);
|
kfree(kfd);
|
||||||
|
Loading…
Reference in New Issue
Block a user