diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-10-11 02:06:48 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-10-11 02:06:48 +0000 |
commit | 4e6128626d40dea5bf234d0ad0535b226352d3cd (patch) | |
tree | 5b7d98f74fc75c58f80c205415c53a7899635d51 /sys/dev | |
parent | acc4394e058ec34b303a3ac99bb1f40ab838c834 (diff) |
drm/amdkfd: amdkfd_free_gtt_mem clear the correct pointer
From Philip Yang
30ceb873cc2e97348d9da2265b2d1ddf07f682e1 in linux-6.6.y/6.6.55
c86ad39140bbcb9dc75a10046c2221f657e8083b in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_device.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_mqd_manager.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_process.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.c index fc48de24f24..060438a6003 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -340,15 +340,15 @@ allocate_mem_reserve_bo_failed: return r; } -void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void *mem_obj) +void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj) { - struct amdgpu_bo *bo = (struct amdgpu_bo *) mem_obj; + struct amdgpu_bo **bo = (struct amdgpu_bo **) mem_obj; - amdgpu_bo_reserve(bo, true); - amdgpu_bo_kunmap(bo); - amdgpu_bo_unpin(bo); - amdgpu_bo_unreserve(bo); - amdgpu_bo_unref(&(bo)); + amdgpu_bo_reserve(*bo, true); + amdgpu_bo_kunmap(*bo); + amdgpu_bo_unpin(*bo); + amdgpu_bo_unreserve(*bo); + amdgpu_bo_unref(bo); } int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size, diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.h index 3e166f2bb25..6ea519a2b67 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.h +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -221,7 +221,7 @@ int amdgpu_amdkfd_evict_userptr(struct mmu_interval_notifier *mni, int amdgpu_amdkfd_alloc_gtt_mem(struct amdgpu_device *adev, size_t size, void **mem_obj, uint64_t *gpu_addr, void **cpu_ptr, bool mqd_gfx9); -void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void *mem_obj); +void amdgpu_amdkfd_free_gtt_mem(struct amdgpu_device *adev, void **mem_obj); int amdgpu_amdkfd_alloc_gws(struct amdgpu_device *adev, size_t size, void **mem_obj); void amdgpu_amdkfd_free_gws(struct amdgpu_device *adev, void *mem_obj); diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c index bf9c3dead46..0a103352163 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c @@ -417,7 +417,7 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p, err_create_queue: if (wptr_bo) - amdgpu_amdkfd_free_gtt_mem(dev->adev, wptr_bo); + amdgpu_amdkfd_free_gtt_mem(dev->adev, (void **)&wptr_bo); err_wptr_map_gart: err_bind_process: err_pdd: diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c index 0c94bdfadaa..9d0b0bf70ad 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c @@ -838,7 +838,7 @@ node_alloc_error: kfd_doorbell_error: kfd_gtt_sa_fini(kfd); kfd_gtt_sa_init_error: - amdgpu_amdkfd_free_gtt_mem(kfd->adev, kfd->gtt_mem); + amdgpu_amdkfd_free_gtt_mem(kfd->adev, &kfd->gtt_mem); alloc_gtt_mem_failure: dev_err(kfd_device, "device %x:%x NOT added due to errors\n", @@ -856,7 +856,7 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd) kfd_doorbell_fini(kfd); ida_destroy(&kfd->doorbell_ida); kfd_gtt_sa_fini(kfd); - amdgpu_amdkfd_free_gtt_mem(kfd->adev, kfd->gtt_mem); + amdgpu_amdkfd_free_gtt_mem(kfd->adev, &kfd->gtt_mem); } kfree(kfd); diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_device_queue_manager.c b/sys/dev/pci/drm/amd/amdkfd/kfd_device_queue_manager.c index 60d98301ef0..4d9a406925e 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -2610,7 +2610,7 @@ static void deallocate_hiq_sdma_mqd(struct kfd_node *dev, { WARN(!mqd, "No hiq sdma mqd trunk to free"); - amdgpu_amdkfd_free_gtt_mem(dev->adev, mqd->gtt_mem); + amdgpu_amdkfd_free_gtt_mem(dev->adev, &mqd->gtt_mem); } void device_queue_manager_uninit(struct device_queue_manager *dqm) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_mqd_manager.c b/sys/dev/pci/drm/amd/amdkfd/kfd_mqd_manager.c index 447829c2229..4c3f3798031 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_mqd_manager.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_mqd_manager.c @@ -223,7 +223,7 @@ void kfd_free_mqd_cp(struct mqd_manager *mm, void *mqd, struct kfd_mem_obj *mqd_mem_obj) { if (mqd_mem_obj->gtt_mem) { - amdgpu_amdkfd_free_gtt_mem(mm->dev->adev, mqd_mem_obj->gtt_mem); + amdgpu_amdkfd_free_gtt_mem(mm->dev->adev, &mqd_mem_obj->gtt_mem); kfree(mqd_mem_obj); } else { kfd_gtt_sa_free(mm->dev, mqd_mem_obj); diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c index d98e45aec76..43f520b3796 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_process.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process.c @@ -1047,7 +1047,7 @@ static void kfd_process_destroy_pdds(struct kfd_process *p) if (pdd->dev->kfd->shared_resources.enable_mes) amdgpu_amdkfd_free_gtt_mem(pdd->dev->adev, - pdd->proc_ctx_bo); + &pdd->proc_ctx_bo); /* * before destroying pdd, make sure to report availability * for auto suspend diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c index 8aca92624a7..dbc75ca8437 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c @@ -199,9 +199,9 @@ static void pqm_clean_queue_resource(struct process_queue_manager *pqm, } if (dev->kfd->shared_resources.enable_mes) { - amdgpu_amdkfd_free_gtt_mem(dev->adev, pqn->q->gang_ctx_bo); + amdgpu_amdkfd_free_gtt_mem(dev->adev, &pqn->q->gang_ctx_bo); if (pqn->q->wptr_bo) - amdgpu_amdkfd_free_gtt_mem(dev->adev, pqn->q->wptr_bo); + amdgpu_amdkfd_free_gtt_mem(dev->adev, (void **)&pqn->q->wptr_bo); } } |