Skip to content

Commit a221aff

Browse files
committed
zephyr: use system cache API
Use zephyr cache APIs instead of xtensa specific ones. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent e5eb7df commit a221aff

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/idc/zephyr_idc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121

2222
#include <zephyr/kernel.h>
23+
#include <zephyr/cache.h>
2324

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

65-
SOC_DCACHE_INVALIDATE(msg, sizeof(*msg));
66+
sys_cache_data_flush_range(msg, sizeof(*msg));
6667

6768
if (msg->size == sizeof(int)) {
6869
const int idc_handler_memcpy_err __unused =
@@ -122,13 +123,13 @@ int idc_send_msg(struct idc_msg *msg, uint32_t mode)
122123
msg->payload, msg->size);
123124
assert(!idc_send_memcpy_err);
124125

125-
SOC_DCACHE_FLUSH(payload->data, MIN(sizeof(payload->data), msg->size));
126+
sys_cache_data_flush_range(payload->data, MIN(sizeof(payload->data), msg->size));
126127
}
127128

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

131-
SOC_DCACHE_FLUSH(msg_cp, sizeof(*msg_cp));
132+
sys_cache_data_flush_range(msg_cp, sizeof(*msg_cp));
132133
k_p4wq_submit(q_zephyr_idc + target_cpu, work);
133134

134135
switch (mode) {

zephyr/lib/alloc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
#include <zephyr/pm/policy.h>
2626
#include <version.h>
2727
#include <zephyr/sys/__assert.h>
28+
#include <zephyr/cache.h>
2829
#include <soc.h>
2930

30-
#if defined(CONFIG_ARCH_XTENSA) && !defined(CONFIG_KERNEL_COHERENCE)
31-
#include <zephyr/arch/xtensa/cache.h>
32-
#endif
33-
3431
#if CONFIG_SYS_HEAP_RUNTIME_STATS && CONFIG_IPC_MAJOR_4
3532
#include <zephyr/sys/sys_heap.h>
3633
#endif
@@ -216,7 +213,8 @@ static void heap_free(struct k_heap *h, void *mem)
216213

217214
if (is_cached(mem)) {
218215
mem_uncached = z_soc_uncached_ptr((__sparse_force void __sparse_cache *)mem);
219-
z_xtensa_cache_flush_inv(mem, sys_heap_usable_size(&h->heap, mem_uncached));
216+
sys_cache_data_flush_and_invd_range(mem,
217+
sys_heap_usable_size(&h->heap, mem_uncached));
220218

221219
mem = mem_uncached;
222220
}

0 commit comments

Comments
 (0)