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

Commit f490965b authored by Ping Jiang's avatar Ping Jiang
Browse files

char: virtio_fastrpc: use DMA_ATTR_SKIP_CPU_SYNC for uncached buffer



When buffer is uncached, use flag DMA_ATTR_SKIP_CPU_SYNC to
reduce cache sync time.

Change-Id: Icce9cd40fc6f3cd6aba69443c593b3947d8c6fdb
Signed-off-by: default avatarPing Jiang <scottjiang@codeaurora.org>
parent 6bddfdd3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/dma-buf.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/ion.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
@@ -512,6 +513,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_mmap *map = NULL;
	int err = 0, sgl_index = 0;
	unsigned long flags;
	struct scatterlist *sgl = NULL;

	map = kzalloc(sizeof(*map), GFP_KERNEL);
@@ -535,12 +537,21 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
			dev_err(me->dev, "can't get dma buf fd %d\n", fd);
			goto bail;
		}
		VERIFY(err, !dma_buf_get_flags(map->buf, &flags));
		if (err) {
			dev_err(me->dev, "can't get dma buf flags %d\n", fd);
			goto bail;
		}

		VERIFY(err, !IS_ERR_OR_NULL(map->attach =
					dma_buf_attach(map->buf, me->dev)));
		if (err) {
			dev_err(me->dev, "can't attach dma buf\n");
			goto bail;
		}

		if (!(flags & ION_FLAG_CACHED))
			map->attach->dma_map_attrs |= DMA_ATTR_SKIP_CPU_SYNC;
		VERIFY(err, !IS_ERR_OR_NULL(map->table =
					dma_buf_map_attachment(map->attach,
					DMA_BIDIRECTIONAL)));