Commit 2392eec6 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amdgpu/cgs: remove import_gpu_mem



It was added for completeness, but we don't have any users
for it yet.  Daniel noted that it may be racy. Remove it.

Change-Id: I5f5546f8911a4f294008a62dc86a73f3face38d1
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 74b3112e
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
@@ -208,44 +208,6 @@ static int amdgpu_cgs_alloc_gpu_mem(void *cgs_device,
	return ret;
}

static int amdgpu_cgs_import_gpu_mem(void *cgs_device, int dmabuf_fd,
				     cgs_handle_t *handle)
{
	CGS_FUNC_ADEV;
	int r;
	uint32_t dma_handle;
	struct drm_gem_object *obj;
	struct amdgpu_bo *bo;
	struct drm_device *dev = adev->ddev;
	struct drm_file *file_priv = NULL, *priv;

	mutex_lock(&dev->struct_mutex);
	list_for_each_entry(priv, &dev->filelist, lhead) {
		rcu_read_lock();
		if (priv->pid == get_pid(task_pid(current)))
			file_priv = priv;
		rcu_read_unlock();
		if (file_priv)
			break;
	}
	mutex_unlock(&dev->struct_mutex);
	r = dev->driver->prime_fd_to_handle(dev,
					    file_priv, dmabuf_fd,
					    &dma_handle);
	spin_lock(&file_priv->table_lock);

	/* Check if we currently have a reference on the object */
	obj = idr_find(&file_priv->object_idr, dma_handle);
	if (obj == NULL) {
		spin_unlock(&file_priv->table_lock);
		return -EINVAL;
	}
	spin_unlock(&file_priv->table_lock);
	bo = gem_to_amdgpu_bo(obj);
	*handle = (cgs_handle_t)bo;
	return 0;
}

static int amdgpu_cgs_free_gpu_mem(void *cgs_device, cgs_handle_t handle)
{
	struct amdgpu_bo *obj = (struct amdgpu_bo *)handle;
@@ -810,7 +772,6 @@ static const struct cgs_ops amdgpu_cgs_ops = {
};

static const struct cgs_os_ops amdgpu_cgs_os_ops = {
	amdgpu_cgs_import_gpu_mem,
	amdgpu_cgs_add_irq_source,
	amdgpu_cgs_irq_get,
	amdgpu_cgs_irq_put
+0 −17
Original line number Diff line number Diff line
@@ -26,19 +26,6 @@

#include "cgs_common.h"

/**
 * cgs_import_gpu_mem() - Import dmabuf handle
 * @cgs_device:  opaque device handle
 * @dmabuf_fd:   DMABuf file descriptor
 * @handle:      memory handle (output)
 *
 * Must be called in the process context that dmabuf_fd belongs to.
 *
 * Return:  0 on success, -errno otherwise
 */
typedef int (*cgs_import_gpu_mem_t)(void *cgs_device, int dmabuf_fd,
				    cgs_handle_t *handle);

/**
 * cgs_irq_source_set_func() - Callback for enabling/disabling interrupt sources
 * @private_data:  private data provided to cgs_add_irq_source
@@ -114,16 +101,12 @@ typedef int (*cgs_irq_get_t)(void *cgs_device, unsigned src_id, unsigned type);
typedef int (*cgs_irq_put_t)(void *cgs_device, unsigned src_id, unsigned type);

struct cgs_os_ops {
	cgs_import_gpu_mem_t import_gpu_mem;

	/* IRQ handling */
	cgs_add_irq_source_t add_irq_source;
	cgs_irq_get_t irq_get;
	cgs_irq_put_t irq_put;
};

#define cgs_import_gpu_mem(dev,dmabuf_fd,handle)		\
	CGS_OS_CALL(import_gpu_mem,dev,dmabuf_fd,handle)
#define cgs_add_irq_source(dev,src_id,num_types,set,handler,private_data) \
	CGS_OS_CALL(add_irq_source,dev,src_id,num_types,set,handler,	\
		    private_data)