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>
This commit is contained in:
Keyon Jie 2021-09-06 17:11:41 +08:00 committed by Liam Girdwood
parent 4681db38da
commit 7378b2489a
2 changed files with 13 additions and 0 deletions

View File

@ -12,3 +12,12 @@ config DEBUG_BLOCK_FREE
already freed block of memory. Enabling this feature increases
number of memory writes and reads, due to checks for memory patterns
that may be performed on allocation and deallocation.
config DEBUG_FORCE_COHERENT_BUFFER
bool "Force the allocator to allocate coherent buffer only"
default n
help
Select if we want to force the allocator to return coherent/uncached
buffer only.
This should be selected for debug purpose only, as accessing buffer
without caching it will reduce the read/write performance.

View File

@ -921,8 +921,12 @@ static void *_balloc_unlocked(uint32_t flags, uint32_t caps, size_t bytes,
if (!ptr)
return ptr;
#ifdef CONFIG_DEBUG_FORCE_COHERENT_BUFFER
return cache_to_uncache(ptr);
#else
return (flags & SOF_MEM_FLAG_COHERENT) && (CONFIG_CORE_COUNT > 1) ?
cache_to_uncache(ptr) : uncache_to_cache(ptr);
#endif
}
/* allocates continuous buffers - not for direct use, clients use rballoc() */