Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/include/sof/audio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,18 @@ bool buffer_params_match(struct comp_buffer *buffer,

static inline void buffer_stream_invalidate(struct comp_buffer *buffer, uint32_t bytes)
{
#if CONFIG_INCOHERENT
if (buffer->is_shared)
audio_stream_invalidate(&buffer->stream, bytes);
#endif
}

static inline void buffer_stream_writeback(struct comp_buffer *buffer, uint32_t bytes)
{
#if CONFIG_INCOHERENT
if (buffer->is_shared)
audio_stream_writeback(&buffer->stream, bytes);
#endif
}


Expand Down
20 changes: 4 additions & 16 deletions src/include/sof/coherent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <sof/lib/memory.h>
#include <sof/lib/cpu.h>

#define __coherent __aligned(DCACHE_LINE_SIZE)
#define __coherent __aligned(PLATFORM_DCACHE_ALIGN)

/*
* The coherent API allows optimized access to memory by multiple cores, using
Expand Down Expand Up @@ -332,29 +332,17 @@ static inline void __coherent_shared_thread(struct coherent *c, const size_t siz
__must_check static inline struct coherent __sparse_cache *coherent_acquire(struct coherent *c,
const size_t size)
{
if (c->shared) {
struct coherent __sparse_cache *cc = uncache_to_cache(c);

if (c->shared)
c->key = k_spin_lock(&c->lock);

/* invalidate local copy */
dcache_invalidate_region(cc, size);
}

return (__sparse_force struct coherent __sparse_cache *)c;
}

static inline void coherent_release(struct coherent __sparse_cache *c,
const size_t size)
{
if (c->shared) {
struct coherent *uc = cache_to_uncache(c);

/* wtb and inv local data to coherent object */
dcache_writeback_invalidate_region(c, size);

k_spin_unlock(&uc->lock, uc->key);
}
if (c->shared)
k_spin_unlock(&c->lock, c->key);
}

static inline void *__coherent_init(size_t offset, const size_t size)
Expand Down
5 changes: 4 additions & 1 deletion src/ipc/ipc-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,12 @@ int comp_buffer_connect(struct comp_dev *comp, uint32_t comp_core,
{
/* check if it's a connection between cores */
if (buffer->core != comp_core) {
#if CONFIG_INCOHERENT
/* buffer must be shared */
assert(buffer->is_shared);

#else
buffer->is_shared = true;
#endif
if (!comp->is_shared)
comp_make_shared(comp);
}
Expand Down