Skip to content

Commit 0376b99

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: ipc4-topology: Add core_mask in struct snd_sof_pipeline
With IPC4, a pipeline may contain multiple modules in the data processing domain and they can be scheduled to run on different cores. Add a new field in struct snd_sof_pipeline to keep track of all the cores that are associated with the modules in the pipeline. Set the pipeline core mask for IPC3 when initializing the pipeline widget IPC structure. For IPC4, set the core mark when initializing the pipeline widget and initializing processing modules in the data processing domain. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20231124135743.24674-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 347ecf2 commit 0376b99

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

sound/soc/sof/ipc3-topology.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ static int sof_ipc3_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
493493
static int sof_ipc3_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
494494
{
495495
struct snd_soc_component *scomp = swidget->scomp;
496+
struct snd_sof_pipeline *spipe = swidget->spipe;
496497
struct sof_ipc_pipe_new *pipeline;
497498
struct snd_sof_widget *comp_swidget;
498499
int ret;
@@ -545,6 +546,7 @@ static int sof_ipc3_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
545546
swidget->dynamic_pipeline_widget);
546547

547548
swidget->core = pipeline->core;
549+
spipe->core_mask |= BIT(pipeline->core);
548550

549551
return 0;
550552

sound/soc/sof/ipc4-topology.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
656656
{
657657
struct snd_soc_component *scomp = swidget->scomp;
658658
struct sof_ipc4_pipeline *pipeline;
659+
struct snd_sof_pipeline *spipe = swidget->spipe;
659660
int ret;
660661

661662
pipeline = kzalloc(sizeof(*pipeline), GFP_KERNEL);
@@ -670,6 +671,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
670671
}
671672

672673
swidget->core = pipeline->core_id;
674+
spipe->core_mask |= BIT(pipeline->core_id);
673675

674676
if (pipeline->use_chain_dma) {
675677
dev_dbg(scomp->dev, "Set up chain DMA for %s\n", swidget->widget->name);
@@ -797,6 +799,7 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
797799
static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
798800
{
799801
struct snd_soc_component *scomp = swidget->scomp;
802+
struct snd_sof_pipeline *spipe = swidget->spipe;
800803
struct sof_ipc4_src *src;
801804
int ret;
802805

@@ -819,6 +822,8 @@ static int sof_ipc4_widget_setup_comp_src(struct snd_sof_widget *swidget)
819822
goto err;
820823
}
821824

825+
spipe->core_mask |= BIT(swidget->core);
826+
822827
dev_dbg(scomp->dev, "SRC sink rate %d\n", src->sink_rate);
823828

824829
ret = sof_ipc4_widget_setup_msg(swidget, &src->msg);
@@ -864,6 +869,7 @@ static int sof_ipc4_widget_setup_comp_process(struct snd_sof_widget *swidget)
864869
{
865870
struct snd_soc_component *scomp = swidget->scomp;
866871
struct sof_ipc4_fw_module *fw_module;
872+
struct snd_sof_pipeline *spipe = swidget->spipe;
867873
struct sof_ipc4_process *process;
868874
void *cfg;
869875
int ret;
@@ -920,6 +926,9 @@ static int sof_ipc4_widget_setup_comp_process(struct snd_sof_widget *swidget)
920926

921927
sof_ipc4_widget_update_kcontrol_module_id(swidget);
922928

929+
/* set pipeline core mask to keep track of the core the module is scheduled to run on */
930+
spipe->core_mask |= BIT(swidget->core);
931+
923932
return 0;
924933
free_base_cfg_ext:
925934
kfree(process->base_config_ext);

sound/soc/sof/sof-audio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,15 @@ struct snd_sof_widget {
480480
* @paused_count: Count of number of PCM's that have started and have currently paused this
481481
pipeline
482482
* @complete: flag used to indicate that pipeline set up is complete.
483+
* @core_mask: Mask containing target cores for all modules in the pipeline
483484
* @list: List item in sdev pipeline_list
484485
*/
485486
struct snd_sof_pipeline {
486487
struct snd_sof_widget *pipe_widget;
487488
int started_count;
488489
int paused_count;
489490
int complete;
491+
unsigned long core_mask;
490492
struct list_head list;
491493
};
492494

0 commit comments

Comments
 (0)