From: Christian König Date: Wed, 27 May 2015 08:22:47 +0000 (+0200) Subject: drm/amdgpu: remove mclk_lock X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e176fe176d3a02d9409e0f36502799083ae13e1b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git drm/amdgpu: remove mclk_lock Not needed any more. Signed-off-by: Christian König Reviewed-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 6c8c24ba463d..4300e3d4b1cd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1558,8 +1558,6 @@ struct amdgpu_dpm { struct amdgpu_pm { struct mutex mutex; - /* write locked while reprogramming mclk */ - struct rw_semaphore mclk_lock; u32 current_sclk; u32 current_mclk; u32 default_sclk; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 175dc67130c3..36be03ce76c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1401,7 +1401,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, mutex_init(&adev->gfx.gpu_clock_mutex); mutex_init(&adev->srbm_mutex); mutex_init(&adev->grbm_idx_mutex); - init_rwsem(&adev->pm.mclk_lock); init_rwsem(&adev->exclusive_lock); mutex_init(&adev->mn_lock); hash_init(adev->mn_hash); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 62cabfb5dff8..7d801e016e31 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -272,11 +272,9 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, bo->flags = flags; amdgpu_fill_placement_to_bo(bo, placement); /* Kernel allocation are uninterruptible */ - down_read(&adev->pm.mclk_lock); r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, &bo->placement, page_align, !kernel, NULL, acc_size, sg, NULL, &amdgpu_ttm_bo_destroy); - up_read(&adev->pm.mclk_lock); if (unlikely(r != 0)) { return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 89782543f854..605a9e42f943 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -581,7 +581,6 @@ force: } mutex_lock(&adev->ddev->struct_mutex); - down_write(&adev->pm.mclk_lock); mutex_lock(&adev->ring_lock); /* update whether vce is active */ @@ -629,7 +628,6 @@ force: done: mutex_unlock(&adev->ring_lock); - up_write(&adev->pm.mclk_lock); mutex_unlock(&adev->ddev->struct_mutex); } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 729e0bb3070f..d3706a498293 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -966,52 +966,20 @@ void amdgpu_ttm_set_active_vram_size(struct amdgpu_device *adev, u64 size) man->size = size >> PAGE_SHIFT; } -static struct vm_operations_struct amdgpu_ttm_vm_ops; -static const struct vm_operations_struct *ttm_vm_ops = NULL; - -static int amdgpu_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) -{ - struct ttm_buffer_object *bo; - struct amdgpu_device *adev; - int r; - - bo = (struct ttm_buffer_object *)vma->vm_private_data; - if (bo == NULL) { - return VM_FAULT_NOPAGE; - } - adev = amdgpu_get_adev(bo->bdev); - down_read(&adev->pm.mclk_lock); - r = ttm_vm_ops->fault(vma, vmf); - up_read(&adev->pm.mclk_lock); - return r; -} - int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma) { struct drm_file *file_priv; struct amdgpu_device *adev; - int r; - if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) { + if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) return -EINVAL; - } file_priv = filp->private_data; adev = file_priv->minor->dev->dev_private; - if (adev == NULL) { + if (adev == NULL) return -EINVAL; - } - r = ttm_bo_mmap(filp, vma, &adev->mman.bdev); - if (unlikely(r != 0)) { - return r; - } - if (unlikely(ttm_vm_ops == NULL)) { - ttm_vm_ops = vma->vm_ops; - amdgpu_ttm_vm_ops = *ttm_vm_ops; - amdgpu_ttm_vm_ops.fault = &amdgpu_ttm_fault; - } - vma->vm_ops = &amdgpu_ttm_vm_ops; - return 0; + + return ttm_bo_mmap(filp, vma, &adev->mman.bdev); } int amdgpu_copy_buffer(struct amdgpu_ring *ring,