bool
default n
select ANON_INODES
- select KDS
- select DMA_SHARED_BUFFER_USES_KDS
depends on EXPERIMENTAL
help
This option enables the framework for buffer-sharing between
endif
config DMA_SHARED_BUFFER_USES_KDS
- bool
+ bool "Add KDS resource within every dma_buf allocation"
+ depends on DMA_SHARED_BUFFER && KDS
default n
help
This option adds a KDS resource within every dma_buf allocation.
#include <linux/dma-buf.h>
#include <linux/anon_inodes.h>
#include <linux/export.h>
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
#include <linux/poll.h>
#include <linux/sched.h>
+#endif
static inline int is_dma_buf_file(struct file *);
dmabuf = file->private_data;
dmabuf->ops->release(dmabuf);
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
kds_callback_term(&dmabuf->kds_cb);
kds_resource_term(&dmabuf->kds);
+#endif
kfree(dmabuf);
return 0;
}
return dmabuf->ops->mmap(dmabuf, vma);
}
-
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
static void dma_buf_kds_cb_fn(void *param1, void *param2)
{
struct kds_resource_set **rset_ptr = param1;
}
return ret;
}
+#endif
static const struct file_operations dma_buf_fops = {
.release = dma_buf_release,
.mmap = dma_buf_mmap_internal,
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
.poll = dma_buf_poll,
+#endif
};
/*
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
init_waitqueue_head(&dmabuf->wq_exclusive);
init_waitqueue_head(&dmabuf->wq_shared);
kds_resource_init(&dmabuf->kds);
kds_callback_init(&dmabuf->kds_cb, 1, dma_buf_kds_cb_fn);
+#endif
return dmabuf;
}
#include <linux/list.h>
#include <linux/dma-mapping.h>
#include <linux/fs.h>
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
#include <linux/kds.h>
#include <linux/wait.h>
+#endif
struct device;
struct dma_buf;
const struct dma_buf_ops *ops;
/* mutex to serialize list manipulation and attach/detach */
struct mutex lock;
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
struct kds_resource kds;
wait_queue_head_t wq_exclusive;
wait_queue_head_t wq_shared;
struct kds_callback kds_cb;
+#endif
void *priv;
};
get_file(dmabuf->file);
}
+#ifdef CONFIG_DMA_SHARED_BUFFER_USES_KDS
/**
* get_dma_buf_kds_resource - get a KDS resource for this dma-buf
* @dmabuf: [in] pointer to dma_buf
{
return &dmabuf->kds;
}
+#endif
#ifdef CONFIG_DMA_SHARED_BUFFER
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,