Skip to content

Commit 19872fb

Browse files
marcinszkudlinskikv2019i
authored andcommitted
fix: remove cache ops for coherent architectures
For cache alignment, PLATFORM_DCACHE_ALIGN is a better macro than DCACHE_LINE_SIZE (for some compilations not even defined) For CONFIG_INCOHERENT=0 compilation, it does not make any sense to call writeback/invalidate operations Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent 72aaf78 commit 19872fb

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

src/include/sof/coherent.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <sof/lib/memory.h>
1818
#include <sof/lib/cpu.h>
1919

20-
#define __coherent __aligned(DCACHE_LINE_SIZE)
20+
#define __coherent __aligned(PLATFORM_DCACHE_ALIGN)
2121

2222
/*
2323
* The coherent API allows optimized access to memory by multiple cores, using
@@ -332,29 +332,17 @@ static inline void __coherent_shared_thread(struct coherent *c, const size_t siz
332332
__must_check static inline struct coherent __sparse_cache *coherent_acquire(struct coherent *c,
333333
const size_t size)
334334
{
335-
if (c->shared) {
336-
struct coherent __sparse_cache *cc = uncache_to_cache(c);
337-
335+
if (c->shared)
338336
c->key = k_spin_lock(&c->lock);
339337

340-
/* invalidate local copy */
341-
dcache_invalidate_region(cc, size);
342-
}
343-
344338
return (__sparse_force struct coherent __sparse_cache *)c;
345339
}
346340

347341
static inline void coherent_release(struct coherent __sparse_cache *c,
348342
const size_t size)
349343
{
350-
if (c->shared) {
351-
struct coherent *uc = cache_to_uncache(c);
352-
353-
/* wtb and inv local data to coherent object */
354-
dcache_writeback_invalidate_region(c, size);
355-
356-
k_spin_unlock(&uc->lock, uc->key);
357-
}
344+
if (c->shared)
345+
k_spin_unlock(&c->lock, c->key);
358346
}
359347

360348
static inline void *__coherent_init(size_t offset, const size_t size)

0 commit comments

Comments
 (0)