Skip to contentSkip to conversation

ASoC: SOF: ipc4: Add core_id support from topology

PATCH In review Peter Ujfalusi 2 participants 5 messages Mar 7, 2023 – Mar 8, 2023

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

cover ASoC: SOF: ipc4: Add core_id support from topology

Hi,

The following series will add support for handling the core_id token which is needed for supporting multiple cores with complex topologies.

Regards,
Peter
---
Peter Ujfalusi (2):
ASoC: SOF: ipc4: Add macro to set the core_id in create_pipe message
ASoC: SOF: ipc4-topology: Add support for core_id for pipelines

Rander Wang (1):
ASoC: SOF: ipc4-topology: add core token in each module extended token
list

 include/sound/sof/ipc4/header.h |  4 ++++
 sound/soc/sof/ipc4-topology.c   | 13 ++++++++++---
 sound/soc/sof/ipc4-topology.h   |  2 ++
 3 files changed, 16 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH 1/3 ASoC: SOF: ipc4: Add macro to set the core_id in create_pipe message

The create pipeline message can carry the target code_id which is set to 0 at the moment.

Add macros to set the core_id in the message extension.

---
 include/sound/sof/ipc4/header.h | 4 ++++
 1 file changed, 4 insertions(+)
include/sound/sof/ipc4/header.h +4 -0
index d31349bf011d..49ff1558a171 100644
@@ -176,6 +176,10 @@ enum sof_ipc4_pipeline_state {
 #define SOF_IPC4_GLB_PIPE_EXT_LP_MASK		BIT(0)
 #define SOF_IPC4_GLB_PIPE_EXT_LP(x)		((x) << SOF_IPC4_GLB_PIPE_EXT_LP_SHIFT)
 
+#define SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT	20
+#define SOF_IPC4_GLB_PIPE_EXT_CORE_ID_MASK	GENMASK(23, 20)
+#define SOF_IPC4_GLB_PIPE_EXT_CORE_ID(x)	((x) << SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT)
+
 /* pipeline set state ipc msg */
 #define SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT		16
 #define SOF_IPC4_GLB_PIPE_STATE_ID_MASK		GENMASK(23, 16)
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 2/3 ASoC: SOF: ipc4-topology: Add support for core_id for pipelines

In reply to Peter Ujfalusi

Token SOF_TKN_SCHED_CORE in topology file can specify the target core for the pipeline, if it is missing it is going to be 0 (as it is right now).

Firmware will double-check all information retrieved by topology and report errors if required. This will allow policy and changes in topologies without a need for a synchronized kernel change.

---
 sound/soc/sof/ipc4-topology.c | 11 ++++++++---
 sound/soc/sof/ipc4-topology.h |  2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)
sound/soc/sof/ipc4-topology.c +8 -3
index 3e27c7a48ebd..12d8228d0828 100644
@@ -24,7 +24,9 @@ static DEFINE_IDA(pipeline_ida);
 
 static const struct sof_topology_token ipc4_sched_tokens[] = {
 	{SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
-		offsetof(struct sof_ipc4_pipeline, lp_mode)}
+		offsetof(struct sof_ipc4_pipeline, lp_mode)},
+	{SOF_TKN_SCHED_CORE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+		offsetof(struct sof_ipc4_pipeline, core_id)},
 };
 
 static const struct sof_topology_token pipeline_tokens[] = {
@@ -629,6 +631,8 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
 		goto err;
 	}
 
+	swidget->core = pipeline->core_id;
+
 	/* parse one set of pipeline tokens */
 	ret = sof_update_ipc_object(scomp, swidget, SOF_PIPELINE_TOKENS, swidget->tuples,
 				    swidget->num_tuples, sizeof(*swidget), 1);
@@ -640,9 +644,9 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
 	/* TODO: Get priority from topology */
 	pipeline->priority = 0;
 
-	dev_dbg(scomp->dev, "pipeline '%s': id %d pri %d lp mode %d\n",
+	dev_dbg(scomp->dev, "pipeline '%s': id %d, pri %d, core_id %u, lp mode %d\n",
 		swidget->widget->name, swidget->pipeline_id,
-		pipeline->priority, pipeline->lp_mode);
+		pipeline->priority, pipeline->core_id, pipeline->lp_mode);
 
 	swidget->private = pipeline;
 
@@ -652,6 +656,7 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
 	pipeline->msg.primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG);
 
 	pipeline->msg.extension = pipeline->lp_mode;
+	pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_CORE_ID(pipeline->core_id);
 	pipeline->state = SOF_IPC4_PIPE_UNINITIALIZED;
 
 	return 0;
sound/soc/sof/ipc4-topology.h +2 -0
index 8507171a6e4d..7877f0638011 100644
@@ -117,6 +117,7 @@ struct sof_ipc4_copier_config_set_sink_format {
  * @priority: Priority of this pipeline
  * @lp_mode: Low power mode
  * @mem_usage: Memory usage
+ * @core_id: Target core for the pipeline
  * @state: Pipeline state
  * @msg: message structure for pipeline
  * @skip_during_fe_trigger: skip triggering this pipeline during the FE DAI trigger
@@ -125,6 +126,7 @@ struct sof_ipc4_pipeline {
 	uint32_t priority;
 	uint32_t lp_mode;
 	uint32_t mem_usage;
+	uint32_t core_id;
 	int state;
 	struct sof_ipc4_msg msg;
 	bool skip_during_fe_trigger;
Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH 3/3 ASoC: SOF: ipc4-topology: add core token in each module extended token list

In reply to Peter Ujfalusi

From: Rander Wang <[email protected]>

Add core token in extended token list for each module to support multi-core feature.

---
 sound/soc/sof/ipc4-topology.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/sof/ipc4-topology.c +2 -0
index 12d8228d0828..b27d85a68426 100644
@@ -102,6 +102,8 @@ static const struct sof_topology_token dai_tokens[] = {
 static const struct sof_topology_token comp_ext_tokens[] = {
 	{SOF_TKN_COMP_UUID, SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_uuid,
 		offsetof(struct snd_sof_widget, uuid)},
+	{SOF_TKN_COMP_CORE_ID, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+		offsetof(struct snd_sof_widget, core)},
 };
 
 static const struct sof_topology_token gain_tokens[] = {
Signature · 1 line
2.39.2
maintainer
#4 lore raw
In reply to Peter Ujfalusi
Quoted 6 lines · Peter Ujfalusi

The following series will add support for handling the core_id token which is needed for supporting multiple cores with complex topologies.

Regards,
Peter

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: SOF: ipc4: Add macro to set the core_id in create_pipe message

      commit: 11f45690b3f6c6a2b5c57dbb036df3f838f7c016
[2/3] ASoC: SOF: ipc4-topology: Add support for core_id for pipelines
      commit: 05ade472278a1a2fccc465ace205d6cfa9b521d5
[3/3] ASoC: SOF: ipc4-topology: add core token in each module extended token list
      commit: 755ddc3acd50ca70e46b032c5c4a078e7b1b7d46

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark