Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/include/sof/coherent.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ static inline void coherent_release(struct coherent __sparse_cache *c,

static inline void *__coherent_init(size_t offset, const size_t size)
{
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM, size);
/*
* Allocate an object with an uncached alias but align size on a cache-
* line boundary to avoid sharing a cache line with the adjacent
* allocation
*/
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
ALIGN_UP(size, PLATFORM_DCACHE_ALIGN));
struct coherent *c;

if (!object)
Expand Down Expand Up @@ -245,7 +251,9 @@ static inline void coherent_release_thread(struct coherent __sparse_cache *c,

static inline void *__coherent_init_thread(size_t offset, const size_t size)
{
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM, size);
/* As above - prevent cache line sharing */
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
ALIGN_UP(size, PLATFORM_DCACHE_ALIGN));
struct coherent *c;

if (!object)
Expand Down Expand Up @@ -331,7 +339,9 @@ static inline void coherent_release(struct coherent __sparse_cache *c,

static inline void *__coherent_init(size_t offset, const size_t size)
{
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM, size);
/* As in CONFIG_INCOHERENT case - prevent cache line sharing */
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
ALIGN_UP(size, PLATFORM_DCACHE_ALIGN));
struct coherent *c;

if (!object)
Expand Down Expand Up @@ -394,11 +404,7 @@ static inline void coherent_release_thread(struct coherent __sparse_cache *c,

static inline void *__coherent_init_thread(size_t offset, const size_t size)
{
/*
* Allocate an object with an uncached alias but align size on a cache-
* line boundary to avoid sharing a cache line with the adjacent
* allocation
*/
/* As above - prevent cache line sharing */
void *object = rzalloc(SOF_MEM_ZONE_RUNTIME_SHARED, 0, SOF_MEM_CAPS_RAM,
ALIGN_UP(size, PLATFORM_DCACHE_ALIGN));
struct coherent *c;
Expand Down