Skip to content

Commit 3e42e12

Browse files
author
Jyri Sarha
committed
ipc4: helper: Do not invalidate cache of whole mailbox for pipe create
Invalidate cache for only the create pipleine payload size not whole mailbox. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent b3aa333 commit 3e42e12

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/ipc/ipc4/helper.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,14 @@ __cold static int ipc4_create_pipeline_payload_decode(char *data)
238238
const struct ipc4_pipeline_ext_payload *hdr =
239239
(struct ipc4_pipeline_ext_payload *)data;
240240
const struct ipc4_pipeline_ext_object *obj;
241-
size_t size = hdr->payload_words * sizeof(uint32_t);
242-
bool last_object = !hdr->data_obj_array;
241+
size_t hdr_cache_size = ALIGN_UP(sizeof(*hdr), CONFIG_DCACHE_LINE_SIZE);
242+
bool last_object;
243+
size_t size;
244+
245+
dcache_invalidate_region((__sparse_force void __sparse_cache *)MAILBOX_HOSTBOX_BASE,
246+
hdr_cache_size);
247+
size = hdr->payload_words * sizeof(uint32_t);
248+
last_object = !hdr->data_obj_array;
243249

244250
if (hdr->payload_words * sizeof(uint32_t) < sizeof(*hdr)) {
245251
tr_err(&ipc_tr, "Payload size too small: %u : %#x", hdr->payload_words,
@@ -250,6 +256,12 @@ __cold static int ipc4_create_pipeline_payload_decode(char *data)
250256
tr_info(&ipc_tr, "payload size %u array %u: %#x", hdr->payload_words, hdr->data_obj_array,
251257
*((uint32_t *)hdr));
252258

259+
if (ALIGN_UP(size, CONFIG_DCACHE_LINE_SIZE) > hdr_cache_size)
260+
dcache_invalidate_region((__sparse_force void __sparse_cache *)
261+
((char *)MAILBOX_HOSTBOX_BASE + hdr_cache_size),
262+
ALIGN_UP(size, CONFIG_DCACHE_LINE_SIZE) -
263+
hdr_cache_size);
264+
253265
obj = (const struct ipc4_pipeline_ext_object *)(hdr + 1);
254266
while (!last_object) {
255267
const struct ipc4_pipeline_ext_object *next_obj;
@@ -384,8 +396,6 @@ __cold int ipc_pipeline_new(struct ipc *ipc, ipc_pipe_new *_pipe_desc)
384396
if (pipe_desc->extension.r.payload) {
385397
char *data;
386398

387-
dcache_invalidate_region((__sparse_force void __sparse_cache *)MAILBOX_HOSTBOX_BASE,
388-
MAILBOX_HOSTBOX_SIZE);
389399
data = ipc4_get_pipe_create_data();
390400

391401
ipc4_create_pipeline_payload_decode(data);

0 commit comments

Comments
 (0)