Skip to content
Closed
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
7 changes: 4 additions & 3 deletions src/idc/zephyr_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

#include <zephyr/kernel.h>
#include <zephyr/cache.h>

#include <zephyr/sys/p4wq.h>
#include <rtos/idc.h>
Expand Down Expand Up @@ -62,7 +63,7 @@ static void idc_handler(struct k_p4wq_work *work)
int payload = -1;
k_spinlock_key_t key;

SOC_DCACHE_INVALIDATE(msg, sizeof(*msg));
sys_cache_data_flush_range(msg, sizeof(*msg));

if (msg->size == sizeof(int)) {
const int idc_handler_memcpy_err __unused =
Expand Down Expand Up @@ -122,13 +123,13 @@ int idc_send_msg(struct idc_msg *msg, uint32_t mode)
msg->payload, msg->size);
assert(!idc_send_memcpy_err);

SOC_DCACHE_FLUSH(payload->data, MIN(sizeof(payload->data), msg->size));
sys_cache_data_flush_range(payload->data, MIN(sizeof(payload->data), msg->size));
}

/* Temporarily store sender core ID */
msg_cp->core = cpu_get_id();

SOC_DCACHE_FLUSH(msg_cp, sizeof(*msg_cp));
sys_cache_data_flush_range(msg_cp, sizeof(*msg_cp));
k_p4wq_submit(q_zephyr_idc + target_cpu, work);

switch (mode) {
Expand Down
8 changes: 3 additions & 5 deletions zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
#include <zephyr/pm/policy.h>
#include <version.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/cache.h>
#include <soc.h>

#if defined(CONFIG_ARCH_XTENSA) && !defined(CONFIG_KERNEL_COHERENCE)
#include <zephyr/arch/xtensa/cache.h>
#endif

#if CONFIG_SYS_HEAP_RUNTIME_STATS && CONFIG_IPC_MAJOR_4
#include <zephyr/sys/sys_heap.h>
#endif
Expand Down Expand Up @@ -216,7 +213,8 @@ static void heap_free(struct k_heap *h, void *mem)

if (is_cached(mem)) {
mem_uncached = z_soc_uncached_ptr((__sparse_force void __sparse_cache *)mem);
z_xtensa_cache_flush_inv(mem, sys_heap_usable_size(&h->heap, mem_uncached));
sys_cache_data_flush_and_invd_range(mem,
sys_heap_usable_size(&h->heap, mem_uncached));

mem = mem_uncached;
}
Expand Down