From 5822e5bef5f8984d1cff6911abb4437217d77e0b Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Tue, 4 Oct 2016 13:11:09 -0400 Subject: [PATCH 1196/4131] drm/amdkfd: Delete obsolete code The code is never used at all, and sometimes distracts us. Change-Id: I5687fa5fb3f6c8c3401f92346b0958fcda0fcff0 Signed-off-by: Yong Zhao --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 23 ------ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 10 --- drivers/gpu/drm/amd/amdkfd/kfd_module.c | 2 - drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 8 --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 116 ------------------------------- 5 files changed, 159 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index c3e54d9..5e206e4 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -47,7 +47,6 @@ static uint32_t kfd_convert_user_mem_alloction_flags( uint32_t userspace_flags); static bool kfd_is_large_bar(struct kfd_dev *dev); -static int kfd_evict(struct file *filep, struct kfd_process *p, void *data); static const char kfd_dev_name[] = "kfd"; static const struct file_operations kfd_fops = { @@ -1436,7 +1435,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, long err = 0; int i, num_dev; uint32_t *devices_arr = NULL; - int bo_size; dev = kfd_device_by_id(GET_GPU_ID(args->handle)); if (dev == NULL) @@ -1507,11 +1505,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, pr_err("amdkfd: failed to map\n"); } - bo_size = dev->kfd2kgd->return_bo_size(dev->kgd, mem); - down_write(&p->lock); - pdd->mapped_size += bo_size; - up_write(&p->lock); - if (args->device_ids_array_size > 0 && devices_arr) kfree(devices_arr); @@ -1547,7 +1540,6 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, struct kfd_dev *dev, *peer; long err = 0; uint32_t *devices_arr = NULL, num_dev, i; - int bo_size; dev = kfd_device_by_id(GET_GPU_ID(args->handle)); if (dev == NULL) @@ -1617,11 +1609,6 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, radeon_flush_tlb(dev, p->pasid); } - bo_size = dev->kfd2kgd->return_bo_size(dev->kgd, mem); - down_write(&p->lock); - pdd->mapped_size -= bo_size; - up_write(&p->lock); - return 0; bind_process_to_device_failed: @@ -1965,9 +1952,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = { AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_PROCESS_APERTURES_NEW, kfd_ioctl_get_process_apertures_new, 0), - AMDKFD_IOCTL_DEF(AMDKFD_IOC_EVICT_MEMORY, - kfd_evict, 0), - AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_DMABUF_INFO, kfd_ioctl_get_dmabuf_info, 0), @@ -1980,13 +1964,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = { #define AMDKFD_CORE_IOCTL_COUNT ARRAY_SIZE(amdkfd_ioctls) -static int kfd_evict(struct file *filep, struct kfd_process *p, void *data) -{ - struct kfd_ioctl_eviction_args *args = data; - - return evict_size(p, args->size, args->type); - -} static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { struct kfd_process *process; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 6acc5fc..ba48aca 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -616,16 +616,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd) amd_iommu_free_device(kfd->pdev); } -int kgd2kfd_evict_bo(struct kfd_dev *dev, void *mem) -{ - return evict_bo(dev, mem); -} - -int kgd2kfd_restore(struct kfd_dev *kfd) -{ - return restore(kfd); -} - int kgd2kfd_resume(struct kfd_dev *kfd) { BUG_ON(kfd == NULL); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c index 42c559b..0f6a389 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c @@ -43,8 +43,6 @@ static const struct kgd2kfd_calls kgd2kfd = { .interrupt = kgd2kfd_interrupt, .suspend = kgd2kfd_suspend, .resume = kgd2kfd_resume, - .evict_bo = kgd2kfd_evict_bo, - .restore = kgd2kfd_restore, .quiesce_mm = kgd2kfd_quiesce_mm, .resume_mm = kgd2kfd_resume_mm, .schedule_evict_and_restore_process = diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 9dea8f2..ed7f9bc 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -596,9 +596,6 @@ struct kfd_process_device { uint64_t scratch_limit; uint64_t dgpu_base; uint64_t dgpu_limit; - uint64_t mapped_size; - uint64_t last_eviction; - bool evicted; uint64_t sh_hidden_private_base_vmid; @@ -957,11 +954,6 @@ void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid, void radeon_flush_tlb(struct kfd_dev *dev, uint32_t pasid); int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p); -int kgd2kfd_evict_bo(struct kfd_dev *dev, void *mem); -int kgd2kfd_restore(struct kfd_dev *kfd); -int evict_size(struct kfd_process *p, int size, int type); -int evict_bo(struct kfd_dev *dev, void *mem); -int restore(struct kfd_dev *kfd); #define KFD_SCRATCH_CZ_FW_VER 600 #define KFD_SCRATCH_KV_FW_VER 413 diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 54ed2a1..78a8cc9 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -38,7 +38,6 @@ struct mm_struct; #include "kfd_priv.h" #include "kfd_dbgmgr.h" -static int evict_pdd(struct kfd_process_device *pdd); /* * List of struct kfd_process (field kfd_process). * Unique/indexed by mm_struct* @@ -280,121 +279,6 @@ struct kfd_process *kfd_lookup_process_by_pid(struct pid *pid) return p; } -int evict_size(struct kfd_process *process, int size, int type) -{ - struct kfd_process_device *pdd, *temp_pdd = NULL; - struct kfd_process *p = process; - int temp = 0; - - down_write(&p->lock); - - if (type == EVICT_FIRST_PDD) { - - list_for_each_entry(pdd, &p->per_device_data, per_device_list) { - pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n", - pdd->dev->id, p->pasid); - if (pdd->mapped_size >= size) { - evict_pdd(pdd); - return 0; - } - - } - } else if (type == EVICT_BIGGEST_PDD) { - - list_for_each_entry(pdd, &p->per_device_data, per_device_list) { - pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n", - pdd->dev->id, p->pasid); - if (pdd->mapped_size >= temp) { - temp = pdd->mapped_size; - temp_pdd = pdd; - } - - } - if (temp_pdd->mapped_size > size) { - evict_pdd(temp_pdd); - return 0; - } - - } - up_write(&p->lock); - return 0; - -} - -int evict_bo(struct kfd_dev *dev, void *mem) -{ - struct kfd_process_device *pdd; - - pdd = dev->kfd2kgd->get_pdd_from_buffer_object(dev->kgd, - ((struct kgd_mem *)mem)); - - if (pdd) - evict_pdd(pdd); - - return 0; -} - -static int evict_pdd(struct kfd_process_device *pdd) -{ - void *mem; - int id; - - /*process_evict_queues(struct device_queue_manager *dqm, pdd->qpd)*/ - /* - * Remove all handles from idr and release appropriate - * local memory object - */ - idr_for_each_entry(&pdd->alloc_idr, mem, id) { - pdd->dev->kfd2kgd->unmap_memory_to_gpu( - pdd->dev->kgd, mem, pdd->vm); - } - pdd->last_eviction = jiffies; - pdd->mapped_size = 0; - pdd->evicted = true; - - /*flush_tlb_all();*/ - - return 0; -} - -int restore(struct kfd_dev *kfd) -{ - struct kfd_process *p = NULL; - /* TODO still working on how to get the process */ - struct kfd_process_device *pdd = kfd_get_process_device_data(kfd, p); - void *mem; - int id; - - /* need to run on all processes*/ - down_write(&p->lock); - - list_for_each_entry(pdd, &p->per_device_data, per_device_list) { - pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n", - pdd->dev->id, p->pasid); - - /* - * Remove all handles from idr and release appropriate - * local memory object - */ - if (pdd->evicted) { - idr_for_each_entry(&pdd->alloc_idr, mem, id) { - pdd->dev->kfd2kgd->map_memory_to_gpu( - pdd->dev->kgd, - mem, pdd->vm); - pdd->last_eviction = 0; - pdd->mapped_size = 0; - } - - /*process_restore_queues - * (struct device_queue_manager *dqm, pdd->qpd)*/ - } else { - pdd->evicted = false; - } - } - up_write(&p->lock); - return 0; -} - static void kfd_process_free_outstanding_kfd_bos(struct kfd_process *p) { struct kfd_process_device *pdd, *peer_pdd; -- 2.7.4