Skip to content

Commit

Permalink
Kconfig: use uncached buffer only for debugging
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
keyonjie authored and lgirdwood committed Sep 29, 2021
1 parent 4681db3 commit 7378b24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Kconfig.xtos-dbg
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions src/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() */
Expand Down

0 comments on commit 7378b24

Please sign in to comment.