MALI: utgard: upgrade DDK to r6p1-01rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / linux / mali_memory_util.c
index bcca43c09f0bb6a5950e84cc8fea4dfffb80a4d9..d5b39a962905c29bb1940e954c38c117fc19367f 100644 (file)
@@ -25,6 +25,7 @@
 #include "mali_memory_os_alloc.h"
 #if defined(CONFIG_DMA_SHARED_BUFFER)
 #include "mali_memory_dma_buf.h"
+#include "mali_memory_secure.h"
 #endif
 #if defined(CONFIG_MALI400_UMP)
 #include "mali_memory_ump.h"
@@ -67,7 +68,7 @@ static u32 _mali_free_allocation_mem(mali_mem_allocation *mali_alloc)
                mali_mem_unbind_ump_buf(mem_bkend);
                atomic_sub(mem_bkend->size / MALI_MMU_PAGE_SIZE, &session->mali_mem_array[mem_bkend->type]);
 #else
-               MALI_DEBUG_PRINT(2, ("UMP not supported\n"));
+               MALI_DEBUG_PRINT(1, ("UMP not supported\n"));
 #endif
                break;
        case MALI_MEM_DMA_BUF:
@@ -75,7 +76,7 @@ static u32 _mali_free_allocation_mem(mali_mem_allocation *mali_alloc)
                mali_mem_unbind_dma_buf(mem_bkend);
                atomic_sub(mem_bkend->size / MALI_MMU_PAGE_SIZE, &session->mali_mem_array[mem_bkend->type]);
 #else
-               MALI_DEBUG_PRINT(2, ("DMA not supported\n"));
+               MALI_DEBUG_PRINT(1, ("DMA not supported\n"));
 #endif
                break;
        case MALI_MEM_EXTERNAL:
@@ -101,6 +102,14 @@ static u32 _mali_free_allocation_mem(mali_mem_allocation *mali_alloc)
                atomic_sub(free_pages_nr, &session->mali_mem_allocated_pages);
                atomic_sub(free_pages_nr, &session->mali_mem_array[mem_bkend->type]);
                break;
+       case MALI_MEM_SECURE:
+#if defined(CONFIG_DMA_SHARED_BUFFER)
+               free_pages_nr = mali_mem_secure_release(mem_bkend);
+               atomic_sub(free_pages_nr, &session->mali_mem_allocated_pages);
+#else
+               MALI_DEBUG_PRINT(1, ("DMA not supported for mali secure memory\n"));
+#endif
+               break;
        default:
                MALI_DEBUG_PRINT(1, ("mem type %d is not in the mali_mem_type enum.\n", mem_bkend->type));
                break;