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

Commit 1c22c901 authored by Merugu Tharun Kumar's avatar Merugu Tharun Kumar Committed by Edgar Flores
Browse files

msm: adsprpc: Cache flush operation optimization



Instead of flushing whole buffer use partial cache maintenance apis
to flush only for length user passed. Introducing offset based flush,
when buffers have partial or full overlap, avoiding flush for overlap.

Change-Id: Ifcdcaab112522ee3abf842e9e305665f9a7ddd7e
Acked-by: default avatarDeepika Singh <dsi@qti.qualcomm.com>
Signed-off-by: default avatarMerugu Tharun Kumar <mtharu@codeaurora.org>
Signed-off-by: default avatarMohammed Nayeem Ur Rahman <mohara@codeaurora.org>
Signed-off-by: default avatarEdgar Flores <edgarf@codeaurora.org>
parent 776e6bfb
Loading
Loading
Loading
Loading
+31 −4
Original line number Diff line number Diff line
@@ -1883,10 +1883,37 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		if (rpra && rpra[i].buf.len &&
			ctx->overps[oix]->mstart) {
			if (map && map->buf) {
				if ((buf_page_size(ctx->overps[oix]->mend -
				ctx->overps[oix]->mstart)) == map->size) {
					dma_buf_begin_cpu_access(map->buf,
						DMA_TO_DEVICE);
					dma_buf_end_cpu_access(map->buf,
						DMA_TO_DEVICE);
				} else {
					uintptr_t offset;
					struct vm_area_struct *vma;

					down_read(&current->mm->mmap_sem);
					VERIFY(err, NULL != (vma = find_vma(
						current->mm,
						ctx->overps[oix]->mstart)));
					if (err) {
						up_read(&current->mm->mmap_sem);
						goto bail;
					}
					offset = buf_page_start(
						rpra[i].buf.pv) -
						vma->vm_start;
					up_read(&current->mm->mmap_sem);
					dma_buf_begin_cpu_access_partial(
						map->buf, DMA_TO_DEVICE, offset,
						ctx->overps[oix]->mend -
						ctx->overps[oix]->mstart);
					dma_buf_end_cpu_access_partial(
						map->buf, DMA_TO_DEVICE, offset,
						ctx->overps[oix]->mend -
						ctx->overps[oix]->mstart);
				}
			}
		}
	}