From 40627be2ec8fbe7f0e2d34494c840a669fdca869 Mon Sep 17 00:00:00 2001 From: Kalyan Alle Date: Wed, 26 Sep 2018 18:27:52 +0530 Subject: [PATCH 4681/5725] drm/amd/amdgpu: Removing unwanted code from the below files Removing the unwanted code : 1. Some of the structure members removed are not used in the code 2. amdgpu_gem_prime_foreign_bo is not used anywhere in the amdgpu driver code 3. amdgpu_ttm_bind , not used in the code. Signed-off-by: Kalyan Alle --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 --- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 40 ------------------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 ------ drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 3 +-- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +- 9 files changed, 2 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index ad566b7..c55e675 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1675,8 +1675,6 @@ struct amdgpu_device { u8 reset_magic[AMDGPU_RESET_MAGIC_NUM]; - spinlock_t tlb_invalidation_lock; - /* record last mm index being written through WREG32*/ unsigned long last_mm_index; bool in_gpu_reset; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index d89d43e..a1d52c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -56,7 +56,6 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, struct reservation_object *resv, struct drm_gem_object **obj) { - struct amdgpu_bo *robj; struct amdgpu_bo *bo; unsigned long max_size; struct amdgpu_bo_param bp; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 40e7b42..8505ad3 100755 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -88,9 +88,6 @@ struct amdgpu_bo { void *metadata; u32 metadata_size; unsigned prime_shared_count; - /* GEM objects refereing to this BO */ - struct list_head gem_objects; - /* list of all virtual address to which this bo is associated to */ struct list_head va; /* Constant after initialization */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index 5472366..37bd4f3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c @@ -420,43 +420,3 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, } #endif -struct drm_gem_object * -amdgpu_gem_prime_foreign_bo(struct amdgpu_device *adev, struct amdgpu_bo *bo) -{ - struct amdgpu_gem_object *gobj; - int r; - - ww_mutex_lock(&bo->tbo.resv->lock, NULL); - - list_for_each_entry(gobj, &bo->gem_objects, list) { - if (gobj->base.dev != adev->ddev) - continue; - - ww_mutex_unlock(&bo->tbo.resv->lock); - drm_gem_object_reference(&gobj->base); - return &gobj->base; - } - - - gobj = kzalloc(sizeof(struct amdgpu_gem_object), GFP_KERNEL); - if (unlikely(!gobj)) { - ww_mutex_unlock(&bo->tbo.resv->lock); - return ERR_PTR(-ENOMEM); - } - - r = drm_gem_object_init(adev->ddev, &gobj->base, amdgpu_bo_size(bo)); - if (unlikely(r)) { - kfree(gobj); - ww_mutex_unlock(&bo->tbo.resv->lock); - return ERR_PTR(r); - } - - list_add(&gobj->list, &bo->gem_objects); - gobj->bo = amdgpu_bo_ref(bo); - bo->flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; - - ww_mutex_unlock(&bo->tbo.resv->lock); - - return &gobj->base; -} - diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 905f13b..e573325 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -838,7 +838,6 @@ struct amdgpu_ttm_gup_task_list { struct amdgpu_ttm_tt { struct ttm_dma_tt ttm; - struct amdgpu_device *adev; u64 offset; uint64_t userptr; struct task_struct *usertask; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h index 265c3ed..aaf490e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h @@ -103,7 +103,6 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, struct dma_fence **fence); int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma); -int amdgpu_ttm_bind(struct ttm_buffer_object *bo); int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo); int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 57dd137..d9e3d48 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2419,14 +2419,6 @@ void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev, continue; } - /* Don't add page tables to the moved state */ - if (bo->tbo.type == ttm_bo_type_kernel) { - if (list_empty(&bo_base->vm_status)) - list_add(&bo_base->vm_status, &vm->relocated); - - continue; - } - if (was_moved) continue; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 7b63823..77350cd 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -1746,7 +1746,7 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev) DRM_ERROR("amdgpu: fence wait failed (%d).\n", r); goto fail; } -#if 0 + tmp = REG_SET_FIELD(tmp, GB_EDC_MODE, DED_MODE, 2); tmp = REG_SET_FIELD(tmp, GB_EDC_MODE, PROP_FED, 1); WREG32(mmGB_EDC_MODE, tmp); @@ -1754,7 +1754,6 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev) tmp = RREG32(mmCC_GC_EDC_CONFIG); tmp = REG_SET_FIELD(tmp, CC_GC_EDC_CONFIG, DIS_EDC, 0) | 1; WREG32(mmCC_GC_EDC_CONFIG, tmp); -#endif /* read back registers to clear the counters */ for (i = 0; i < ARRAY_SIZE(sec_ded_counter_registers); i++) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 89176ec..56c1230 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1870,7 +1870,7 @@ static int kfd_create_cma_system_bo(struct kfd_dev *kdev, struct kfd_bo *bo, INIT_LIST_HEAD(&cbo->list); if (bo->mem_type == KFD_IOC_ALLOC_MEM_FLAGS_VRAM) - bo_size = min(*size, MAX_SYSTEM_BO_SIZE); + bo_size = min_t(uint64_t, *size, MAX_SYSTEM_BO_SIZE); else if (bo->cpuva) { ret = kfd_create_sg_table_from_userptr_bo(bo, offset, cma_write, mm, task, -- 2.7.4