Skip to content

Commit

Permalink
mailbox: use uncached address to write sw regs
Browse files Browse the repository at this point in the history
mailbox_sw_regs_write is used by dai to update llp node. In multi-core
test, the updated llp node is invisable to other cores although
dcache_writeback_region is used on both cavs & ace platforms. Now use
uncached address to write memory directly which is aligned with other
mailbox access functions.

Validated on cavs & ace platforms.

Signed-off-by: Rander Wang <[email protected]>
  • Loading branch information
RanderWang authored and lgirdwood committed Nov 3, 2023
1 parent ba2cfe3 commit 195fed7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/platform/intel/ace/include/ace/lib/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ static inline uint64_t mailbox_sw_reg_read64(size_t offset)

static inline void mailbox_sw_regs_write(size_t offset, const void *src, size_t bytes)
{
int regs_write_err __unused = memcpy_s((void *)(MAILBOX_SW_REG_BASE + offset),
MAILBOX_SW_REG_SIZE - offset, src, bytes);
uint32_t __sparse_cache *ptr_c;
uint32_t *ptr;

assert(!regs_write_err);
dcache_writeback_region((__sparse_force void __sparse_cache *)(MAILBOX_SW_REG_BASE +
offset), bytes);
ptr_c = (uint32_t __sparse_cache *)(MAILBOX_SW_REG_BASE + offset);
ptr = cache_to_uncache(ptr_c);
memcpy_s(ptr, MAILBOX_SW_REG_SIZE - offset, src, bytes);
}

#endif /* __ACE_LIB_MAILBOX_H__ */
Expand Down
10 changes: 5 additions & 5 deletions src/platform/intel/cavs/include/cavs/lib/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ static inline uint64_t mailbox_sw_reg_read64(size_t offset)

static inline void mailbox_sw_regs_write(size_t offset, const void *src, size_t bytes)
{
int regs_write_err __unused = memcpy_s((void *)(MAILBOX_SW_REG_BASE + offset),
MAILBOX_SW_REG_SIZE - offset, src, bytes);
uint32_t __sparse_cache *ptr_c;
uint32_t *ptr;

assert(!regs_write_err);
dcache_writeback_region((__sparse_force void __sparse_cache *)(MAILBOX_SW_REG_BASE +
offset), bytes);
ptr_c = (uint32_t __sparse_cache *)(MAILBOX_SW_REG_BASE + offset);
ptr = cache_to_uncache(ptr_c);
memcpy_s(ptr, MAILBOX_SW_REG_SIZE - offset, src, bytes);
}

#endif /* __CAVS_LIB_MAILBOX_H__ */
Expand Down

0 comments on commit 195fed7

Please sign in to comment.