Merge tag 'amd-drm-next-5.14-2021-06-02' of https://gitlab.freedesktop.org/agd5f...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ttm.c
index 8625943..832970c 100644 (file)
@@ -166,25 +166,6 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
        *placement = abo->placement;
 }
 
-/**
- * amdgpu_verify_access - Verify access for a mmap call
- *
- * @bo:        The buffer object to map
- * @filp: The file pointer from the process performing the mmap
- *
- * This is called by ttm_bo_mmap() to verify whether a process
- * has the right to mmap a BO to their process space.
- */
-static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
-{
-       struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
-
-       if (amdgpu_ttm_tt_get_usermm(bo->ttm))
-               return -EPERM;
-       return drm_vma_node_verify_access(&abo->tbo.base.vma_node,
-                                         filp->private_data);
-}
-
 /**
  * amdgpu_ttm_map_buffer - Map memory into the GART windows
  * @bo: buffer object to map
@@ -1492,7 +1473,6 @@ static struct ttm_device_funcs amdgpu_bo_driver = {
        .eviction_valuable = amdgpu_ttm_bo_eviction_valuable,
        .evict_flags = &amdgpu_evict_flags,
        .move = &amdgpu_bo_move,
-       .verify_access = &amdgpu_verify_access,
        .delete_mem_notify = &amdgpu_bo_delete_mem_notify,
        .release_notify = &amdgpu_bo_release_notify,
        .io_mem_reserve = &amdgpu_ttm_io_mem_reserve,
@@ -1809,10 +1789,6 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
        amdgpu_bo_free_kernel(&adev->mman.discovery_memory, NULL, NULL);
        amdgpu_ttm_fw_reserve_vram_fini(adev);
 
-       if (adev->mman.aper_base_kaddr)
-               iounmap(adev->mman.aper_base_kaddr);
-       adev->mman.aper_base_kaddr = NULL;
-
        amdgpu_vram_mgr_fini(adev);
        amdgpu_gtt_mgr_fini(adev);
        amdgpu_preempt_mgr_fini(adev);
@@ -1872,50 +1848,6 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)
        adev->mman.buffer_funcs_enabled = enable;
 }
 
-static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf)
-{
-       struct ttm_buffer_object *bo = vmf->vma->vm_private_data;
-       vm_fault_t ret;
-
-       ret = ttm_bo_vm_reserve(bo, vmf);
-       if (ret)
-               return ret;
-
-       ret = amdgpu_bo_fault_reserve_notify(bo);
-       if (ret)
-               goto unlock;
-
-       ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
-                                      TTM_BO_VM_NUM_PREFAULT, 1);
-       if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
-               return ret;
-
-unlock:
-       dma_resv_unlock(bo->base.resv);
-       return ret;
-}
-
-static const struct vm_operations_struct amdgpu_ttm_vm_ops = {
-       .fault = amdgpu_ttm_fault,
-       .open = ttm_bo_vm_open,
-       .close = ttm_bo_vm_close,
-       .access = ttm_bo_vm_access
-};
-
-int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma)
-{
-       struct drm_file *file_priv = filp->private_data;
-       struct amdgpu_device *adev = drm_to_adev(file_priv->minor->dev);
-       int r;
-
-       r = ttm_bo_mmap(filp, vma, &adev->mman.bdev);
-       if (unlikely(r != 0))
-               return r;
-
-       vma->vm_ops = &amdgpu_ttm_vm_ops;
-       return 0;
-}
-
 int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset,
                       uint64_t dst_offset, uint32_t byte_count,
                       struct dma_resv *resv,