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
+ default n
+ help
+ This option adds a KDS resource within every dma_buf allocation.
+
config KDS
bool "Kernel dependency system"
help
dmabuf = file->private_data;
dmabuf->ops->release(dmabuf);
+ kds_resource_term(&dmabuf->kds);
kfree(dmabuf);
return 0;
}
mutex_init(&dmabuf->lock);
INIT_LIST_HEAD(&dmabuf->attachments);
+ kds_resource_init(&dmabuf->kds);
+
return dmabuf;
}
EXPORT_SYMBOL_GPL(dma_buf_export);
#include <linux/list.h>
#include <linux/dma-mapping.h>
#include <linux/fs.h>
+#include <linux/kds.h>
struct device;
struct dma_buf;
const struct dma_buf_ops *ops;
/* mutex to serialize list manipulation and attach/detach */
struct mutex lock;
+ struct kds_resource kds;
void *priv;
};
get_file(dmabuf->file);
}
+/**
+ * get_dma_buf_kds_resource - get a KDS resource for this dma-buf
+ * @dmabuf: [in] pointer to dma_buf
+ *
+ * Returns a KDS resource that represents the dma-buf. This should be used by
+ * drivers to synchronize access to the buffer. Note that the caller should
+ * ensure that a reference to the dma-buf exists from the call to
+ * kds_async_wait until kds_resource_set_release is called.
+ */
+static inline struct kds_resource *
+ get_dma_buf_kds_resource(struct dma_buf *dmabuf)
+{
+ return &dmabuf->kds;
+}
+
#ifdef CONFIG_DMA_SHARED_BUFFER
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
struct device *dev);