Skip to content
Closed
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
9 changes: 6 additions & 3 deletions src/idc/zephyr_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <rtos/alloc.h>
#include <rtos/spinlock.h>
#include <ipc/topology.h>
#if defined(CONFIG_ARCH_XTENSA) && !defined(CONFIG_KERNEL_COHERENCE)
#include <zephyr/arch/xtensa/cache.h>
#endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if these are not defined, wouldn't the build anyways fail when z_xtensa_cache_flush() is not defined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not remember why I did this, afaik this is the same in zephyr/lib/alloc.c

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i do we need to fix zephyr/lib/alloc.c or is this correct ?


/*
* Inter-CPU communication is only used in
Expand Down Expand Up @@ -62,7 +65,7 @@ static void idc_handler(struct k_p4wq_work *work)
int payload = -1;
k_spinlock_key_t key;

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

if (msg->size == sizeof(int)) {
const int idc_handler_memcpy_err __unused =
Expand Down Expand Up @@ -122,13 +125,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));
z_xtensa_cache_flush(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));
z_xtensa_cache_flush(msg_cp, sizeof(*msg_cp));
k_p4wq_submit(q_zephyr_idc + target_cpu, work);

switch (mode) {
Expand Down