From d5b3a93e14ee99288d2de10f11f1f9eb85cc3870 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 7 Jun 2024 09:11:41 +0200 Subject: [PATCH 01/23] llext: fix Windows builds Under windows the Python interpreter has to be called explicitly. Without it an attempt to execute a Python script fails silently. Signed-off-by: Guennadi Liakhovetski --- scripts/xtensa-build-zephyr.py | 4 +++- zephyr/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 648393ed70ff..2e40d9fce3c3 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -39,6 +39,7 @@ import gzip import dataclasses import concurrent.futures as concurrent +import re from west import configuration as west_config @@ -955,7 +956,8 @@ def install_lib(sof_lib_dir, abs_build_dir, platform_wconfig): llext_input = entry_path / (llext_base + '.llext') llext_output = entry_path / (llext_file + '.ri') - sign_cmd = [platform_wconfig.get("rimage.path"), "-o", str(llext_output), + rimage_cmd = re.sub(r"[\"']", "", platform_wconfig.get("rimage.path")) + sign_cmd = [rimage_cmd, "-o", str(llext_output), "-e", "-c", str(rimage_cfg), "-k", str(signing_key), "-l", "-r", str(llext_input)] diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index e691dff9d880..6c98bc212c68 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -90,7 +90,7 @@ function(sof_llext_build module) get_target_property(proc_out_file ${module} pkg_input) add_llext_command(TARGET ${module} POST_BUILD - COMMAND ${SOF_BASE}scripts/llext_link_helper.py + COMMAND ${PYTHON_EXECUTABLE} ${SOF_BASE}scripts/llext_link_helper.py --text-addr="${SOF_LLEXT_TEXT_ADDR}" -f ${proc_in_file} ${CMAKE_C_COMPILER} -- -o ${proc_out_file} ${EXTRA_LINKER_PARAMS} $ From 4f4783db19f6a6d659f3a1c1e19298a8c62c7182 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 7 Jun 2024 16:29:09 +0200 Subject: [PATCH 02/23] ipc4: a failure to find a driver might not be fatal When ipc4_get_drv() fails to find a driver, it might mean, that the driver needs to be linked dynamically. Printing an error in such a case wrongly fails CI testing. Signed-off-by: Guennadi Liakhovetski --- src/ipc/ipc4/helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ipc/ipc4/helper.c b/src/ipc/ipc4/helper.c index aa6505218854..cec4442c7220 100644 --- a/src/ipc/ipc4/helper.c +++ b/src/ipc/ipc4/helper.c @@ -911,11 +911,11 @@ const struct comp_driver *ipc4_get_drv(const uint8_t *uuid) } } - tr_err(&comp_tr, "get_drv(): the provided UUID (%08x %08x %08x %08x) can't be found!", - *(uint32_t *)(&uuid[0]), - *(uint32_t *)(&uuid[4]), - *(uint32_t *)(&uuid[8]), - *(uint32_t *)(&uuid[12])); + tr_warn(&comp_tr, "get_drv(): the provided UUID (%08x %08x %08x %08x) can't be found!", + *(uint32_t *)(&uuid[0]), + *(uint32_t *)(&uuid[4]), + *(uint32_t *)(&uuid[8]), + *(uint32_t *)(&uuid[12])); out: irq_local_enable(flags); From 4120cc1519c414ed014f7d53ab76ba35864d45ab Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 13 Jun 2024 14:30:37 +0200 Subject: [PATCH 03/23] samples: (cosmetic) clean up Kconfig spacing Use consistent TABs and spaces in src/samples/audio/Kconfig Signed-off-by: Guennadi Liakhovetski --- src/samples/audio/Kconfig | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/samples/audio/Kconfig b/src/samples/audio/Kconfig index e853b0668f1a..0338ced15875 100644 --- a/src/samples/audio/Kconfig +++ b/src/samples/audio/Kconfig @@ -2,27 +2,27 @@ menu "Audio component samples" - config SAMPLE_SMART_AMP - tristate "Smart amplifier test component" - default y - help - Select for test smart amplifier component + config SAMPLE_SMART_AMP + tristate "Smart amplifier test component" + default y + help + Select for test smart amplifier component - config SAMPLE_KEYPHRASE + config SAMPLE_KEYPHRASE depends on CAVS || IMX || ACE - bool "Keyphrase test component" - default y - help - Select for Keyphrase test component. - Provides basic functionality for use in testing of keyphrase detection pipelines. + bool "Keyphrase test component" + default y + help + Select for Keyphrase test component. + Provides basic functionality for use in testing of keyphrase detection pipelines. config KWD_NN_SAMPLE_KEYPHRASE - depends on IMX - bool "KWD NN Keyphrase test component" - default n - help - Select for KWD NN Keyphrase test component based on neural network. - Provides ML functionality for use in testing of keyphrase detection pipelines. - Use KWD based on NN as alternative to the default KWD component. - Provides neural network as a library. + depends on IMX + bool "KWD NN Keyphrase test component" + default n + help + Select for KWD NN Keyphrase test component based on neural network. + Provides ML functionality for use in testing of keyphrase detection pipelines. + Use KWD based on NN as alternative to the default KWD component. + Provides neural network as a library. endmenu From 0bf719290e21bf46e713a3f4631553b87734404c Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 13 Jun 2024 14:32:27 +0200 Subject: [PATCH 04/23] llext: add a convenience Kconfig option to build LLEXT modules Add a Kconfig option that can be used to flip all LLEXT-supporting code to a modular build. Use that global flag for smart-amp-test, mixin-mixout and eq-iir. Signed-off-by: Guennadi Liakhovetski --- src/audio/eq_iir/Kconfig | 1 + src/audio/mixin_mixout/Kconfig | 1 + src/library_manager/Kconfig | 8 ++++++++ src/samples/audio/Kconfig | 1 + 4 files changed, 11 insertions(+) diff --git a/src/audio/eq_iir/Kconfig b/src/audio/eq_iir/Kconfig index 2fee46d9a29f..11433d27cfb3 100644 --- a/src/audio/eq_iir/Kconfig +++ b/src/audio/eq_iir/Kconfig @@ -3,6 +3,7 @@ config COMP_IIR tristate "IIR component" select COMP_BLOB + default m if LIBRARY_DEFAULT_MODULAR default y depends on COMP_MODULE_ADAPTER select MATH_IIR_DF1 diff --git a/src/audio/mixin_mixout/Kconfig b/src/audio/mixin_mixout/Kconfig index 852b23f18e08..73016a667bd7 100644 --- a/src/audio/mixin_mixout/Kconfig +++ b/src/audio/mixin_mixout/Kconfig @@ -3,6 +3,7 @@ config COMP_MIXIN_MIXOUT tristate "Mixin_mixout component" depends on IPC_MAJOR_4 + default m if LIBRARY_DEFAULT_MODULAR default y help Select for Mixin_mixout component diff --git a/src/library_manager/Kconfig b/src/library_manager/Kconfig index e167f956a37a..d0657aefc9fb 100644 --- a/src/library_manager/Kconfig +++ b/src/library_manager/Kconfig @@ -33,4 +33,12 @@ config LIBRARY_AUTH_SUPPORT could be used if enabled. If unsure say N. +config LIBRARY_DEFAULT_MODULAR + bool "Build LLEXT modules by default" + depends on LLEXT + help + Build code, that can be built as LLEXT modules as such. Usually such + code has tristate Kconfig entries, they will default to "m" if this + option is selected. + endmenu diff --git a/src/samples/audio/Kconfig b/src/samples/audio/Kconfig index 0338ced15875..7463d8c31412 100644 --- a/src/samples/audio/Kconfig +++ b/src/samples/audio/Kconfig @@ -4,6 +4,7 @@ menu "Audio component samples" config SAMPLE_SMART_AMP tristate "Smart amplifier test component" + default m if LIBRARY_DEFAULT_MODULAR default y help Select for test smart amplifier component From 43ebb89aacf9412a51a060d27ac1884ac8b2406e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 13 Jun 2024 14:33:20 +0200 Subject: [PATCH 05/23] mtl: build all supporting code as LLEXT modules Enable CONFIG_LIBRARY_DEFAULT_MODULAR for MTL to build all supporting code as LLEXT modules. Signed-off-by: Guennadi Liakhovetski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 0348c9da5aa9..31b33362133a 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -85,6 +85,7 @@ CONFIG_MEMORY_WIN_2_SIZE=12288 CONFIG_LLEXT=y CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_MODULES=y +CONFIG_LIBRARY_DEFAULT_MODULAR=y # Temporary disabled options CONFIG_TRACE=n From 1b2026c75ddc5c9b293d90aed06601fc4493d5e8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 14 Jun 2024 15:44:34 +0200 Subject: [PATCH 06/23] llext: add maximum instance count support Maximum instance count cannot be zero, they have to be supplied by respective modules. Signed-off-by: Guennadi Liakhovetski --- src/audio/eq_iir/eq_iir.c | 2 +- src/audio/mixin_mixout/mixin_mixout.c | 4 ++-- src/include/module/module/llext.h | 3 ++- src/samples/audio/smart_amp_test_ipc4.c | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/audio/eq_iir/eq_iir.c b/src/audio/eq_iir/eq_iir.c index 6c298e4d59ff..9cfab900c9fa 100644 --- a/src/audio/eq_iir/eq_iir.c +++ b/src/audio/eq_iir/eq_iir.c @@ -271,7 +271,7 @@ SOF_MODULE_INIT(eq_iir, sys_comp_module_eq_iir_interface_init); SOF_LLEXT_MOD_ENTRY(eq_iir, &eq_iir_interface); static const struct sof_man_module_manifest mod_manifest __section(".module") __used = - SOF_LLEXT_MODULE_MANIFEST("EQIIR", eq_iir_llext_entry, 1, UUID_EQIIR); + SOF_LLEXT_MODULE_MANIFEST("EQIIR", eq_iir_llext_entry, 1, UUID_EQIIR, 40); SOF_LLEXT_BUILDINFO; diff --git a/src/audio/mixin_mixout/mixin_mixout.c b/src/audio/mixin_mixout/mixin_mixout.c index 5171cbda22e0..cee5140c0f6b 100644 --- a/src/audio/mixin_mixout/mixin_mixout.c +++ b/src/audio/mixin_mixout/mixin_mixout.c @@ -982,8 +982,8 @@ SOF_LLEXT_MOD_ENTRY(mixout, &mixout_interface); static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = { - SOF_LLEXT_MODULE_MANIFEST("MIXIN", mixin_llext_entry, 1, UUID_MIXIN), - SOF_LLEXT_MODULE_MANIFEST("MIXOUT", mixout_llext_entry, 1, UUID_MIXOUT), + SOF_LLEXT_MODULE_MANIFEST("MIXIN", mixin_llext_entry, 1, UUID_MIXIN, 30), + SOF_LLEXT_MODULE_MANIFEST("MIXOUT", mixout_llext_entry, 1, UUID_MIXOUT, 30), }; SOF_LLEXT_BUILDINFO; diff --git a/src/include/module/module/llext.h b/src/include/module/module/llext.h index 61532e3fb70f..05b8f0ffb5f5 100644 --- a/src/include/module/module/llext.h +++ b/src/include/module/module/llext.h @@ -6,12 +6,13 @@ #ifndef MODULE_LLEXT_H #define MODULE_LLEXT_H -#define SOF_LLEXT_MODULE_MANIFEST(manifest_name, entry, affinity, mod_uuid) \ +#define SOF_LLEXT_MODULE_MANIFEST(manifest_name, entry, affinity, mod_uuid, instances) \ { \ .module = { \ .name = manifest_name, \ .uuid = {mod_uuid}, \ .entry_point = (uint32_t)(entry), \ + .instance_max_count = instances, \ .type = { \ .load_type = SOF_MAN_MOD_TYPE_LLEXT, \ .domain_ll = 1, \ diff --git a/src/samples/audio/smart_amp_test_ipc4.c b/src/samples/audio/smart_amp_test_ipc4.c index c0d6acc872aa..4faa8d967030 100644 --- a/src/samples/audio/smart_amp_test_ipc4.c +++ b/src/samples/audio/smart_amp_test_ipc4.c @@ -417,6 +417,7 @@ static const struct sof_man_module_manifest main_manifest __section(".module") _ .uuid = {0x1E, 0x96, 0x7A, 0x16, 0xE4, 0x8A, 0xEA, 0x11, 0x89, 0xF1, 0x00, 0x0C, 0x29, 0xCE, 0x16, 0x35}, .entry_point = (uint32_t)smart_amp_test_llext_entry, + .instance_max_count = 1, .type = { #ifdef __SOF_MODULE_SERVICE_BUILD__ .load_type = SOF_MAN_MOD_TYPE_MODULE, From f41e726c7a8405138e4a358280911381c87f0490 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 14 Jun 2024 15:47:08 +0200 Subject: [PATCH 07/23] rimage: propagate maximum module instance counts Use maximum instance count from modules when building a manifest. Signed-off-by: Guennadi Liakhovetski --- tools/rimage/src/manifest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/rimage/src/manifest.c b/tools/rimage/src/manifest.c index 5fb766c87173..b7c079015275 100644 --- a/tools/rimage/src/manifest.c +++ b/tools/rimage/src/manifest.c @@ -225,6 +225,7 @@ static int man_get_module_manifest(struct image *image, struct manifest_module * memcpy(man_module->name, sof_mod->module.name, SOF_MAN_MOD_NAME_LEN); memcpy(man_module->uuid, sof_mod->module.uuid, 16); man_module->affinity_mask = sof_mod->module.affinity_mask; + man_module->instance_max_count = sof_mod->module.instance_max_count; man_module->type.auto_start = sof_mod->module.type.auto_start; man_module->type.domain_dp = sof_mod->module.type.domain_dp; man_module->type.domain_ll = sof_mod->module.type.domain_ll; @@ -464,9 +465,6 @@ static int man_module_create_reloc(struct image *image, struct manifest_module * /* stack size ??? convert sizes to PAGES */ man_module->instance_bss_size = 1; - /* max number of instances of this module ?? */ - man_module->instance_max_count = 1; - module_print_zones(&module->file); /* main module */ From 2937c5ba7adec0e73760b4a02303d8c9d7215936 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 17 Jun 2024 12:23:39 +0200 Subject: [PATCH 08/23] log: disable the logging task before clearing log state If logging state is cleared while the logging task is still running, it can lead to an inconsistent state. Stop the logging task before clearing the state. Signed-off-by: Guennadi Liakhovetski --- src/ipc/ipc4/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipc/ipc4/logging.c b/src/ipc/ipc4/logging.c index 15ee85560f4b..db192c27c6f0 100644 --- a/src/ipc/ipc4/logging.c +++ b/src/ipc/ipc4/logging.c @@ -151,9 +151,9 @@ int ipc4_logging_enable_logs(bool first_block, &ops, NULL, MTRACE_IPC_CORE, 0); schedule_task(&mtrace_task, mtrace_aging_timer * 1000, 0); } else { + schedule_task_cancel(&mtrace_task); adsp_mtrace_log_init(NULL); log_backend_deactivate(log_backend); - schedule_task_cancel(&mtrace_task); } return 0; From 8bd91c15fdd5bd3b116df00e3336450c468786d9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 17 Jun 2024 17:24:35 +0200 Subject: [PATCH 09/23] eq_iir: reduce logging verbosity during freeing When pipelines are destroyed, component drivers' .reset() and .free() are called. If those drivers were loaded dynamically their memory is then unmapped. But logging takes place in a low priority task, so it is important that no logging is done from those methods. Signed-off-by: Guennadi Liakhovetski --- src/audio/eq_iir/eq_iir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/eq_iir/eq_iir.c b/src/audio/eq_iir/eq_iir.c index 9cfab900c9fa..6e3fc1dba5ae 100644 --- a/src/audio/eq_iir/eq_iir.c +++ b/src/audio/eq_iir/eq_iir.c @@ -100,7 +100,7 @@ static int eq_iir_free(struct processing_module *mod) { struct comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "eq_iir_free()"); + comp_dbg(mod->dev, "eq_iir_free()"); eq_iir_free_delaylines(cd); comp_data_blob_handler_free(cd->model_handler); @@ -234,7 +234,7 @@ static int eq_iir_reset(struct processing_module *mod) struct comp_data *cd = module_get_private_data(mod); int i; - comp_info(mod->dev, "eq_iir_reset()"); + comp_dbg(mod->dev, "eq_iir_reset()"); eq_iir_free_delaylines(cd); From 03d8b8adf7c0a2994a24cdd8ea79f67bdb2916b3 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 13 Jun 2024 11:43:08 +0200 Subject: [PATCH 10/23] llext: add missing modules to LNL overlay LNL modules overlay is missing eq_iir and mixin_mixout entries, add them there. Signed-off-by: Guennadi Liakhovetski --- app/overlays/lnl/module_overlay.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/overlays/lnl/module_overlay.conf b/app/overlays/lnl/module_overlay.conf index 172a8ea28e82..45babe736c53 100644 --- a/app/overlays/lnl/module_overlay.conf +++ b/app/overlays/lnl/module_overlay.conf @@ -1 +1,3 @@ CONFIG_SAMPLE_SMART_AMP=m +CONFIG_COMP_MIXIN_MIXOUT=m +CONFIG_COMP_IIR=m From 7467ecfdfb103c636842cbacecc68b2ab495f926 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 30 May 2024 16:04:38 +0200 Subject: [PATCH 11/23] llext: automatically calculate module addresses Currently LLEXT module starting addresses are hard-coded in their respective CMakeLists.txt files. This is very wasteful, since it's unknown in what order modules are loaded, inflexible and not easily extendible to other platforms. Switch to calculating addresses automatically based on a single per-platform Kconfig value. Signed-off-by: Guennadi Liakhovetski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 + app/boards/intel_adsp_ace20_lnl.conf | 3 +- app/overlays/lnl/module_overlay.conf | 1 + app/overlays/mtl/module_overlay.conf | 1 + scripts/llext_link_helper.py | 17 ++++++- scripts/llext_offset_calc.py | 47 +++++++++++++++++++ src/audio/eq_iir/llext/CMakeLists.txt | 2 - src/audio/mixin_mixout/llext/CMakeLists.txt | 2 - src/library_manager/Kconfig | 9 ++++ .../audio/smart_amp_test_llext/CMakeLists.txt | 2 - zephyr/CMakeLists.txt | 28 +++++++++-- 11 files changed, 101 insertions(+), 12 deletions(-) create mode 100755 scripts/llext_offset_calc.py diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 31b33362133a..d57c0b956dff 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -86,6 +86,7 @@ CONFIG_LLEXT=y CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_MODULES=y CONFIG_LIBRARY_DEFAULT_MODULAR=y +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 # Temporary disabled options CONFIG_TRACE=n diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 42dea6d096ee..5c0d1edb2cf8 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -80,7 +80,8 @@ CONFIG_MEMORY_WIN_2_SIZE=12288 CONFIG_LLEXT=y CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_MODULES=y - +CONFIG_LIBRARY_DEFAULT_MODULAR=y +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 # Temporary disabled options CONFIG_TRACE=n diff --git a/app/overlays/lnl/module_overlay.conf b/app/overlays/lnl/module_overlay.conf index 45babe736c53..e0e017b5a248 100644 --- a/app/overlays/lnl/module_overlay.conf +++ b/app/overlays/lnl/module_overlay.conf @@ -1,3 +1,4 @@ +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m CONFIG_COMP_MIXIN_MIXOUT=m CONFIG_COMP_IIR=m diff --git a/app/overlays/mtl/module_overlay.conf b/app/overlays/mtl/module_overlay.conf index 45babe736c53..e0e017b5a248 100644 --- a/app/overlays/mtl/module_overlay.conf +++ b/app/overlays/mtl/module_overlay.conf @@ -1,3 +1,4 @@ +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m CONFIG_COMP_MIXIN_MIXOUT=m CONFIG_COMP_IIR=m diff --git a/scripts/llext_link_helper.py b/scripts/llext_link_helper.py index b1674e523784..98514c35a6cd 100755 --- a/scripts/llext_link_helper.py +++ b/scripts/llext_link_helper.py @@ -28,6 +28,8 @@ def parse_args(): help='Object file name') parser.add_argument("-t", "--text-addr", required=True, type=str, help='.text section address') + parser.add_argument("-s", "--size-file", required=True, type=str, + help='File with stored accumulated size') args = parser.parse_args() @@ -43,11 +45,20 @@ def max_alignment(addr, align1, align2): return upper - (upper % align1) def main(): + global args + parse_args() - elf = ELFFile(open(args.file, 'rb')) + # Get the size of the previous module, if this isn't the first one. + # It is used to automatically calculate starting address of the current + # module. + try: + with open(args.size_file, 'r') as f_size: + size = int(f_size.read().strip(), base = 0) + except OSError: + size = 0 - text_addr = int(args.text_addr, 0) + text_addr = int(args.text_addr, 0) + size text_size = 0 # File names differ when building shared or relocatable objects @@ -65,6 +76,8 @@ def main(): writable = [] readonly = [] + elf = ELFFile(open(args.file, 'rb')) + # Create an object file with sections grouped by their properties, # similar to how program segments are created: all executable sections, # then all read-only data sections, and eventually all writable data diff --git a/scripts/llext_offset_calc.py b/scripts/llext_offset_calc.py new file mode 100755 index 000000000000..cef0662449bf --- /dev/null +++ b/scripts/llext_offset_calc.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause + +# Add rounded new file size to accumulated module size cache + +import argparse +import pathlib +import os + +args = None + +def parse_args(): + global args + + parser = argparse.ArgumentParser(description='Add a file size to a sum in a file') + + parser.add_argument("-i", "--input", required=True, type=str, + help='Object file name') + parser.add_argument("-s", "--size-file", required=True, type=str, + help='File to store accumulated size') + + args = parser.parse_args() + +def main(): + global args + + parse_args() + + f_output = pathlib.Path(args.size_file) + + try: + with open(f_output, 'r') as f_size: + size = int(f_size.read().strip(), base = 0) + except OSError: + size = 0 + + # Failure will raise an exception + f_size = open(f_output, "w") + + # align to a page border + size += os.path.getsize(args.input) + 0xfff + size &= ~0xfff + + f_size.write(f'0x{size:x}\n') + +if __name__ == "__main__": + main() diff --git a/src/audio/eq_iir/llext/CMakeLists.txt b/src/audio/eq_iir/llext/CMakeLists.txt index 9bf8a4b4e7ef..535455105515 100644 --- a/src/audio/eq_iir/llext/CMakeLists.txt +++ b/src/audio/eq_iir/llext/CMakeLists.txt @@ -1,10 +1,8 @@ # Copyright (c) 2024 Intel Corporation. # SPDX-License-Identifier: Apache-2.0 -# Hard-coded .text address to be moved to a common place sof_llext_build("eq_iir" SOURCES ../eq_iir.c ../eq_iir_ipc4.c ../eq_iir_generic.c - TEXT_ADDR 0xa06ea000 ) diff --git a/src/audio/mixin_mixout/llext/CMakeLists.txt b/src/audio/mixin_mixout/llext/CMakeLists.txt index a9743e379d54..fc5278dc47b0 100644 --- a/src/audio/mixin_mixout/llext/CMakeLists.txt +++ b/src/audio/mixin_mixout/llext/CMakeLists.txt @@ -1,11 +1,9 @@ # Copyright (c) 2024 Intel Corporation. # SPDX-License-Identifier: Apache-2.0 -# Hard-coded .text address to be moved to a common place sof_llext_build("mixin_mixout" SOURCES ../mixin_mixout.c ../mixin_mixout_hifi3.c ../mixin_mixout_hifi5.c ../mixin_mixout_generic.c - TEXT_ADDR 0xa06aa000 ) diff --git a/src/library_manager/Kconfig b/src/library_manager/Kconfig index d0657aefc9fb..7791e8839ac2 100644 --- a/src/library_manager/Kconfig +++ b/src/library_manager/Kconfig @@ -41,4 +41,13 @@ config LIBRARY_DEFAULT_MODULAR code has tristate Kconfig entries, they will default to "m" if this option is selected. +config LIBRARY_BASE_ADDRESS + hex "Base address for memory, dedicated to loadable modules" + default 0 + help + When initializing modules SOF will allocate memory for them and map + it to a predefined per-module address. Those addresses are calculated + automatically but the beginning of that area is platform-specific and + should be set by this option. + endmenu diff --git a/src/samples/audio/smart_amp_test_llext/CMakeLists.txt b/src/samples/audio/smart_amp_test_llext/CMakeLists.txt index 873eb61de81b..2218f41423b5 100644 --- a/src/samples/audio/smart_amp_test_llext/CMakeLists.txt +++ b/src/samples/audio/smart_amp_test_llext/CMakeLists.txt @@ -1,8 +1,6 @@ # Copyright (c) 2023 Intel Corporation. # SPDX-License-Identifier: Apache-2.0 -# Hard-coded .text address to be moved to a common place sof_llext_build("smart_amp_test" SOURCES ../smart_amp_test_ipc4.c - TEXT_ADDR 0xa06ca000 ) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 6c98bc212c68..6fb3e071cde7 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -35,6 +35,13 @@ function(sof_append_relative_path_definitions target) endforeach() endfunction() +define_property(GLOBAL PROPERTY SOF_LLEXT_LAST_TARGET + BRIEF_DOCS "Last LLEXT target" + FULL_DOCS "\ +Building LLEXT targets must be serialized. This property contains the \ +previously added LLEXT module for the establishment of a dependency chain." +) + # Used by LLEXT modules to create a file with module UUIDs function(sof_llext_write_uuids module) file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../${module}.toml uuids REGEX "^[ \t]*uuid *=") @@ -51,7 +58,6 @@ endfunction() # Build an LLEXT module. Provice a module name, a list of sources and an address # of the .text section as arguments. function(sof_llext_build module) - set(single_args TEXT_ADDR) set(multi_args SOURCES) cmake_parse_arguments(PARSE_ARGV 1 SOF_LLEXT "${options}" "${single_args}" "${multi_args}") @@ -88,13 +94,29 @@ function(sof_llext_build module) get_target_property(proc_in_file ${module} lib_output) get_target_property(proc_out_file ${module} pkg_input) + get_target_property(proc_pkg_file ${module} pkg_output) + set(size_file ${PROJECT_BINARY_DIR}/module_size) + + get_property(last_target GLOBAL PROPERTY SOF_LLEXT_LAST_TARGET) + if(NOT "${last_target}" STREQUAL "") + add_dependencies(${module}_llext_proc ${last_target}) + endif() + set_property(GLOBAL PROPERTY SOF_LLEXT_LAST_TARGET ${module}) + add_llext_command(TARGET ${module} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} ${SOF_BASE}scripts/llext_link_helper.py - --text-addr="${SOF_LLEXT_TEXT_ADDR}" -f ${proc_in_file} ${CMAKE_C_COMPILER} -- + COMMAND ${PYTHON_EXECUTABLE} ${SOF_BASE}scripts/llext_link_helper.py -s ${size_file} + --text-addr=${CONFIG_LIBRARY_BASE_ADDRESS} + -f ${proc_in_file} ${CMAKE_C_COMPILER} -- -o ${proc_out_file} ${EXTRA_LINKER_PARAMS} $ ) + + add_llext_command(TARGET ${module} + POST_PKG + COMMAND ${PYTHON_EXECUTABLE} ${SOF_BASE}scripts/llext_offset_calc.py + -i ${proc_pkg_file} -s ${size_file} + ) endfunction() # Initial SOF module will contain From 799ef934d10be839abf0287a83dad0558808fedd Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 13 Jun 2024 12:02:32 +0200 Subject: [PATCH 12/23] src: convert to a loadable module Build src as a loadable llext module. Signed-off-by: Guennadi Liakhovetski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 - app/boards/intel_adsp_ace20_lnl.conf | 1 - app/overlays/lnl/module_overlay.conf | 1 + app/overlays/mtl/module_overlay.conf | 1 + src/audio/src/Kconfig | 1 + src/audio/src/llext/CMakeLists.txt | 23 +++++++++++++++++++ src/audio/src/llext/llext.toml.h | 6 +++++ src/audio/src/src.c | 32 +++++++++++++++++++++++++-- src/audio/src/src.toml | 8 +++++-- src/audio/src/src_lite.c | 2 +- zephyr/CMakeLists.txt | 29 +++++++++++++++--------- 11 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 src/audio/src/llext/CMakeLists.txt create mode 100644 src/audio/src/llext/llext.toml.h diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index d57c0b956dff..cd033ab2fedf 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -2,7 +2,6 @@ CONFIG_METEORLAKE=y CONFIG_IPC_MAJOR_4=y CONFIG_IPC4_BASE_FW_INTEL=y -CONFIG_COMP_SRC=y CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y CONFIG_COMP_SRC_LITE=y CONFIG_COMP_DRC=y diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 5c0d1edb2cf8..446546401251 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -2,7 +2,6 @@ CONFIG_LUNARLAKE=y CONFIG_IPC_MAJOR_4=y CONFIG_IPC4_BASE_FW_INTEL=y -CONFIG_COMP_SRC=y CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y CONFIG_COMP_DRC=y diff --git a/app/overlays/lnl/module_overlay.conf b/app/overlays/lnl/module_overlay.conf index e0e017b5a248..8ade75904c05 100644 --- a/app/overlays/lnl/module_overlay.conf +++ b/app/overlays/lnl/module_overlay.conf @@ -2,3 +2,4 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m CONFIG_COMP_MIXIN_MIXOUT=m CONFIG_COMP_IIR=m +CONFIG_COMP_SRC=m diff --git a/app/overlays/mtl/module_overlay.conf b/app/overlays/mtl/module_overlay.conf index e0e017b5a248..8ade75904c05 100644 --- a/app/overlays/mtl/module_overlay.conf +++ b/app/overlays/mtl/module_overlay.conf @@ -2,3 +2,4 @@ CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m CONFIG_COMP_MIXIN_MIXOUT=m CONFIG_COMP_IIR=m +CONFIG_COMP_SRC=m diff --git a/src/audio/src/Kconfig b/src/audio/src/Kconfig index ef651703a252..0b08e6358a98 100644 --- a/src/audio/src/Kconfig +++ b/src/audio/src/Kconfig @@ -2,6 +2,7 @@ config COMP_SRC tristate "SRC component" + default m if LIBRARY_DEFAULT_MODULAR default y help Select for SRC component diff --git a/src/audio/src/llext/CMakeLists.txt b/src/audio/src/llext/CMakeLists.txt new file mode 100644 index 000000000000..04a5cc4c5266 --- /dev/null +++ b/src/audio/src/llext/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +if(CONFIG_COMP_SRC_LITE) +sof_llext_build("src" + SOURCES ../src_hifi2ep.c + ../src_generic.c + ../src_hifi3.c + ../src_hifi4.c + ../src.c + ../src_ipc4.c + ../src_lite.c +) +else() +sof_llext_build("src" + SOURCES ../src_hifi2ep.c + ../src_generic.c + ../src_hifi3.c + ../src_hifi4.c + ../src.c + ../src_ipc4.c +) +endif() diff --git a/src/audio/src/llext/llext.toml.h b/src/audio/src/llext/llext.toml.h new file mode 100644 index 000000000000..cfb334ca24e7 --- /dev/null +++ b/src/audio/src/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../src.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/src/src.c b/src/audio/src/src.c index c6fc1b812613..5927133a481f 100644 --- a/src/audio/src/src.c +++ b/src/audio/src/src.c @@ -689,7 +689,7 @@ int src_reset(struct processing_module *mod) { struct comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "src_reset()"); + comp_dbg(mod->dev, "src_reset()"); cd->src_func = src_fallback; src_polyphase_reset(&cd->src); @@ -701,7 +701,7 @@ int src_free(struct processing_module *mod) { struct comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "src_free()"); + comp_dbg(mod->dev, "src_free()"); /* Free dynamically reserved buffers for SRC algorithm */ rfree(cd->delay_lines); @@ -723,3 +723,31 @@ static const struct module_interface src_interface = { DECLARE_MODULE_ADAPTER(src_interface, src_uuid, src_tr); SOF_MODULE_INIT(src, sys_comp_module_src_interface_init); + +#if CONFIG_COMP_SRC_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_SRC 0x8D, 0xB2, 0x1B, 0xE6, 0x9A, 0x14, 0x1F, 0x4C, \ + 0xB7, 0x09, 0x46, 0x82, 0x3E, 0xF5, 0xF5, 0xAE +SOF_LLEXT_MOD_ENTRY(src, &src_interface); + +#if CONFIG_COMP_SRC_LITE +#define UUID_SRC_LITE 0x51, 0x10, 0x44, 0x33, 0xCD, 0x44, 0x6A, 0x46, \ + 0x83, 0xA3, 0x17, 0x84, 0x78, 0x70, 0x8A, 0xEA +extern const struct module_interface src_lite_interface; +SOF_LLEXT_MOD_ENTRY(src_lite, &src_lite_interface); +#endif + +static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = { + SOF_LLEXT_MODULE_MANIFEST("SRC", src_llext_entry, 1, UUID_SRC, 1), +#if CONFIG_COMP_SRC_LITE + SOF_LLEXT_MODULE_MANIFEST("SRC_LITE", src_lite_llext_entry, 1, UUID_SRC_LITE, 1), +#endif +}; + +SOF_LLEXT_BUILDINFO; +#endif diff --git a/src/audio/src/src.toml b/src/audio/src/src.toml index 9cd67f28d9ce..448739cf2f19 100644 --- a/src/audio/src/src.toml +++ b/src/audio/src/src.toml @@ -1,10 +1,14 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + [[module.entry]] name = "SRC" uuid = "E61BB28D-149A-4C1F-B709-46823EF5F5AE" affinity_mask = "0x1" REM #instance_count = "10" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "7" auto_start = "0" sched_caps = [1, 0x00008000] @@ -77,7 +81,7 @@ affinity_mask = "0x1" REM #instance_count = "10" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "0x1F" auto_start = "0" sched_caps = [1, 0x00008000] diff --git a/src/audio/src/src_lite.c b/src/audio/src/src_lite.c index 4c02e13303e4..c1cda2859b68 100644 --- a/src/audio/src/src_lite.c +++ b/src/audio/src/src_lite.c @@ -49,7 +49,7 @@ static int src_lite_prepare(struct processing_module *mod, return src_prepare_general(mod, sources[0], sinks[0]); } -static const struct module_interface src_lite_interface = { +const struct module_interface src_lite_interface = { .init = src_init, .prepare = src_lite_prepare, .process = src_process, diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 6fb3e071cde7..46edae001571 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -719,18 +719,25 @@ zephyr_library_sources_ifdef(CONFIG_COMP_CHAIN_DMA ${SOF_AUDIO_PATH}/chain_dma.c ) -zephyr_library_sources_ifdef(CONFIG_COMP_SRC - ${SOF_AUDIO_PATH}/src/src_hifi2ep.c - ${SOF_AUDIO_PATH}/src/src_generic.c - ${SOF_AUDIO_PATH}/src/src_hifi3.c - ${SOF_AUDIO_PATH}/src/src_hifi4.c - ${SOF_AUDIO_PATH}/src/src.c - ${SOF_AUDIO_PATH}/src/src_${ipc_suffix}.c -) +if(CONFIG_COMP_SRC STREQUAL "m") + add_subdirectory(${SOF_AUDIO_PATH}/src/llext + ${PROJECT_BINARY_DIR}/src_llext) + add_dependencies(app src) +elseif(CONFIG_COMP_SRC) + zephyr_library_sources_ifdef(CONFIG_COMP_SRC + ${SOF_AUDIO_PATH}/src/src_hifi2ep.c + ${SOF_AUDIO_PATH}/src/src_generic.c + ${SOF_AUDIO_PATH}/src/src_hifi3.c + ${SOF_AUDIO_PATH}/src/src_hifi4.c + ${SOF_AUDIO_PATH}/src/src.c + ${SOF_AUDIO_PATH}/src/src_${ipc_suffix}.c + ) + + zephyr_library_sources_ifdef(CONFIG_COMP_SRC_LITE + ${SOF_AUDIO_PATH}/src/src_lite.c + ) +endif() -zephyr_library_sources_ifdef(CONFIG_COMP_SRC_LITE - ${SOF_AUDIO_PATH}/src/src_lite.c -) zephyr_library_sources_ifdef(CONFIG_COMP_BASEFW_IPC4 ${SOF_AUDIO_PATH}/base_fw.c ) From faea605f4a5f5edd6f19c77b89e4d12a8c291bb5 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 28 May 2024 14:17:03 +0200 Subject: [PATCH 13/23] volume: move gain.toml and peakvol.toml into volume.toml To make volume an LLEXT module it should have a single TOML configuration file named volume.toml. This is easy to do, using respective Kconfig options. Signed-off-by: Guennadi Liakhovetski --- src/audio/volume/gain.toml | 33 ---------------- src/audio/volume/peakvol.toml | 33 ---------------- src/audio/volume/volume.toml | 71 ++++++++++++++++++++++++++++++++++ tools/rimage/config/lnl.toml.h | 8 +--- tools/rimage/config/mtl.toml.h | 8 +--- 5 files changed, 75 insertions(+), 78 deletions(-) delete mode 100644 src/audio/volume/gain.toml delete mode 100644 src/audio/volume/peakvol.toml create mode 100644 src/audio/volume/volume.toml diff --git a/src/audio/volume/gain.toml b/src/audio/volume/gain.toml deleted file mode 100644 index 1bd8defc4e2b..000000000000 --- a/src/audio/volume/gain.toml +++ /dev/null @@ -1,33 +0,0 @@ - [[module.entry]] - name = "GAIN" - uuid = "61BCA9A8-18D0-4A18-8E7B-2639219804B7" - affinity_mask = "0x1" - instance_count = "40" - domain_types = "0" - load_type = "0" - module_type = "9" - auto_start = "0" - sched_caps = [1, 0x00008000] - - REM # pin = [dir, type, sample rate, size, container, channel-cfg] - pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, - 1, 0, 0xfeef, 0xf, 0xf, 0x45ff] - - REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] -#if CONFIG_METEORLAKE - mod_cfg = [1, 0, 0, 0, 416, 12100000, 1536, 1536, 0, 12100, 0, - 2, 0, 0, 0, 416, 10183000, 384, 384, 0, 10183, 0, - 3, 0, 0, 0, 416, 8192000, 512, 512, 0, 8192, 0, - 4, 0, 0, 0, 416, 10091000, 128, 128, 0, 10091, 0, - 5, 0, 0, 0, 416, 5908000, 768, 768, 0, 5908, 0] -#elif defined(CONFIG_LUNARLAKE) || defined(CONFIG_PANTHERLAKE) - mod_cfg = [0, 0, 0, 0, 416, 914000, 48, 64, 0, 0, 0, - 1, 0, 0, 0, 416, 1321600, 192, 256, 0, 0, 0, - 2, 0, 0, 0, 416, 1786000, 192, 256, 0, 0, 0, - 3, 0, 0, 0, 416, 2333000, 48, 64, 0, 0, 0, - 4, 0, 0, 0, 416, 2910000, 192, 256, 0, 0, 0, - 5, 0, 0, 0, 416, 3441000, 192, 256, 0, 0, 0, - 6, 0, 0, 0, 416, 4265000, 192, 256, 0, 0, 0] -#endif - - index = __COUNTER__ diff --git a/src/audio/volume/peakvol.toml b/src/audio/volume/peakvol.toml deleted file mode 100644 index c7a3bea647f3..000000000000 --- a/src/audio/volume/peakvol.toml +++ /dev/null @@ -1,33 +0,0 @@ - [[module.entry]] - name = "PEAKVOL" - uuid = "8A171323-94A3-4E1D-AFE9-FE5DBAA4C393" - affinity_mask = "0x1" - instance_count = "10" - domain_types = "0" - load_type = "0" - module_type = "4" - auto_start = "0" - sched_caps = [1, 0x00008000] - - REM # pin = [dir, type, sample rate, size, container, channel-cfg] - pin = [0, 0, 0xfeef, 0xf, 0xa, 0x45ff, - 1, 0, 0xfeef, 0xf, 0xa, 0x45ff] - - REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] -#if CONFIG_METEORLAKE - mod_cfg = [1, 0, 0, 0, 480, 11667000, 384, 384, 0, 11667, 0, - 2, 0, 0, 0, 480, 5943000, 192, 192, 0, 5943, 0, - 3, 0, 0, 0, 480, 12567000, 720, 720, 0, 12567, 0, - 4, 0, 0, 0, 480, 7360000, 768, 768, 0, 7360, 0, - 5, 0, 0, 0, 480, 12236000, 1536, 1536, 0, 12236, 0] -#elif defined(CONFIG_LUNARLAKE) || defined(CONFIG_PANTHERLAKE) - mod_cfg = [0, 0, 0, 0, 480, 1114000, 48, 64, 0, 0, 0, - 1, 0, 0, 0, 480, 3321600, 192, 256, 0, 0, 0, - 2, 0, 0, 0, 480, 3786000, 192, 256, 0, 0, 0, - 3, 0, 0, 0, 480, 4333000, 48, 64, 0, 0, 0, - 4, 0, 0, 0, 480, 4910000, 192, 256, 0, 0, 0, - 5, 0, 0, 0, 480, 5441000, 192, 256, 0, 0, 0, - 6, 0, 0, 0, 480, 6265000, 192, 256, 0, 0, 0] -#endif - - index = __COUNTER__ diff --git a/src/audio/volume/volume.toml b/src/audio/volume/volume.toml new file mode 100644 index 000000000000..2aaa0bbccbc3 --- /dev/null +++ b/src/audio/volume/volume.toml @@ -0,0 +1,71 @@ +#if CONFIG_COMP_PEAK_VOL + [[module.entry]] + name = "PEAKVOL" + uuid = "8A171323-94A3-4E1D-AFE9-FE5DBAA4C393" + affinity_mask = "0x1" + instance_count = "10" + domain_types = "0" + load_type = "0" + module_type = "4" + auto_start = "0" + sched_caps = [1, 0x00008000] + + REM # pin = [dir, type, sample rate, size, container, channel-cfg] + pin = [0, 0, 0xfeef, 0xf, 0xa, 0x45ff, + 1, 0, 0xfeef, 0xf, 0xa, 0x45ff] + + REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] +#if CONFIG_METEORLAKE + mod_cfg = [1, 0, 0, 0, 480, 11667000, 384, 384, 0, 11667, 0, + 2, 0, 0, 0, 480, 5943000, 192, 192, 0, 5943, 0, + 3, 0, 0, 0, 480, 12567000, 720, 720, 0, 12567, 0, + 4, 0, 0, 0, 480, 7360000, 768, 768, 0, 7360, 0, + 5, 0, 0, 0, 480, 12236000, 1536, 1536, 0, 12236, 0] +#elif CONFIG_LUNARLAKE || CONFIG_PANTHERLAKE + mod_cfg = [0, 0, 0, 0, 480, 1114000, 48, 64, 0, 0, 0, + 1, 0, 0, 0, 480, 3321600, 192, 256, 0, 0, 0, + 2, 0, 0, 0, 480, 3786000, 192, 256, 0, 0, 0, + 3, 0, 0, 0, 480, 4333000, 48, 64, 0, 0, 0, + 4, 0, 0, 0, 480, 4910000, 192, 256, 0, 0, 0, + 5, 0, 0, 0, 480, 5441000, 192, 256, 0, 0, 0, + 6, 0, 0, 0, 480, 6265000, 192, 256, 0, 0, 0] +#endif + + index = __COUNTER__ +#endif + +#if CONFIG_COMP_GAIN + [[module.entry]] + name = "GAIN" + uuid = "61BCA9A8-18D0-4A18-8E7B-2639219804B7" + affinity_mask = "0x1" + instance_count = "40" + domain_types = "0" + load_type = "0" + module_type = "9" + auto_start = "0" + sched_caps = [1, 0x00008000] + + REM # pin = [dir, type, sample rate, size, container, channel-cfg] + pin = [0, 0, 0xfeef, 0xf, 0xf, 0x45ff, + 1, 0, 0xfeef, 0xf, 0xf, 0x45ff] + + REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] +#if CONFIG_METEORLAKE + mod_cfg = [1, 0, 0, 0, 416, 12100000, 1536, 1536, 0, 12100, 0, + 2, 0, 0, 0, 416, 10183000, 384, 384, 0, 10183, 0, + 3, 0, 0, 0, 416, 8192000, 512, 512, 0, 8192, 0, + 4, 0, 0, 0, 416, 10091000, 128, 128, 0, 10091, 0, + 5, 0, 0, 0, 416, 5908000, 768, 768, 0, 5908, 0] +#elif CONFIG_LUNARLAKE || CONFIG_PANTHERLAKE + mod_cfg = [0, 0, 0, 0, 416, 914000, 48, 64, 0, 0, 0, + 1, 0, 0, 0, 416, 1321600, 192, 256, 0, 0, 0, + 2, 0, 0, 0, 416, 1786000, 192, 256, 0, 0, 0, + 3, 0, 0, 0, 416, 2333000, 48, 64, 0, 0, 0, + 4, 0, 0, 0, 416, 2910000, 192, 256, 0, 0, 0, + 5, 0, 0, 0, 416, 3441000, 192, 256, 0, 0, 0, + 6, 0, 0, 0, 416, 4265000, 192, 256, 0, 0, 0] +#endif + + index = __COUNTER__ +#endif diff --git a/tools/rimage/config/lnl.toml.h b/tools/rimage/config/lnl.toml.h index 4436b6198d85..a82ac6435c13 100644 --- a/tools/rimage/config/lnl.toml.h +++ b/tools/rimage/config/lnl.toml.h @@ -32,12 +32,8 @@ #include