Skip to content

Commit 7378b24

Browse files
keyonjielgirdwood
authored andcommittedSep 29, 2021
Kconfig: use uncached buffer only for debugging
To rule out buffer coherency issue, it is useful to add a debug option with which selected only coherent/uncached buffer will be used. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1 parent 4681db3 commit 7378b24

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
 

‎Kconfig.xtos-dbg

+9
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ config DEBUG_BLOCK_FREE
1212
already freed block of memory. Enabling this feature increases
1313
number of memory writes and reads, due to checks for memory patterns
1414
that may be performed on allocation and deallocation.
15+
16+
config DEBUG_FORCE_COHERENT_BUFFER
17+
bool "Force the allocator to allocate coherent buffer only"
18+
default n
19+
help
20+
Select if we want to force the allocator to return coherent/uncached
21+
buffer only.
22+
This should be selected for debug purpose only, as accessing buffer
23+
without caching it will reduce the read/write performance.

‎src/lib/alloc.c

+4
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,12 @@ static void *_balloc_unlocked(uint32_t flags, uint32_t caps, size_t bytes,
921921
if (!ptr)
922922
return ptr;
923923

924+
#ifdef CONFIG_DEBUG_FORCE_COHERENT_BUFFER
925+
return cache_to_uncache(ptr);
926+
#else
924927
return (flags & SOF_MEM_FLAG_COHERENT) && (CONFIG_CORE_COUNT > 1) ?
925928
cache_to_uncache(ptr) : uncache_to_cache(ptr);
929+
#endif
926930
}
927931

928932
/* allocates continuous buffers - not for direct use, clients use rballoc() */

0 commit comments

Comments
 (0)