DSPBRIDGE: create DMM table using vmalloc instead of kmalloc
Subsystems (2)
Replace the physical contiguos allocation for DMM tables as the required space might not available after some time, use virtual memory allocation instead.
Signed-off-by Omar Ramirez Luna <[email protected]>
--- arch/arm/plat-omap/include/dspbridge/mem.h | 17 +++++++++ drivers/dsp/bridge/pmgr/dmm.c | 6 ++-- drivers/dsp/bridge/services/mem.c | 55 +++++++++++++++++++++------- 3 files changed, 62 insertions(+), 16 deletions(-)
arch/arm/plat-omap/include/dspbridge/mem.h +17 -0
@@ -203,6 +203,23 @@ extern void MEM_Free(IN void *pMemBuf);/* +* ======== MEM_VFree ======== +* Purpose: +* Free the given block of system memory in virtual space. +* Parameters: +* pMemBuf: Pointer to memory allocated by MEM_Calloc/Alloc() +* using vmalloc. +* Returns: +* Requires: +* MEM initialized. +* pMemBuf is a valid memory address returned by MEM_Calloc/Alloc() +* using vmalloc. +* Ensures: +* pMemBuf is no longer a valid pointer to memory. +*/ + extern void MEM_VFree(IN void *pMemBuf); + +/* * ======== MEM_FreePhysMem ======== * Purpose: * Free the given block of physically contiguous memory.
drivers/dsp/bridge/pmgr/dmm.c +3 -3
@@ -143,10 +143,10 @@ DSP_STATUS DMM_CreateTables(struct DMM_OBJECT *hDmmMgr, u32 addr, u32 size)if (DSP_SUCCEEDED (status)) {SYNC_EnterCS (pDmmObj->hDmmLock); dynMemMapBeg = addr; - TableSize = (size/PG_SIZE_4K ) +1 ; + TableSize =PG_ALIGN_HIGH (size,PG_SIZE_4K )/PG_SIZE_4K ;/* Create the free list */ pVirtualMappingTable = (struct MapPage *)MEM_Calloc - (TableSize*sizeof (struct MapPage ),MEM_NONPAGED ); + (TableSize *sizeof (struct MapPage ),MEM_LARGEVIRTMEM );if (pVirtualMappingTable ==NULL ) status =DSP_EMEMORY ;else {
@@ -255,7 +255,7 @@ DSP_STATUS DMM_DeleteTables(struct DMM_OBJECT *hDmmMgr)SYNC_EnterCS (pDmmObj->hDmmLock);if (pVirtualMappingTable !=NULL ) -MEM_Free (pVirtualMappingTable); +MEM_VFree (pVirtualMappingTable);SYNC_LeaveCS (pDmmObj->hDmmLock); }else
drivers/dsp/bridge/services/mem.c +42 -13
77 lines not on this page · raw message
Signature · 1 line
1.6.2.4