From 74f3b934029fd42f770049b5fe368a63359fd0ab Mon Sep 17 00:00:00 2001 From: thead_admin Date: Sun, 5 Mar 2023 22:29:50 +0800 Subject: [PATCH] Linux_SDK_V1.1.2 --- linux/kernel_module/hantro_mmu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/linux/kernel_module/hantro_mmu.c b/linux/kernel_module/hantro_mmu.c index b109ecd..3df60e4 100755 --- a/linux/kernel_module/hantro_mmu.c +++ b/linux/kernel_module/hantro_mmu.c @@ -1180,11 +1180,12 @@ enum MMUStatus MMUCleanup(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]) { if (g_mmu->page_table_array) iounmap(g_mmu->page_table_array); } else { - if (g_mmu->stlb_virtual) - dma_free_coherent(&platformdev->dev, g_mmu->stlb_size, - g_mmu->stlb_virtual, (dma_addr_t)g_mmu->stlb_physical); + /* stlb_virtual is same alloc on alloc mtlb_virtual in func MMUEnable() + * so, should not free g_mmu->stlb_virtual.But free handle g_mmu->mtlb_physical + * size should be ( g_mmu->mtlb_size+g_mmu->stlb_size) + * */ if (g_mmu->mtlb_virtual) - dma_free_coherent(&platformdev->dev, g_mmu->mtlb_size, + dma_free_coherent(&platformdev->dev, g_mmu->mtlb_size+g_mmu->stlb_size, g_mmu->mtlb_virtual, (dma_addr_t)g_mmu->mtlb_physical); if (g_mmu->page_table_array) dma_free_coherent(&platformdev->dev, g_mmu->page_table_array_size, @@ -1893,4 +1894,4 @@ void MMURestore(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]) iowrite32(1, (void*)(hwregs[i][1] + MMU_REG_CONTROL)); } } -} \ No newline at end of file +}