Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDC: fix message cache handling #8189

Merged
merged 1 commit into from
Sep 14, 2023
Merged
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
5 changes: 4 additions & 1 deletion src/idc/zephyr_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static void idc_handler(struct k_p4wq_work *work)
int payload = -1;
k_spinlock_key_t key;

sys_cache_data_flush_range(msg, sizeof(*msg));
/* A message is received from another core, invalidate local cache */
sys_cache_data_invd_range(msg, sizeof(*msg));

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

/* Sending a message to another core, write back local payload cache */
sys_cache_data_flush_range(payload->data, MIN(sizeof(payload->data), msg->size));
}

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

/* Sending a message to another core, write back local message cache */
sys_cache_data_flush_range(msg_cp, sizeof(*msg_cp));
k_p4wq_submit(q_zephyr_idc + target_cpu, work);

Expand Down
Loading