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

Commit 33eba78c authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

adsprpc: Increment map size for each entry in SGL



Incrementally update the memory map size from each entry in the
DMA scatter-gather list.

Change-Id: Ia44d5140df3de385ca0324b540c8ad715f5f087b
Acked-by: default avatarThyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 76154d31
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -663,7 +663,8 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
	dma_addr_t region_phys = 0;
	void *region_vaddr = NULL;
	unsigned long flags;
	int err = 0, vmid;
	int err = 0, vmid, sgl_index = 0;
	struct scatterlist *sgl = NULL;

	if (!fastrpc_mmap_find(fl, fd, va, len, mflags, 1, ppmap))
		return 0;
@@ -748,7 +749,9 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
		map->phys = sg_dma_address(map->table->sgl);
		if (sess->smmu.cb) {
			map->phys += ((uint64_t)sess->smmu.cb << 32);
			map->size = sg_dma_len(map->table->sgl);
			for_each_sg(map->table->sgl, sgl, map->table->nents,
				sgl_index)
				map->size += sg_dma_len(sgl);
		} else {
			map->size = buf_page_size(len);
		}
@@ -2136,7 +2139,7 @@ static int fastrpc_internal_munmap_fd(struct fastrpc_file *fl,
		goto bail;

	if (fastrpc_mmap_find(fl, ud->fd, ud->va, ud->len, 0, 0, &map)) {
		pr_err("adsprpc: mapping not found to unmap %d va %llx %x\n",
		pr_err("adsprpc: mapping not found to unmap fd 0x%x, va 0x%llx, len 0x%x\n",
			ud->fd, (unsigned long long)ud->va,
			(unsigned int)ud->len);
		err = -1;