Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9a1f0b4 authored by David Herrmann's avatar David Herrmann Committed by Daniel Vetter
Browse files

drm: use drm_file to tag vm-bos



Rather than using "struct file*", use "struct drm_file*" as tag VM tag for
BOs. This will pave the way for "struct drm_file*" without any "struct
file*" back-pointer.

Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160901124837.680-3-dh.herrmann@gmail.com
parent 75ae95a7
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -226,7 +226,8 @@ static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)


	if (amdgpu_ttm_tt_get_usermm(bo->ttm))
	if (amdgpu_ttm_tt_get_usermm(bo->ttm))
		return -EPERM;
		return -EPERM;
	return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp);
	return drm_vma_node_verify_access(&rbo->gem_base.vma_node,
					  filp->private_data);
}
}


static void amdgpu_move_null(struct ttm_buffer_object *bo,
static void amdgpu_move_null(struct ttm_buffer_object *bo,
+2 −1
Original line number Original line Diff line number Diff line
@@ -150,7 +150,8 @@ static int ast_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
{
{
	struct ast_bo *astbo = ast_bo(bo);
	struct ast_bo *astbo = ast_bo(bo);


	return drm_vma_node_verify_access(&astbo->gem.vma_node, filp);
	return drm_vma_node_verify_access(&astbo->gem.vma_node,
					  filp->private_data);
}
}


static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+2 −1
Original line number Original line Diff line number Diff line
@@ -128,7 +128,8 @@ static int bochs_bo_verify_access(struct ttm_buffer_object *bo,
{
{
	struct bochs_bo *bochsbo = bochs_bo(bo);
	struct bochs_bo *bochsbo = bochs_bo(bo);


	return drm_vma_node_verify_access(&bochsbo->gem.vma_node, filp);
	return drm_vma_node_verify_access(&bochsbo->gem.vma_node,
					  filp->private_data);
}
}


static int bochs_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
static int bochs_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+2 −1
Original line number Original line Diff line number Diff line
@@ -150,7 +150,8 @@ static int cirrus_bo_verify_access(struct ttm_buffer_object *bo, struct file *fi
{
{
	struct cirrus_bo *cirrusbo = cirrus_bo(bo);
	struct cirrus_bo *cirrusbo = cirrus_bo(bo);


	return drm_vma_node_verify_access(&cirrusbo->gem.vma_node, filp);
	return drm_vma_node_verify_access(&cirrusbo->gem.vma_node,
					  filp->private_data);
}
}


static int cirrus_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
static int cirrus_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+4 −4
Original line number Original line Diff line number Diff line
@@ -257,7 +257,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)


	if (drm_core_check_feature(dev, DRIVER_PRIME))
	if (drm_core_check_feature(dev, DRIVER_PRIME))
		drm_gem_remove_prime_handles(obj, file_priv);
		drm_gem_remove_prime_handles(obj, file_priv);
	drm_vma_node_revoke(&obj->vma_node, file_priv->filp);
	drm_vma_node_revoke(&obj->vma_node, file_priv);


	if (dev->driver->gem_close_object)
	if (dev->driver->gem_close_object)
		dev->driver->gem_close_object(obj, file_priv);
		dev->driver->gem_close_object(obj, file_priv);
@@ -372,7 +372,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,


	handle = ret;
	handle = ret;


	ret = drm_vma_node_allow(&obj->vma_node, file_priv->filp);
	ret = drm_vma_node_allow(&obj->vma_node, file_priv);
	if (ret)
	if (ret)
		goto err_remove;
		goto err_remove;


@@ -386,7 +386,7 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
	return 0;
	return 0;


err_revoke:
err_revoke:
	drm_vma_node_revoke(&obj->vma_node, file_priv->filp);
	drm_vma_node_revoke(&obj->vma_node, file_priv);
err_remove:
err_remove:
	spin_lock(&file_priv->table_lock);
	spin_lock(&file_priv->table_lock);
	idr_remove(&file_priv->object_idr, handle);
	idr_remove(&file_priv->object_idr, handle);
@@ -991,7 +991,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
	if (!obj)
	if (!obj)
		return -EINVAL;
		return -EINVAL;


	if (!drm_vma_node_is_allowed(node, filp)) {
	if (!drm_vma_node_is_allowed(node, priv)) {
		drm_gem_object_unreference_unlocked(obj);
		drm_gem_object_unreference_unlocked(obj);
		return -EACCES;
		return -EACCES;
	}
	}
Loading