From 3c6f00541900596b2919faa1b28a255d3e200f8f Mon Sep 17 00:00:00 2001 From: "renjiang.han" Date: Thu, 21 Mar 2019 11:16:43 +0800 Subject: [PATCH] PPMGR: modify phys_to_virt to codec_mm_vmap. [5/5] PD#TV-2649 Problem: Kernel panic with phys_to_virt. Solution: Replace phys_to_virt with codec_mm_vmap. Verify: on u212 Change-Id: Ib3f94f66d37463490720cd1348b4ec94ad12aa15 Signed-off-by: renjiang.han --- drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c index 42cc0a6..79491652 100644 --- a/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c +++ b/drivers/amlogic/media/video_processor/ppmgr/ppmgr_vpp.c @@ -3627,7 +3627,8 @@ void stop_ppmgr_task(void) static int tb_buffer_init(void) { int i; - int flags = CODEC_MM_FLAGS_DMA_CPU | CODEC_MM_FLAGS_CMA_CLEAR; + //int flags = CODEC_MM_FLAGS_DMA_CPU | CODEC_MM_FLAGS_CMA_CLEAR; + int flags = 0; if (tb_buffer_status) return tb_buffer_status; @@ -3676,7 +3677,8 @@ static int tb_buffer_init(void) detect_buf[i].paddr = tb_buffer_start + TB_DETECT_H * TB_DETECT_W * i; detect_buf[i].vaddr = - (ulong)phys_to_virt(detect_buf[i].paddr); + (ulong)codec_mm_vmap(detect_buf[i].paddr, + TB_DETECT_H * TB_DETECT_W); if (ppmgr_device.tb_detect & 0xc) { PPMGRVPP_INFO( "detect buff(%d) paddr: %lx, vaddr: %lx\n", @@ -3692,6 +3694,7 @@ static int tb_buffer_init(void) static int tb_buffer_uninit(void) { + int i; if (tb_src_canvas) { if (tb_src_canvas & 0xff) canvas_pool_map_free_canvas( @@ -3712,6 +3715,13 @@ static int tb_buffer_uninit(void) PPMGRVPP_INFO("tb cma free addr is %x, size is %x\n", (unsigned int)tb_buffer_start, (unsigned int)tb_buffer_size); + for (i = 0; i < tb_buffer_len; i++) { + if (detect_buf[i].vaddr) { + codec_mm_unmap_phyaddr( + (u8 *)detect_buf[i].vaddr); + detect_buf[i].vaddr = 0; + } + } codec_mm_free_for_dma( "tb_detect", tb_buffer_start); -- 2.7.4