From 017e76fd92cb1a5f089ad8428851ace8ea6a58db Mon Sep 17 00:00:00 2001 From: Jakub Dabek Date: Tue, 10 Sep 2019 17:47:21 +0200 Subject: [PATCH 1/3] memory: adjust memory sizes for heaps Adjust memory sizes for heaps to provide enough memory for alignment in buffer heap. Signed-off-by: Jakub Dabek --- src/platform/apollolake/include/platform/lib/memory.h | 2 +- src/platform/baytrail/include/platform/lib/memory.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/platform/apollolake/include/platform/lib/memory.h b/src/platform/apollolake/include/platform/lib/memory.h index 357c4bae9cff..93575691183b 100644 --- a/src/platform/apollolake/include/platform/lib/memory.h +++ b/src/platform/apollolake/include/platform/lib/memory.h @@ -282,7 +282,7 @@ HEAP_RT_COUNT256 * 256 + HEAP_RT_COUNT512 * 512 + \ HEAP_RT_COUNT1024 * 1024) -#define HEAP_BUFFER_SIZE 0x2000 +#define HEAP_BUFFER_SIZE 0x8000 #define HEAP_BUFFER_BLOCK_SIZE 0x180 #define HEAP_BUFFER_COUNT (HEAP_BUFFER_SIZE / HEAP_BUFFER_BLOCK_SIZE) diff --git a/src/platform/baytrail/include/platform/lib/memory.h b/src/platform/baytrail/include/platform/lib/memory.h index 0492ed4ece5d..ea86f0c5e925 100644 --- a/src/platform/baytrail/include/platform/lib/memory.h +++ b/src/platform/baytrail/include/platform/lib/memory.h @@ -86,13 +86,13 @@ void platform_init_memmap(void); /* Heap section sizes for module pool */ #define HEAP_RT_COUNT8 0 -#define HEAP_RT_COUNT16 48 -#define HEAP_RT_COUNT32 48 +#define HEAP_RT_COUNT16 32 +#define HEAP_RT_COUNT32 32 #define HEAP_RT_COUNT64 32 #define HEAP_RT_COUNT128 32 #define HEAP_RT_COUNT256 32 -#define HEAP_RT_COUNT512 4 -#define HEAP_RT_COUNT1024 4 +#define HEAP_RT_COUNT512 2 +#define HEAP_RT_COUNT1024 1 /* Heap section sizes for system runtime heap */ #define HEAP_SYS_RT_COUNT64 64 From 3acc5d123814463352908a6a9aa0d6767a72b1df Mon Sep 17 00:00:00 2001 From: Jakub Dabek Date: Thu, 8 Aug 2019 13:25:07 +0200 Subject: [PATCH 2/3] host: Fix memory function definitions Fix alloc definitions for host build. Function definitions were using defines in their body which blocked usage of const values in said defines. Signed-off-by: Jakub Dabek --- tools/testbench/alloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/testbench/alloc.c b/tools/testbench/alloc.c index 7ce3aeeb8f19..3eb9e90ee07d 100644 --- a/tools/testbench/alloc.c +++ b/tools/testbench/alloc.c @@ -16,12 +16,12 @@ /* testbench mem alloc definition */ -void *rmalloc(int zone, uint32_t caps, size_t bytes) +void *_malloc(int zone, uint32_t caps, size_t bytes) { return malloc(bytes); } -void *rzalloc(int zone, uint32_t caps, size_t bytes) +void *_zalloc(int zone, uint32_t caps, size_t bytes) { return calloc(bytes, 1); } @@ -31,17 +31,19 @@ void rfree(void *ptr) free(ptr); } -void *rballoc(int zone, uint32_t caps, size_t bytes) +void *_balloc(int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { return malloc(bytes); } -void *rrealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_realloc(void *ptr, int zone, uint32_t caps, size_t bytes) { return realloc(ptr, bytes); } -void *rbrealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { return realloc(ptr, bytes); } From 0b673cb33c848492adf579f4b34a84b7bd25b74d Mon Sep 17 00:00:00 2001 From: Jakub Dabek Date: Thu, 8 Aug 2019 15:14:56 +0200 Subject: [PATCH 3/3] memory: Add alignment option for allocation Add alignment option for memory requests. Fix alloc definitions for UT. Function definitions were using defines in their body which blocked usage of const values in said defines. Signed-off-by: Jakub Dabek --- src/arch/host/include/arch/lib/cache.h | 2 + src/include/sof/lib/alloc.h | 46 +++++- src/include/sof/lib/cache.h | 7 - src/lib/alloc.c | 138 ++++++++++++++---- .../baytrail/include/platform/lib/memory.h | 2 + .../haswell/include/platform/lib/memory.h | 6 +- .../imx8/include/platform/lib/memory.h | 3 + .../intel/cavs/include/cavs/lib/memory.h | 3 + test/cmocka/src/audio/buffer/mock.c | 8 +- test/cmocka/src/audio/component/mock.c | 2 +- test/cmocka/src/audio/kpb/kpb_mock.c | 8 +- test/cmocka/src/audio/mixer/mock.c | 8 +- 12 files changed, 180 insertions(+), 53 deletions(-) diff --git a/src/arch/host/include/arch/lib/cache.h b/src/arch/host/include/arch/lib/cache.h index a849c1c77fc8..8291675d79f3 100644 --- a/src/arch/host/include/arch/lib/cache.h +++ b/src/arch/host/include/arch/lib/cache.h @@ -12,6 +12,8 @@ #include +#define PLATFORM_DCACHE_ALIGN sizeof(void *) + static inline void dcache_writeback_region(void *addr, size_t size) {} static inline void dcache_invalidate_region(void *addr, size_t size) {} static inline void icache_invalidate_region(void *addr, size_t size) {} diff --git a/src/include/sof/lib/alloc.h b/src/include/sof/lib/alloc.h index 00a8cae11baf..dee50019fe82 100644 --- a/src/include/sof/lib/alloc.h +++ b/src/include/sof/lib/alloc.h @@ -62,6 +62,7 @@ struct mm_info { struct block_hdr { uint16_t size; /* size in blocks for continuous allocation */ uint16_t used; /* usage flags for page */ + void *unaligned_ptr; /* align ptr */ } __packed; struct block_map { @@ -105,9 +106,10 @@ struct mm { /* heap allocation and free */ void *_malloc(int zone, uint32_t caps, size_t bytes); void *_zalloc(int zone, uint32_t caps, size_t bytes); -void *_balloc(int zone, uint32_t caps, size_t bytes); +void *_balloc(int zone, uint32_t caps, size_t bytes, uint32_t alignment); void *_realloc(void *ptr, int zone, uint32_t caps, size_t bytes); -void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes); +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment); void rfree(void *ptr); #if CONFIG_DEBUG_HEAP @@ -143,7 +145,7 @@ void rfree(void *ptr); #define rballoc(zone, caps, bytes) \ ({void *_ptr; \ do { \ - _ptr = _balloc(zone, caps, bytes); \ + _ptr = _balloc(zone, caps, bytes, PLATFORM_DCACHE_ALIGN);\ if (!_ptr) { \ trace_error(TRACE_CLASS_MEM, \ "failed to alloc 0x%x bytes caps 0x%x", \ @@ -169,7 +171,34 @@ void rfree(void *ptr); #define rbrealloc(ptr, zone, caps, bytes) \ ({void *_ptr; \ do { \ - _ptr = _brealloc(ptr, zone, caps, bytes); \ + _ptr = _brealloc(ptr, zone, caps, bytes,\ + PLATFORM_DCACHE_ALIGN);\ + if (!_ptr) { \ + trace_error(TRACE_CLASS_MEM, \ + "failed to alloc 0x%x bytes caps 0x%x", \ + bytes, caps); \ + alloc_trace_buffer_heap(zone, caps, bytes); \ + } \ + } while (0); \ + _ptr; }) + +#define rbrealloc_a(ptr, zone, caps, bytes, alignment) \ + ({void *_ptr; \ + do { \ + _ptr = _brealloc(ptr, zone, caps, bytes, alignment); \ + if (!_ptr) { \ + trace_error(TRACE_CLASS_MEM, \ + "failed to alloc 0x%x bytes caps 0x%x", \ + bytes, caps); \ + alloc_trace_buffer_heap(zone, caps, bytes); \ + } \ + } while (0); \ + _ptr; }) + +#define rballoc(zone, caps, bytes, alignment) \ + ({void *_ptr; \ + do { \ + _ptr = _balloc(zone, caps, bytes, alignment); \ if (!_ptr) { \ trace_error(TRACE_CLASS_MEM, \ "failed to alloc 0x%x bytes caps 0x%x", \ @@ -186,11 +215,16 @@ void alloc_trace_buffer_heap(int zone, uint32_t caps, size_t bytes); #define rmalloc(zone, caps, bytes) _malloc(zone, caps, bytes) #define rzalloc(zone, caps, bytes) _zalloc(zone, caps, bytes) -#define rballoc(zone, caps, bytes) _balloc(zone, caps, bytes) +#define rballoc(zone, caps, bytes) \ + _balloc(zone, caps, bytes, PLATFORM_DCACHE_ALIGN) +#define rballoc_align(zone, caps, bytes, alignment) \ + _balloc(zone, caps, bytes, alignment) #define rrealloc(ptr, zone, caps, bytes) \ _realloc(ptr, zone, caps, bytes) #define rbrealloc(ptr, zone, caps, bytes) \ - _brealloc(ptr, zone, caps, bytes) + _brealloc(ptr, zone, caps, bytes, PLATFORM_DCACHE_ALIGN) +#define rbrealloc_align(ptr, zone, caps, bytes, alignment) \ + _brealloc(ptr, zone, caps, bytes, alignment) #endif diff --git a/src/include/sof/lib/cache.h b/src/include/sof/lib/cache.h index 6144abeb7a7d..1418845fc096 100644 --- a/src/include/sof/lib/cache.h +++ b/src/include/sof/lib/cache.h @@ -22,11 +22,4 @@ /* invalidate data */ #define CACHE_INVALIDATE 1 -/* data cache line alignment */ -#if DCACHE_LINE_SIZE > 0 -#define PLATFORM_DCACHE_ALIGN DCACHE_LINE_SIZE -#else -#define PLATFORM_DCACHE_ALIGN sizeof(void *) -#endif - #endif /* __SOF_LIB_CACHE_H__ */ diff --git a/src/lib/alloc.c b/src/lib/alloc.c index 2a9d7b3db720..84d785e78077 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -201,9 +201,30 @@ static void *rmalloc_sys(int zone, int caps, int core, size_t bytes) return ptr; } +/* At this point the pointer we have should be unaligned + * (it was checked level higher) and be power of 2 + */ +static void *align_ptr(struct mm_heap *heap, uint32_t alignment, + void *ptr, struct block_hdr *hdr) +{ + int mod_align = 0; + + /* Save unaligned ptr to block hdr */ + hdr->unaligned_ptr = ptr; + + /* If ptr is not already aligned we calculate alignment shift */ + if (alignment && (uintptr_t)ptr % alignment) + mod_align = alignment - ((uintptr_t)ptr % alignment); + + /* Calculate aligned pointer */ + ptr = ptr + mod_align; + + return ptr; +} + /* allocate single block */ static void *alloc_block(struct mm_heap *heap, int level, - uint32_t caps) + uint32_t caps, uint32_t alignment) { struct block_map *map = &heap->map[level]; struct block_hdr *hdr; @@ -216,8 +237,11 @@ static void *alloc_block(struct mm_heap *heap, int level, map->free_count--; ptr = (void *)(map->base + map->first_free * map->block_size); + ptr = align_ptr(heap, alignment, ptr, hdr); + hdr->size = 1; hdr->used = 1; + heap->info.used += map->block_size; heap->info.free -= map->block_size; @@ -239,11 +263,11 @@ static void *alloc_block(struct mm_heap *heap, int level, /* allocates continuous blocks */ static void *alloc_cont_blocks(struct mm_heap *heap, int level, - uint32_t caps, size_t bytes) + uint32_t caps, size_t bytes, uint32_t alignment) { struct block_map *map = &heap->map[level]; struct block_hdr *hdr; - void *ptr; + void *ptr, *unaligned_ptr; unsigned int start = map->first_free; unsigned int current; unsigned int count = bytes / map->block_size; @@ -277,8 +301,13 @@ static void *alloc_cont_blocks(struct mm_heap *heap, int level, /* we found enough space, let's allocate it */ map->free_count -= count; ptr = (void *)(map->base + start * map->block_size); + unaligned_ptr = ptr; + hdr = &map->block[start]; hdr->size = count; + + ptr = align_ptr(heap, alignment, ptr, hdr); + heap->info.used += count * map->block_size; heap->info.free -= count * map->block_size; /* update first_free if needed */ @@ -296,6 +325,7 @@ static void *alloc_cont_blocks(struct mm_heap *heap, int level, for (current = start; current < start + count; current++) { hdr = &map->block[current]; hdr->used = 1; + hdr->unaligned_ptr = unaligned_ptr; } writeback_block_map(map); @@ -356,27 +386,43 @@ static struct mm_heap *get_heap_from_caps(struct mm_heap *heap, int count, } static void *get_ptr_from_heap(struct mm_heap *heap, int zone, uint32_t caps, - size_t bytes) + size_t bytes, uint32_t alignment) { struct block_map *map; - int i; + int i, temp_bytes = bytes; void *ptr = NULL; + /* Only allow alignment as a power of 2 */ + if ((alignment & (alignment - 1)) != 0) + panic(SOF_IPC_PANIC_MEM); + for (i = 0; i < heap->blocks; i++) { map = &heap->map[i]; dcache_invalidate_region(map, sizeof(*map)); + /* size of requested buffer is adjusted for alignment purposes + * we check if first free block is already aligned if not + * we need to allocate bigger size for alignment + */ + if ((map->base + (map->block_size * map->first_free)) + % alignment) + temp_bytes += alignment; + /* is block big enough */ - if (map->block_size < bytes) + if (map->block_size < temp_bytes) { + temp_bytes = bytes; continue; + } /* does block have free space */ - if (map->free_count == 0) + if (map->free_count == 0) { + temp_bytes = bytes; continue; + } /* free block space exists */ - ptr = alloc_block(heap, i, caps); + ptr = alloc_block(heap, i, caps, alignment); break; } @@ -428,14 +474,26 @@ static void free_block(void *ptr) /* calculate block header */ block = ((uint32_t)ptr - block_map->base) / block_map->block_size; - /* report an error if ptr is not aligned to block */ - if (block_map->base + block_map->block_size * block != (uint32_t)ptr) - panic(SOF_IPC_PANIC_MEM); - invalidate_blocks(block_map); hdr = &block_map->block[block]; + /* bring back original unaligned pointer position + * and calculate correct hdr for free operation (it could + * be from different block since we got user pointer here + * or null if header was not set) + */ + if (hdr->unaligned_ptr != ptr && hdr->unaligned_ptr) { + ptr = hdr->unaligned_ptr; + block = ((uint32_t)ptr - block_map->base) + / block_map->block_size; + hdr = &block_map->block[block]; + } + + /* report an error if ptr is not aligned to block */ + if (block_map->base + block_map->block_size * block != (uint32_t)ptr) + panic(SOF_IPC_PANIC_MEM); + /* free block header and continuous blocks */ used_blocks = block + hdr->size; @@ -443,6 +501,7 @@ static void free_block(void *ptr) hdr = &block_map->block[i]; hdr->size = 0; hdr->used = 0; + hdr->unaligned_ptr = NULL; block_map->free_count++; heap->info.used -= block_map->block_size; heap->info.free += block_map->block_size; @@ -547,7 +606,8 @@ static void *rmalloc_sys_runtime(int zone, int caps, int core, size_t bytes) if ((cpu_heap->caps & caps) != caps) panic(SOF_IPC_PANIC_MEM); - ptr = get_ptr_from_heap(cpu_heap, zone, caps, bytes); + ptr = get_ptr_from_heap(cpu_heap, zone, caps, bytes, + PLATFORM_DCACHE_ALIGN); /* other core should have the latest value */ if (core != cpu_get_id()) @@ -577,8 +637,8 @@ static void *rmalloc_runtime(int zone, uint32_t caps, size_t bytes) return NULL; } } - - return get_ptr_from_heap(heap, zone, caps, bytes); + return get_ptr_from_heap(heap, zone, caps, bytes, + PLATFORM_DCACHE_ALIGN); } static void *_malloc_unlocked(int zone, uint32_t caps, size_t bytes) @@ -657,26 +717,45 @@ void *rzalloc_core_sys(int core, size_t bytes) /* allocates continuous buffers - not for direct use, clients use rballoc() */ static void *alloc_heap_buffer(struct mm_heap *heap, int zone, uint32_t caps, - size_t bytes) + size_t bytes, uint32_t alignment) { struct block_map *map; - int i; + int i, temp_bytes = bytes; void *ptr = NULL; + /* Only allow alignment as a power of 2 */ + if ((alignment & (alignment - 1)) != 0) + panic(SOF_IPC_PANIC_MEM); + /* will request fit in single block */ for (i = 0; i < heap->blocks; i++) { map = &heap->map[i]; dcache_invalidate_region(map, sizeof(*map)); + /* size of requested buffer is adjusted for alignment purposes + * we check if first free block is already aligned if not + * we need to allocate bigger size for alignment + */ + if ((map->base + (map->block_size * map->first_free)) + % alignment) + temp_bytes += alignment; + /* Check if blocks are big enough and at least one is free */ - if (map->block_size >= bytes && map->free_count) { + if (map->block_size >= temp_bytes && map->free_count) { /* found: grab a block */ - ptr = alloc_block(heap, i, caps); + + ptr = alloc_block(heap, i, caps, alignment); break; } + temp_bytes = bytes; } + /* size of requested buffer is adjusted for alignment purposes + * since we span more blocks we have to assume worst case scenario + */ + bytes += alignment; + /* request spans > 1 block */ if (!ptr) { /* @@ -689,8 +768,9 @@ static void *alloc_heap_buffer(struct mm_heap *heap, int zone, uint32_t caps, dcache_invalidate_region(map, sizeof(*map)); /* allocate if block size is smaller than request */ - if (heap->size >= bytes && map->block_size < bytes) { - ptr = alloc_cont_blocks(heap, i, caps, bytes); + if (heap->size >= bytes && map->block_size < bytes) { + ptr = alloc_cont_blocks(heap, i, caps, + bytes, alignment); if (ptr) break; } @@ -702,13 +782,14 @@ static void *alloc_heap_buffer(struct mm_heap *heap, int zone, uint32_t caps, #if CONFIG_DEBUG_BLOCK_FREE if (ptr) - bzero(ptr, bytes); + bzero(ptr, temp_bytes); #endif return ptr; } -static void *_balloc_unlocked(int zone, uint32_t caps, size_t bytes) +static void *_balloc_unlocked(int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { struct mm_heap *heap; unsigned int i, n; @@ -722,7 +803,7 @@ static void *_balloc_unlocked(int zone, uint32_t caps, size_t bytes) if (!heap) break; - ptr = alloc_heap_buffer(heap, zone, caps, bytes); + ptr = alloc_heap_buffer(heap, zone, caps, bytes, alignment); if (ptr) break; @@ -733,14 +814,14 @@ static void *_balloc_unlocked(int zone, uint32_t caps, size_t bytes) } /* allocates continuous buffers - not for direct use, clients use rballoc() */ -void *_balloc(int zone, uint32_t caps, size_t bytes) +void *_balloc(int zone, uint32_t caps, size_t bytes, uint32_t alignment) { void *ptr = NULL; uint32_t flags; spin_lock_irq(memmap.lock, flags); - ptr = _balloc_unlocked(zone, caps, bytes); + ptr = _balloc_unlocked(zone, caps, bytes, alignment); spin_unlock_irq(memmap.lock, flags); @@ -809,7 +890,8 @@ void *_realloc(void *ptr, int zone, uint32_t caps, size_t bytes) return new_ptr; } -void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { void *new_ptr = NULL; uint32_t flags; @@ -819,7 +901,7 @@ void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes) spin_lock_irq(memmap.lock, flags); - new_ptr = _balloc_unlocked(zone, caps, bytes); + new_ptr = _balloc_unlocked(zone, caps, bytes, alignment); if (new_ptr && ptr) memcpy_s(new_ptr, bytes, ptr, bytes); diff --git a/src/platform/baytrail/include/platform/lib/memory.h b/src/platform/baytrail/include/platform/lib/memory.h index ea86f0c5e925..63a9de9a0bb3 100644 --- a/src/platform/baytrail/include/platform/lib/memory.h +++ b/src/platform/baytrail/include/platform/lib/memory.h @@ -16,6 +16,8 @@ void platform_init_memmap(void); #endif +#define PLATFORM_DCACHE_ALIGN sizeof(void *) + /* physical DSP addresses */ #define SHIM_BASE 0xFF340000 diff --git a/src/platform/haswell/include/platform/lib/memory.h b/src/platform/haswell/include/platform/lib/memory.h index 9b1c36f1b0b4..eb035e12bf59 100644 --- a/src/platform/haswell/include/platform/lib/memory.h +++ b/src/platform/haswell/include/platform/lib/memory.h @@ -16,8 +16,10 @@ void platform_init_memmap(void); #endif -/* physical DSP addresses */ +/* data cache line alignment */ +#define PLATFORM_DCACHE_ALIGN sizeof(void *) +/* physical DSP addresses */ #define SHIM_SIZE 0x00001000 @@ -97,7 +99,7 @@ void platform_init_memmap(void); #define HEAP_SYS_RT_COUNT1024 4 /* Heap configuration */ -#define SOF_DATA_SIZE 0xC000 +#define SOF_DATA_SIZE 0xD000 #define HEAP_SYSTEM_BASE (DRAM0_BASE + SOF_DATA_SIZE) #define HEAP_SYSTEM_SIZE 0x4000 diff --git a/src/platform/imx8/include/platform/lib/memory.h b/src/platform/imx8/include/platform/lib/memory.h index 97c12918aebc..c6b58cf9af80 100644 --- a/src/platform/imx8/include/platform/lib/memory.h +++ b/src/platform/imx8/include/platform/lib/memory.h @@ -13,6 +13,9 @@ #include #include +/* data cache line alignment */ +#define PLATFORM_DCACHE_ALIGN DCACHE_LINE_SIZE + /* physical DSP addresses */ #define IRAM_BASE 0x596f8000 diff --git a/src/platform/intel/cavs/include/cavs/lib/memory.h b/src/platform/intel/cavs/include/cavs/lib/memory.h index 26e5e40064ba..7cdb0e75035e 100644 --- a/src/platform/intel/cavs/include/cavs/lib/memory.h +++ b/src/platform/intel/cavs/include/cavs/lib/memory.h @@ -13,6 +13,9 @@ #include #include +/* data cache line alignment */ +#define PLATFORM_DCACHE_ALIGN DCACHE_LINE_SIZE + #define SRAM_BANK_SIZE (64 * 1024) #define EBB_BANKS_IN_SEGMENT 32 diff --git a/test/cmocka/src/audio/buffer/mock.c b/test/cmocka/src/audio/buffer/mock.c index 2352d0113046..050886b1e7fa 100644 --- a/test/cmocka/src/audio/buffer/mock.c +++ b/test/cmocka/src/audio/buffer/mock.c @@ -17,7 +17,7 @@ TRACE_IMPL() #if !CONFIG_LIBRARY -void *rzalloc(int zone, uint32_t caps, size_t bytes) +void *_zalloc(int zone, uint32_t caps, size_t bytes) { (void)zone; (void)caps; @@ -25,7 +25,8 @@ void *rzalloc(int zone, uint32_t caps, size_t bytes) return malloc(bytes); } -void *rballoc(int zone, uint32_t caps, size_t bytes) +void *_balloc(int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps; @@ -38,7 +39,8 @@ void rfree(void *ptr) free(ptr); } -void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps; diff --git a/test/cmocka/src/audio/component/mock.c b/test/cmocka/src/audio/component/mock.c index d75efde20eb0..1a9c5deeca0f 100644 --- a/test/cmocka/src/audio/component/mock.c +++ b/test/cmocka/src/audio/component/mock.c @@ -17,7 +17,7 @@ TRACE_IMPL() #if !CONFIG_LIBRARY -void *rzalloc(int zone, uint32_t caps, size_t bytes) +void *_zalloc(int zone, uint32_t caps, size_t bytes) { (void)zone; (void)caps; diff --git a/test/cmocka/src/audio/kpb/kpb_mock.c b/test/cmocka/src/audio/kpb/kpb_mock.c index 9590d8e0ad1e..6951625436ba 100644 --- a/test/cmocka/src/audio/kpb/kpb_mock.c +++ b/test/cmocka/src/audio/kpb/kpb_mock.c @@ -21,7 +21,8 @@ TRACE_IMPL() -void *rballoc(int zone, uint32_t caps, size_t bytes) +void *_balloc(int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps; @@ -29,7 +30,7 @@ void *rballoc(int zone, uint32_t caps, size_t bytes) return malloc(bytes); } -void *rzalloc(int zone, uint32_t caps, size_t bytes) +void *_zalloc(int zone, uint32_t caps, size_t bytes) { (void)zone; (void)caps; @@ -42,7 +43,8 @@ void rfree(void *ptr) free(ptr); } -void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps; diff --git a/test/cmocka/src/audio/mixer/mock.c b/test/cmocka/src/audio/mixer/mock.c index c470828c2a69..fed68cf29498 100644 --- a/test/cmocka/src/audio/mixer/mock.c +++ b/test/cmocka/src/audio/mixer/mock.c @@ -20,7 +20,8 @@ TRACE_IMPL() -void *rballoc(int zone, uint32_t caps, size_t bytes) +void *_balloc(int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps; @@ -28,7 +29,7 @@ void *rballoc(int zone, uint32_t caps, size_t bytes) return malloc(bytes); } -void *rzalloc(int zone, uint32_t caps, size_t bytes) +void *_zalloc(int zone, uint32_t caps, size_t bytes) { (void)zone; (void)caps; @@ -41,7 +42,8 @@ void rfree(void *ptr) free(ptr); } -void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes) +void *_brealloc(void *ptr, int zone, uint32_t caps, size_t bytes, + uint32_t alignment) { (void)zone; (void)caps;