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

Commit 05c8a4cb authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

msm: adsprpc: use same CPU address during DMA allocation and free



Ensure that the same CPU address returned from the DMA memory
allocation API is passed to the DMA memory free API.

Change-Id: I09d23fb9960bc3400f85aef84bb16d64b546b112
Acked-by: default avatarThyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 1e465bc9
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -790,7 +790,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
			goto bail;
		map->phys = (uintptr_t)region_phys;
		map->size = len;
		map->va = 0;
		map->va = (uintptr_t)region_vaddr;
	} else if (mflags == FASTRPC_DMAHANDLE_NOMAP) {
		VERIFY(err, !IS_ERR_OR_NULL(map->buf = dma_buf_get(fd)));
		if (err)
@@ -2035,7 +2035,6 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
						DMA_ATTR_NO_KERNEL_MAPPING |
						DMA_ATTR_FORCE_NON_COHERENT;
		err = fastrpc_buf_alloc(fl, memlen, imem_dma_attr, 0, 0, &imem);
		imem->virt = NULL;
		if (err)
			goto bail;
		fl->init_mem = imem;
@@ -2577,14 +2576,14 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
								1, &rbuf);
		if (err)
			goto bail;
		rbuf->virt = NULL;
		err = fastrpc_mmap_on_dsp(fl, ud->flags,
				(uintptr_t)rbuf->virt,
		err = fastrpc_mmap_on_dsp(fl, ud->flags, 0,
				rbuf->phys, rbuf->size, &raddr);
		if (err)
			goto bail;
		rbuf->raddr = raddr;
	} else {
		uintptr_t va_to_dsp;

		mutex_lock(&fl->map_mutex);
		VERIFY(err, !fastrpc_mmap_create(fl, ud->fd, 0,
				(uintptr_t)ud->vaddrin, ud->size,
@@ -2592,7 +2591,13 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl,
		mutex_unlock(&fl->map_mutex);
		if (err)
			goto bail;
		VERIFY(err, 0 == fastrpc_mmap_on_dsp(fl, ud->flags, map->va,

		if (ud->flags == ADSP_MMAP_HEAP_ADDR ||
				ud->flags == ADSP_MMAP_REMOTE_HEAP_ADDR)
			va_to_dsp = 0;
		else
			va_to_dsp = (uintptr_t)map->va;
		VERIFY(err, 0 == fastrpc_mmap_on_dsp(fl, ud->flags, va_to_dsp,
				map->phys, map->size, &raddr));
		if (err)
			goto bail;