From edf9d114e1d251001c6dd76e74dbd1d52953f6aa Mon Sep 17 00:00:00 2001 From: Ketan Patil Date: Fri, 4 Aug 2023 09:17:06 +0000 Subject: [PATCH] video: tegra: nvmap: Don't perform repetitive ioremap __ioremap function called during cache maint takes more time in case of multiple processes compared to single process. This is impacting camera tests when multiple cameras are used. For carveouts, nvmap performs page by page ioremap and then cache maint on it. Optimize this with following steps: - During first cache_maint of the buffer, perform ioremap on entire buffer and save the kernel V.A. - Next time, when cache_maint is called on the same buffer, we will reuse the saved kernel V.A. Bug 3922175 Change-Id: Iecb372365409de1951bcc8e6f3d8e8e867bb2a80 Signed-off-by: Ketan Patil Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948759 Reviewed-by: Barton Xu (SW-TEGRA) Reviewed-by: Krishna Reddy Reviewed-by: Sachin Nikam GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/nvmap/nvmap_cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/tegra/nvmap/nvmap_cache.c b/drivers/video/tegra/nvmap/nvmap_cache.c index dfd05e2b..aa56b61e 100644 --- a/drivers/video/tegra/nvmap/nvmap_cache.c +++ b/drivers/video/tegra/nvmap/nvmap_cache.c @@ -194,6 +194,16 @@ static int do_cache_maint(struct cache_maint_op *cache_work) goto out; } + if (!h->vaddr) { + if (__nvmap_mmap(h)) + __nvmap_munmap(h, h->vaddr); + else + goto per_page_phy_cache_maint; + } + inner_cache_maint(op, h->vaddr + pstart, pend - pstart); + goto out; + +per_page_phy_cache_maint: pstart += h->carveout->base; pend += h->carveout->base;