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

Commit 943718e0 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: adsprpc: Flush and invalidate unaligned buffers"

parents 00fad1d1 b686ad48
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -895,6 +895,12 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
				DMA_ATTR_SKIP_CPU_SYNC;
		else if (map->attr & FASTRPC_ATTR_COHERENT)
			map->attach->dma_map_attrs |= DMA_ATTR_FORCE_COHERENT;
		/*
		 * Skip CPU sync if IO Cohernecy is not supported
		 * as we flush later
		 */
		else if (!sess->smmu.coherent)
			map->attach->dma_map_attrs |= DMA_ATTR_SKIP_CPU_SYNC;

		VERIFY(err, !IS_ERR_OR_NULL(map->table =
			dma_buf_map_attachment(map->attach,
@@ -1641,9 +1647,9 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
			ctx->overps[oix]->mstart) {
			if (map && map->buf) {
				dma_buf_begin_cpu_access(map->buf,
					DMA_BIDIRECTIONAL);
					DMA_TO_DEVICE);
				dma_buf_end_cpu_access(map->buf,
					DMA_BIDIRECTIONAL);
					DMA_TO_DEVICE);
			} else
				dmac_flush_range(uint64_to_ptr(rpra[i].buf.pv),
					uint64_to_ptr(rpra[i].buf.pv
@@ -1798,9 +1804,9 @@ static void inv_args(struct smq_invoke_ctx *ctx)
		}
		if (map && map->buf) {
			dma_buf_begin_cpu_access(map->buf,
				DMA_BIDIRECTIONAL);
				DMA_FROM_DEVICE);
			dma_buf_end_cpu_access(map->buf,
				DMA_BIDIRECTIONAL);
				DMA_FROM_DEVICE);
		} else
			dmac_inv_range((char *)uint64_to_ptr(rpra[i].buf.pv),
				(char *)uint64_to_ptr(rpra[i].buf.pv