From a90132560cfa1204bf694ef670f88cbac92e8cc0 Mon Sep 17 00:00:00 2001 From: Marcin Szkudlinski Date: Wed, 3 Jul 2024 13:47:16 +0200 Subject: [PATCH] kconfig: add PIPELINE_2_0 flag This flag enables changes to new pipeline structure, known as pipeline2_0 It is required for certain new features, like DP_SCHEDULER. The changes are incremental and at the moment pipeline 2.0 is fully backward compatible with legacy platforms, however it generates some overhead in data and code, so it is useful to turn if off if not needed Signed-off-by: Marcin Szkudlinski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 + app/boards/intel_adsp_ace20_lnl.conf | 1 + app/boards/intel_adsp_ace30_ptl.conf | 1 + src/audio/audio_stream.c | 6 +++--- src/audio/buffer.c | 8 ++++---- src/audio/module_adapter/module_adapter.c | 6 +++--- src/include/sof/audio/audio_stream.h | 4 ++-- src/include/sof/audio/buffer.h | 4 ++-- zephyr/CMakeLists.txt | 2 +- zephyr/Kconfig | 9 +++++++++ 10 files changed, 27 insertions(+), 15 deletions(-) diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index fa809d91f554..85f99bb99e2b 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -33,6 +33,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y CONFIG_DAI_DMIC_HAS_OWNERSHIP=y CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y CONFIG_DAI_INTEL_SSP=y +CONFIG_PIPELINE_2_0=y CONFIG_ZEPHYR_DP_SCHEDULER=y CONFIG_DMA=y CONFIG_DMA_INTEL_ADSP_GPDMA=y diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 2f02c150b828..be7f1b4f9cff 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -29,6 +29,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y CONFIG_DAI_DMIC_HAS_OWNERSHIP=n CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y CONFIG_DAI_INTEL_SSP=y +CONFIG_PIPELINE_2_0=y CONFIG_ZEPHYR_DP_SCHEDULER=y CONFIG_DMA=y CONFIG_DMA_INTEL_ADSP_GPDMA=n diff --git a/app/boards/intel_adsp_ace30_ptl.conf b/app/boards/intel_adsp_ace30_ptl.conf index cac5d9d2118a..050ff987369b 100644 --- a/app/boards/intel_adsp_ace30_ptl.conf +++ b/app/boards/intel_adsp_ace30_ptl.conf @@ -28,6 +28,7 @@ CONFIG_DAI_INTEL_DMIC_NHLT=y CONFIG_DAI_DMIC_HAS_OWNERSHIP=n CONFIG_DAI_DMIC_HAS_MULTIPLE_LINE_SYNC=y CONFIG_DAI_INTEL_SSP=y +CONFIG_PIPELINE_2_0=y CONFIG_ZEPHYR_DP_SCHEDULER=y CONFIG_DMA=y CONFIG_DMA_INTEL_ADSP_GPDMA=n diff --git a/src/audio/audio_stream.c b/src/audio/audio_stream.c index 35ffc243c180..855a67ae3b04 100644 --- a/src/audio/audio_stream.c +++ b/src/audio/audio_stream.c @@ -207,7 +207,7 @@ void audio_stream_init(struct audio_stream *audio_stream, void *buff_addr, uint3 } /* get a handler to source API */ -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 struct sof_source *audio_stream_get_source(struct audio_stream *audio_stream) { return audio_stream->secondary_buffer_source ? @@ -222,7 +222,7 @@ struct sof_sink *audio_stream_get_sink(struct audio_stream *audio_stream) &audio_stream->_sink_api; } -#else /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#else /* CONFIG_PIPELINE_2_0 */ struct sof_source *audio_stream_get_source(struct audio_stream *audio_stream) { @@ -233,4 +233,4 @@ struct sof_sink *audio_stream_get_sink(struct audio_stream *audio_stream) { return &audio_stream->_sink_api; } -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ diff --git a/src/audio/buffer.c b/src/audio/buffer.c index 0b3cb7f94623..1e2d4b5c1eb5 100644 --- a/src/audio/buffer.c +++ b/src/audio/buffer.c @@ -95,7 +95,7 @@ struct comp_buffer *buffer_alloc(size_t size, uint32_t caps, uint32_t flags, uin return buffer; } -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 int buffer_attach_secondary_buffer(struct comp_buffer *buffer, bool at_input, struct sof_audio_buffer *secondary_buffer) { @@ -153,7 +153,7 @@ int buffer_sync_secondary_buffer(struct comp_buffer *buffer, size_t limit) err = source_to_sink_copy(data_src, data_dst, true, to_copy); return err; } -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ struct comp_buffer *buffer_alloc_range(size_t preferred_size, size_t minimum_size, uint32_t caps, uint32_t flags, uint32_t align, bool is_shared) @@ -377,10 +377,10 @@ void buffer_free(struct comp_buffer *buffer) /* In case some listeners didn't unregister from buffer's callbacks */ notifier_unregister_all(NULL, buffer); -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 audio_buffer_free(buffer->stream.secondary_buffer_sink); audio_buffer_free(buffer->stream.secondary_buffer_source); -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ rfree(buffer->stream.addr); rfree(buffer); } diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index c4fe874b9cfb..149bc04400b2 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -902,7 +902,7 @@ static int module_adapter_audio_stream_type_copy(struct comp_dev *dev) return ret; } -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 static int module_adapter_copy_ring_buffers(struct comp_dev *dev) { /* @@ -960,12 +960,12 @@ static int module_adapter_copy_ring_buffers(struct comp_dev *dev) } return 0; } -#else +#else /* CONFIG_PIPELINE_2_0 */ static inline int module_adapter_copy_ring_buffers(struct comp_dev *dev) { return -ENOTSUP; } -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ static int module_adapter_sink_source_copy(struct comp_dev *dev) { diff --git a/src/include/sof/audio/audio_stream.h b/src/include/sof/audio/audio_stream.h index d360e5d3df74..0f73e6f3c84a 100644 --- a/src/include/sof/audio/audio_stream.h +++ b/src/include/sof/audio/audio_stream.h @@ -63,7 +63,7 @@ struct audio_stream { void *end_addr; /**< Buffer end address */ uint8_t byte_align_req; uint8_t frame_align_req; -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 /** * sink API of an additional buffer * of any type at data input @@ -75,7 +75,7 @@ struct audio_stream { * at data output */ struct sof_audio_buffer *secondary_buffer_source; -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ /* runtime stream params */ struct sof_audio_stream_params runtime_stream_params; diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index d373486810be..db758f3a8ca3 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -190,7 +190,7 @@ struct comp_buffer *buffer_alloc(size_t size, uint32_t caps, uint32_t flags, uin struct comp_buffer *buffer_alloc_range(size_t preferred_size, size_t minimum_size, uint32_t caps, uint32_t flags, uint32_t align, bool is_shared); struct comp_buffer *buffer_new(const struct sof_ipc_buffer *desc, bool is_shared); -#if CONFIG_ZEPHYR_DP_SCHEDULER +#if CONFIG_PIPELINE_2_0 /* * attach a secondary buffer (any type) before buffer (when at_input == true) or behind a buffer * @@ -228,7 +228,7 @@ int buffer_attach_secondary_buffer(struct comp_buffer *buffer, bool at_input, * secondary buffer in an operation */ int buffer_sync_secondary_buffer(struct comp_buffer *buffer, size_t limit); -#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */ +#endif /* CONFIG_PIPELINE_2_0 */ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignment); int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, size_t minimum_size, uint32_t alignment); diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index d31721557add..c9de5f9b5cbb 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -453,7 +453,7 @@ zephyr_library_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED # SOF module interface functions add_subdirectory(../src/module module_unused_install/) -if(CONFIG_ZEPHYR_DP_SCHEDULER) +if(CONFIG_PIPELINE_2_0) zephyr_library_sources(${SOF_AUDIO_PATH}/buffers/ring_buffer.c) endif() if(CONFIG_SCHEDULE_DMA_SINGLE_CHANNEL AND NOT(CONFIG_DMA_DOMAIN)) diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 4112a2b19f50..b8915b69d8ee 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -43,6 +43,14 @@ config DMA_DOMAIN_SEM_LIMIT that SEM_LIMIT covers the maximum number of tasks your system will be executing at some point (worst case). +config PIPELINE_2_0 + bool "Enable pipeline 2.0 changes" + depends on IPC_MAJOR_4 + default y if ACE + help + This flag enables changes to new pipeline structure, known as pipeline2_0 + It is required for certain new features, like DP_SCHEDULER. + config ZEPHYR_DP_SCHEDULER bool "use Zephyr thread based DP scheduler" default y if ACE @@ -50,6 +58,7 @@ config ZEPHYR_DP_SCHEDULER depends on IPC_MAJOR_4 depends on ZEPHYR_SOF_MODULE depends on ACE + depends on PIPELINE_2_0 help Enable Data Processing preemptive scheduler based on Zephyr preemptive threads.