Skip to content

Commit 25177ec

Browse files
PoC: handle cross-core multi-pipeline-set-state
For cross-core multi-pipeline-set-state fallback to old behaviour to maintain compatibility. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 1640ca5 commit 25177ec

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

src/ipc/ipc4/handler-user.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,12 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
513513
return ret;
514514
}
515515

516+
bool delayed = false;
517+
int prev_core = -1;
518+
516519
/* Run the trigger phase on the pipelines */
517520
for (i = 0; i < ppl_count; i++) {
518-
bool delayed = false;
521+
/// bool delayed = false;
519522

520523
ppl_icd = ipc_get_comp_by_ppl_id(ipc, COMP_TYPE_PIPELINE,
521524
ppl_id[i], IPC_COMP_IGNORE_REMOTE);
@@ -529,22 +532,40 @@ static int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4)
529532
*/
530533
if (!cpu_is_me(ppl_icd->core)) {
531534
if (use_idc) {
535+
536+
if (delayed && prev_core >= 0 && prev_core != ppl_icd->core) {
537+
if (ipc_wait_for_compound_msg() != 0) {
538+
ipc_cmd_err(&ipc_tr, "ipc4: fail with delayed trigger");
539+
return IPC4_FAILURE;
540+
}
541+
}
542+
532543
struct idc_msg msg = { IDC_MSG_PPL_STATE,
533544
IDC_MSG_PPL_STATE_EXT(ppl_id[i],
534545
IDC_PPL_STATE_PHASE_TRIGGER),
535546
ppl_icd->core,
536547
sizeof(cmd), &cmd, };
537548

538549
ret = idc_send_msg(&msg, IDC_BLOCKING);
550+
delayed = (ret >= 0);
539551
} else {
552+
assert(false); ///!!! THIS SHOULD NEVER HAPPEN!!!
540553
return ipc4_process_on_core(ppl_icd->core, false);
541554
}
542555
} else {
556+
if (delayed && prev_core >= 0 && prev_core != ppl_icd->core) {
557+
if (ipc_wait_for_compound_msg() != 0) {
558+
ipc_cmd_err(&ipc_tr, "ipc4: fail with delayed trigger");
559+
return IPC4_FAILURE;
560+
}
561+
}
562+
543563
ipc_compound_pre_start(state.primary.r.type);
544564
ret = ipc4_pipeline_trigger(ppl_icd, cmd, &delayed);
545565
ipc_compound_post_start(state.primary.r.type, ret, delayed);
546-
delayed = false; ///!!!
547-
if (delayed) {
566+
567+
#if 0
568+
if (delayed /* && use_idc */) {
548569
/* To maintain pipeline order for triggers, we must
549570
* do a blocking wait until trigger is processed.
550571
* This will add a max delay of 'ppl_count' LL ticks
@@ -555,8 +576,11 @@ delayed = false; ///!!!
555576
return IPC4_FAILURE;
556577
}
557578
}
579+
#endif // 0
558580
}
559581

582+
prev_core = ppl_icd->core;
583+
560584
if (ret != 0)
561585
return ret;
562586
}

0 commit comments

Comments
 (0)