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

Commit 9b7d0c9a authored by David Stevens's avatar David Stevens Committed by Alistair Delva
Browse files

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: default avatarDavid Stevens <stevensd@chromium.org>

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

Signed-off-by: default avatarKeiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2059086


Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Reviewed-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Tested-by: default avatarDavid 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: default avatarLingfeng Yang <lfy@google.com>
parent a123dd43
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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)
{
+15 −0
Original line number Diff line number Diff line
@@ -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:
	 *