FROMLIST: dma-buf: add support for virtio exported objects

This change adds a new dma-buf operation that allows dma-bufs to be used
by virtio drivers to share exported objects. The new operation allows
the importing driver to query the exporting driver for the UUID which
identifies the underlying exported object.

Signed-off-by: David Stevens <stevensd@chromium.org>

BUG=b:136269340
TEST=boot ARCVM and launch play store

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2059086
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Bug: 153580313
Link: https://lore.kernel.org/lkml/20200311112004.47138-2-stevensd@chromium.org/
Change-Id: Ifb429e36ebbba9feead6fd1792fbefa9ca097f0c
Signed-off-by: Lingfeng Yang <lfy@google.com>
This commit is contained in:
David Stevens 2020-01-22 15:02:33 +09:00 committed by Alistair Delva
parent a123dd43e5
commit 9b7d0c9aee
2 changed files with 27 additions and 0 deletions

View file

@ -1243,6 +1243,18 @@ int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags)
}
EXPORT_SYMBOL_GPL(dma_buf_get_flags);
int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid)
{
if (WARN_ON(!dmabuf) || !uuid)
return -EINVAL;
if (!dmabuf->ops->get_uuid)
return -ENODEV;
return dmabuf->ops->get_uuid(dmabuf, uuid);
}
EXPORT_SYMBOL_GPL(dma_buf_get_uuid);
#ifdef CONFIG_DEBUG_FS
static int dma_buf_debug_show(struct seq_file *s, void *unused)
{

View file

@ -355,6 +355,21 @@ struct dma_buf_ops {
void *(*vmap)(struct dma_buf *);
void (*vunmap)(struct dma_buf *, void *vaddr);
/**
* @get_uuid
*
* This is called by dma_buf_get_uuid to get the UUID which identifies
* the buffer to virtio devices.
*
* This callback is optional.
*
* Returns:
*
* 0 on success or a negative error code on failure. On success uuid
* will be populated with the buffer's UUID.
*/
int (*get_uuid)(struct dma_buf *dmabuf, uuid_t *uuid);
/**
* @get_flags:
*