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

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

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

parents 913f7145 05c8a4cb
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;