diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 0348c9da5aa9..01ea7fd7845f 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -2,10 +2,9 @@ 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 +CONFIG_COMP_DRC=m CONFIG_COMP_CROSSOVER=y CONFIG_COMP_MULTIBAND_DRC=y @@ -85,6 +84,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 @@ -104,4 +105,4 @@ CONFIG_LOG_TIMESTAMP_64BIT=y CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=y CONFIG_COMP_STUBS=y -CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=y +CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=n diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 42dea6d096ee..f7f219a5db68 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -2,9 +2,8 @@ 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 +CONFIG_COMP_DRC=m # power settings CONFIG_PM=y @@ -80,7 +79,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 172a8ea28e82..fd351428f506 100644 --- a/app/overlays/lnl/module_overlay.conf +++ b/app/overlays/lnl/module_overlay.conf @@ -1 +1,9 @@ +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m +CONFIG_COMP_MIXIN_MIXOUT=m +CONFIG_COMP_VOLUME=m +CONFIG_COMP_IIR=m +CONFIG_COMP_FIR=m +CONFIG_COMP_SRC=m +CONFIG_COMP_ASRC=m +CONFIG_COMP_DRC=m diff --git a/app/overlays/mtl/module_overlay.conf b/app/overlays/mtl/module_overlay.conf index 45babe736c53..fd351428f506 100644 --- a/app/overlays/mtl/module_overlay.conf +++ b/app/overlays/mtl/module_overlay.conf @@ -1,3 +1,9 @@ +CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 CONFIG_SAMPLE_SMART_AMP=m CONFIG_COMP_MIXIN_MIXOUT=m +CONFIG_COMP_VOLUME=m CONFIG_COMP_IIR=m +CONFIG_COMP_FIR=m +CONFIG_COMP_SRC=m +CONFIG_COMP_ASRC=m +CONFIG_COMP_DRC=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/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/src/audio/asrc/Kconfig b/src/audio/asrc/Kconfig index 7bdbf68d2a94..b9b8604e667e 100644 --- a/src/audio/asrc/Kconfig +++ b/src/audio/asrc/Kconfig @@ -1,7 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_ASRC - bool "ASRC component" + tristate "ASRC component" + default m if LIBRARY_DEFAULT_MODULAR default y help Select for Asynchronous sample rate conversion (ASRC) @@ -14,7 +15,7 @@ config COMP_ASRC not have pre-computed filter coefficients for every conversion fraction that SRC does. -if COMP_ASRC +if COMP_ASRC != n rsource "Kconfig.simd" diff --git a/src/audio/asrc/asrc.c b/src/audio/asrc/asrc.c index 8ce6c711dfc9..73bf4dabd3ce 100644 --- a/src/audio/asrc/asrc.c +++ b/src/audio/asrc/asrc.c @@ -318,7 +318,7 @@ static int asrc_free(struct processing_module *mod) struct comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; - comp_info(dev, "asrc_free()"); + comp_dbg(dev, "asrc_free()"); rfree(cd->buf); asrc_release_buffers(cd->asrc_obj); @@ -850,8 +850,7 @@ static int asrc_reset(struct processing_module *mod) struct comp_dev *dev = mod->dev; struct comp_data *cd = module_get_private_data(mod); - comp_info(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max); - + comp_dbg(dev, "asrc_reset(), skew_min=%d, skew_max=%d", cd->skew_min, cd->skew_max); /* If any resources feasible to stop */ if (cd->track_drift) @@ -879,3 +878,21 @@ static const struct module_interface asrc_interface = { DECLARE_MODULE_ADAPTER(asrc_interface, asrc_uuid, asrc_tr); SOF_MODULE_INIT(asrc, sys_comp_module_asrc_interface_init); + +#if CONFIG_COMP_ASRC_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_ASRC 0x2d, 0x40, 0xb4, 0x66, 0x68, 0xb4, 0xf2, 0x42, \ + 0x81, 0xa7, 0xb3, 0x71, 0x21, 0x86, 0x3d, 0xd4 +SOF_LLEXT_MOD_ENTRY(asrc, &asrc_interface); + +static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = { + SOF_LLEXT_MODULE_MANIFEST("ASRC", asrc_llext_entry, 1, UUID_ASRC, 2), +}; + +SOF_LLEXT_BUILDINFO; +#endif diff --git a/src/audio/asrc/asrc.toml b/src/audio/asrc/asrc.toml index 0bf6ace59bd9..ace84d85e733 100644 --- a/src/audio/asrc/asrc.toml +++ b/src/audio/asrc/asrc.toml @@ -1,3 +1,7 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + [[module.entry]] name = "ASRC" uuid = "66B4402D-B468-42F2-81A7-B37121863DD4" @@ -5,7 +9,7 @@ instance_count = "2" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "9" auto_start = "0" sched_caps = [1, 0x00008000] diff --git a/src/audio/asrc/llext/CMakeLists.txt b/src/audio/asrc/llext/CMakeLists.txt new file mode 100644 index 000000000000..9b00a9552c46 --- /dev/null +++ b/src/audio/asrc/llext/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +sof_llext_build("asrc" + SOURCES ../asrc.c + ../asrc_farrow_hifi3.c + ../asrc_farrow.c + ../asrc_farrow_generic.c + ../asrc_ipc4.c +) diff --git a/src/audio/asrc/llext/llext.toml.h b/src/audio/asrc/llext/llext.toml.h new file mode 100644 index 000000000000..680a68ece6d8 --- /dev/null +++ b/src/audio/asrc/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../asrc.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/data_blob.c b/src/audio/data_blob.c index 3e6415d5d22e..7e1bc11f1f17 100644 --- a/src/audio/data_blob.c +++ b/src/audio/data_blob.c @@ -58,6 +58,7 @@ void comp_data_blob_set_validator(struct comp_data_blob_handler *blob_handler, blob_handler->validator = validator; } +EXPORT_SYMBOL(comp_data_blob_set_validator); void *comp_get_data_blob(struct comp_data_blob_handler *blob_handler, size_t *size, uint32_t *crc) diff --git a/src/audio/drc/Kconfig b/src/audio/drc/Kconfig index 9e6aaf6388ed..56e3c4d9e6fc 100644 --- a/src/audio/drc/Kconfig +++ b/src/audio/drc/Kconfig @@ -3,7 +3,7 @@ rsource "Kconfig.simd" config COMP_DRC - bool "Dynamic Range Compressor component" + tristate "Dynamic Range Compressor component" select CORDIC_FIXED select MATH_LUT_SINE_FIXED select NUMBERS_NORM diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index 7080fdea55f1..d7e53f6813c0 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -203,7 +203,7 @@ static int drc_free(struct processing_module *mod) { struct drc_comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "drc_free()"); + comp_dbg(mod->dev, "drc_free()"); comp_data_blob_handler_free(cd->model_handler); rfree(cd); @@ -370,7 +370,7 @@ static int drc_reset(struct processing_module *mod) { struct drc_comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "drc_reset()"); + comp_dbg(mod->dev, "drc_reset()"); drc_reset_state(&cd->state); @@ -389,3 +389,22 @@ static const struct module_interface drc_interface = { DECLARE_MODULE_ADAPTER(drc_interface, drc_uuid, drc_tr); SOF_MODULE_INIT(drc, sys_comp_module_drc_interface_init); + +#if CONFIG_COMP_DRC_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_DRC 0xda, 0xe4, 0x6e, 0xb3, 0x6f, 0x00, 0xf9, 0x47, \ + 0xa0, 0x6d, 0xfe, 0xcb, 0xe2, 0xd8, 0xb6, 0xce + +SOF_LLEXT_MOD_ENTRY(drc, &drc_interface); + +static const struct sof_man_module_manifest mod_manifest __section(".module") __used = + SOF_LLEXT_MODULE_MANIFEST("DRC", drc_llext_entry, 1, UUID_DRC, 40); + +SOF_LLEXT_BUILDINFO; + +#endif diff --git a/src/audio/drc/drc.toml b/src/audio/drc/drc.toml index 29ee8d856cbb..4c0b25601425 100644 --- a/src/audio/drc/drc.toml +++ b/src/audio/drc/drc.toml @@ -1,3 +1,7 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + REM # DRC module config [[module.entry]] name = "DRC" @@ -5,7 +9,7 @@ affinity_mask = "0x1" instance_count = "40" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "9" auto_start = "0" sched_caps = [1, 0x00008000] diff --git a/src/audio/drc/llext/CMakeLists.txt b/src/audio/drc/llext/CMakeLists.txt new file mode 100644 index 000000000000..29920d8c2a5d --- /dev/null +++ b/src/audio/drc/llext/CMakeLists.txt @@ -0,0 +1,11 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +sof_llext_build("drc" + SOURCES ../drc.c + ../drc_generic.c + ../drc_math_generic.c + ../drc_hifi3.c + ../drc_hifi4.c + ../drc_math_hifi3.c +) diff --git a/src/audio/drc/llext/llext.toml.h b/src/audio/drc/llext/llext.toml.h new file mode 100644 index 000000000000..89469d54fffb --- /dev/null +++ b/src/audio/drc/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../drc.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/eq_fir/Kconfig b/src/audio/eq_fir/Kconfig index 49ae33e98c81..0ac2074e499b 100644 --- a/src/audio/eq_fir/Kconfig +++ b/src/audio/eq_fir/Kconfig @@ -1,10 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_FIR - bool "FIR component" + tristate "FIR component" select MATH_FIR select COMP_BLOB depends on COMP_MODULE_ADAPTER + default m if LIBRARY_DEFAULT_MODULAR default y help Select for FIR component. FIR performance can differ between DSP diff --git a/src/audio/eq_fir/eq_fir.c b/src/audio/eq_fir/eq_fir.c index 3ff65910fc2b..3ecf0b01088b 100644 --- a/src/audio/eq_fir/eq_fir.c +++ b/src/audio/eq_fir/eq_fir.c @@ -311,7 +311,7 @@ static int eq_fir_free(struct processing_module *mod) { struct comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "eq_fir_free()"); + comp_dbg(mod->dev, "eq_fir_free()"); eq_fir_free_delaylines(cd); comp_data_blob_handler_free(cd->model_handler); @@ -458,7 +458,7 @@ static int eq_fir_reset(struct processing_module *mod) int i; struct comp_data *cd = module_get_private_data(mod); - comp_info(mod->dev, "eq_fir_reset()"); + comp_dbg(mod->dev, "eq_fir_reset()"); comp_data_blob_set_validator(cd->model_handler, NULL); @@ -483,3 +483,22 @@ static const struct module_interface eq_fir_interface = { DECLARE_MODULE_ADAPTER(eq_fir_interface, eq_fir_uuid, eq_fir_tr); SOF_MODULE_INIT(eq_fir, sys_comp_module_eq_fir_interface_init); + +#if CONFIG_COMP_FIR_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#define UUID_EQFIR 0xe7, 0x0c, 0xa9, 0x43, 0xa5, 0xf3, 0xdf, 0x41, \ + 0xac, 0x06, 0xba, 0x98, 0x65, 0x1a, 0xe6, 0xa3 + +SOF_LLEXT_MOD_ENTRY(eq_fir, &eq_fir_interface); + +static const struct sof_man_module_manifest mod_manifest __section(".module") __used = + SOF_LLEXT_MODULE_MANIFEST("EQFIR", eq_fir_llext_entry, 1, UUID_EQFIR, 40); + +SOF_LLEXT_BUILDINFO; + +#endif diff --git a/src/audio/eq_fir/eq_fir.toml b/src/audio/eq_fir/eq_fir.toml index 2e647fe97ab8..416c068e95ce 100644 --- a/src/audio/eq_fir/eq_fir.toml +++ b/src/audio/eq_fir/eq_fir.toml @@ -1,11 +1,15 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + REM # eq fir module config [[module.entry]] name = "EQFIR" - uuid = "43A90CE7-f3A5-41Df-AC06-BA98651AE6A3" + uuid = "43A90CE7-F3A5-41DF-AC06-BA98651AE6A3" affinity_mask = "0x1" instance_count = "40" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "9" auto_start = "0" sched_caps = [1, 0x00008000] @@ -15,6 +19,7 @@ 1, 0, 0xfeef, 0xf, 0xf, 0x1ff] REM # mod_cfg [PAR_0 PAR_1 PAR_2 PAR_3 IS_BYTES CPS IBS OBS MOD_FLAGS CPC OBLS] + REM # identical for MTL and LNL mod_cfg = [0, 0, 0, 0, 4096, 1000000, 128, 128, 0, 0, 0] index = __COUNTER__ diff --git a/src/audio/eq_fir/llext/CMakeLists.txt b/src/audio/eq_fir/llext/CMakeLists.txt new file mode 100644 index 000000000000..9b4f47308c49 --- /dev/null +++ b/src/audio/eq_fir/llext/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +sof_llext_build("eq_fir" + SOURCES ../eq_fir_hifi3.c + ../eq_fir_hifi2ep.c + ../eq_fir_generic.c + ../eq_fir.c + ../eq_fir_ipc4.c +) diff --git a/src/audio/eq_fir/llext/llext.toml.h b/src/audio/eq_fir/llext/llext.toml.h new file mode 100644 index 000000000000..4a73c827c860 --- /dev/null +++ b/src/audio/eq_fir/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../eq_fir.toml" + +[module] +count = __COUNTER__ 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/eq_iir/eq_iir.c b/src/audio/eq_iir/eq_iir.c index 6c298e4d59ff..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); @@ -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/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/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/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/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/audio/module_adapter/module/generic.c b/src/audio/module_adapter/module/generic.c index 5a09d0772d73..89f311b1b767 100644 --- a/src/audio/module_adapter/module/generic.c +++ b/src/audio/module_adapter/module/generic.c @@ -514,6 +514,7 @@ int module_set_configuration(struct processing_module *mod, return ret; } +EXPORT_SYMBOL(module_set_configuration); int module_bind(struct processing_module *mod, void *data) { diff --git a/src/audio/multiband_drc/Kconfig b/src/audio/multiband_drc/Kconfig index 175a6bf09c48..d9e61c915ccd 100644 --- a/src/audio/multiband_drc/Kconfig +++ b/src/audio/multiband_drc/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_MULTIBAND_DRC - depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC + depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC = y bool "Multiband Dynamic Range Compressor component" select CORDIC_FIXED select COMP_BLOB diff --git a/src/audio/sink_source_utils.c b/src/audio/sink_source_utils.c index 3b79c8c2d5e1..cc75c3b848d3 100644 --- a/src/audio/sink_source_utils.c +++ b/src/audio/sink_source_utils.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -71,3 +72,4 @@ int source_to_sink_copy(struct sof_source *source, sink_commit_buffer(sink, INT_MAX); return 0; } +EXPORT_SYMBOL(source_to_sink_copy); diff --git a/src/audio/source_api_helper.c b/src/audio/source_api_helper.c index c7ca28c71720..0e742694508a 100644 --- a/src/audio/source_api_helper.c +++ b/src/audio/source_api_helper.c @@ -3,6 +3,8 @@ * Copyright(c) 2023 Intel Corporation. All rights reserved. */ +#include + #include #include @@ -96,6 +98,7 @@ int source_set_alignment_constants(struct sof_source *source, return source->ops->set_alignment_constants(source, byte_align, frame_align_req); return 0; } +EXPORT_SYMBOL(source_set_alignment_constants); void source_set_min_available(struct sof_source *source, size_t min_available) { 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/src/audio/volume/Kconfig b/src/audio/volume/Kconfig index 35f71cd68e05..bed49b6403f9 100644 --- a/src/audio/volume/Kconfig +++ b/src/audio/volume/Kconfig @@ -1,10 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause - config COMP_VOLUME - bool "Volume component" - default y - help - Select for Volume component +config COMP_VOLUME + tristate "Volume component" + default m if LIBRARY_DEFAULT_MODULAR + default y + help + Select for Volume component if COMP_VOLUME @@ -78,4 +79,4 @@ config COMP_GAIN This option enables gain to change volume. It works as peak volume without updating peak vol to host -endif # volume \ No newline at end of file +endif # volume 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/llext/CMakeLists.txt b/src/audio/volume/llext/CMakeLists.txt new file mode 100644 index 000000000000..74a78873eba6 --- /dev/null +++ b/src/audio/volume/llext/CMakeLists.txt @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Intel Corporation. +# SPDX-License-Identifier: Apache-2.0 + +sof_llext_build("volume" + SOURCES ../volume_generic.c + ../volume_hifi3.c + ../volume_hifi4.c + ../volume_generic_with_peakvol.c + ../volume_hifi3_with_peakvol.c + ../volume_hifi4_with_peakvol.c + ../volume.c + ../volume_ipc4.c +) diff --git a/src/audio/volume/llext/llext.toml.h b/src/audio/volume/llext/llext.toml.h new file mode 100644 index 000000000000..98db03706286 --- /dev/null +++ b/src/audio/volume/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../volume.toml" + +[module] +count = __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.c b/src/audio/volume/volume.c index 0cbbcdde925a..de7ae63d1116 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -800,3 +800,34 @@ static const struct module_interface gain_interface = { DECLARE_MODULE_ADAPTER(gain_interface, gain_uuid, gain_tr); SOF_MODULE_INIT(gain, sys_comp_module_gain_interface_init); #endif + +#if CONFIG_COMP_VOLUME_MODULE +/* modular: llext dynamic link */ + +#include +#include +#include + +#if CONFIG_COMP_PEAK_VOL +#define UUID_PEAKVOL 0x23, 0x13, 0x17, 0x8a, 0xa3, 0x94, 0x1d, 0x4e, \ + 0xaf, 0xe9, 0xfe, 0x5d, 0xba, 0xa4, 0xc3, 0x93 +SOF_LLEXT_MOD_ENTRY(peakvol, &volume_interface); +#endif + +#if CONFIG_COMP_GAIN +#define UUID_GAIN 0xa8, 0xa9, 0xbc, 0x61, 0xd0, 0x18, 0x18, 0x4a, \ + 0x8e, 0x7b, 0x26, 0x39, 0x21, 0x98, 0x04, 0xb7 +SOF_LLEXT_MOD_ENTRY(gain, &gain_interface); +#endif + +static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = { +#if CONFIG_COMP_PEAK_VOL + SOF_LLEXT_MODULE_MANIFEST("PEAKVOL", peakvol_llext_entry, 1, UUID_PEAKVOL, 10), +#endif +#if CONFIG_COMP_GAIN + SOF_LLEXT_MODULE_MANIFEST("GAIN", gain_llext_entry, 1, UUID_GAIN, 40), +#endif +}; + +SOF_LLEXT_BUILDINFO; +#endif diff --git a/src/audio/volume/volume.toml b/src/audio/volume/volume.toml new file mode 100644 index 000000000000..7ba4fc53ae83 --- /dev/null +++ b/src/audio/volume/volume.toml @@ -0,0 +1,75 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + +#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 = LOAD_TYPE + 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 = LOAD_TYPE + 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/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/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); 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; diff --git a/src/library_manager/Kconfig b/src/library_manager/Kconfig index e167f956a37a..7791e8839ac2 100644 --- a/src/library_manager/Kconfig +++ b/src/library_manager/Kconfig @@ -33,4 +33,21 @@ 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. + +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/library_manager/lib_manager.c b/src/library_manager/lib_manager.c index 0311edb7797f..a1ea81b21c9a 100644 --- a/src/library_manager/lib_manager.c +++ b/src/library_manager/lib_manager.c @@ -470,8 +470,8 @@ static void lib_manager_update_sof_ctx(void *base_addr, uint32_t lib_id) { struct ext_library *_ext_lib = ext_lib_get(); /* Never freed, will panic if fails */ - struct lib_manager_mod_ctx *ctx = rzalloc(SOF_MEM_ZONE_SYS, 0, SOF_MEM_CAPS_RAM, - sizeof(*ctx)); + struct lib_manager_mod_ctx *ctx = rzalloc(SOF_MEM_ZONE_SYS, SOF_MEM_FLAG_COHERENT, + SOF_MEM_CAPS_RAM, sizeof(*ctx)); ctx->base_addr = base_addr; diff --git a/src/library_manager/llext_manager.c b/src/library_manager/llext_manager.c index e4341678ba91..58d366b9762f 100644 --- a/src/library_manager/llext_manager.c +++ b/src/library_manager/llext_manager.c @@ -343,8 +343,8 @@ uintptr_t llext_manager_allocate_module(struct processing_module *proc, size_t offset = (uintptr_t)mod_manifest - imr_rodata; /* ctx->mod_manifest points to an array of module manifests */ - ctx->mod_manifest = (const struct sof_man_module_manifest *)(va_rodata_base + - offset); + ctx->mod_manifest = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *) + (va_rodata_base + offset)); } return ctx->mod_manifest[entry_index].module.entry_point; diff --git a/src/math/exp_fcn.c b/src/math/exp_fcn.c index 2bace8a430cc..6ada84202212 100644 --- a/src/math/exp_fcn.c +++ b/src/math/exp_fcn.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -258,6 +259,7 @@ int32_t sofm_exp_fixed(int32_t x) return y; } +EXPORT_SYMBOL(sofm_exp_fixed); #endif /* EXPONENTIAL_GENERIC */ @@ -284,3 +286,4 @@ int32_t sofm_db2lin_fixed(int32_t db) arg = (int32_t)Q_MULTSR_32X32((int64_t)db, SOFM_EXP_LOG10_DIV20_Q27, 24, 27, 27); return sofm_exp_fixed(arg); } +EXPORT_SYMBOL(sofm_db2lin_fixed); diff --git a/src/math/exp_fcn_hifi.c b/src/math/exp_fcn_hifi.c index f0a263b76873..10775133e8a4 100644 --- a/src/math/exp_fcn_hifi.c +++ b/src/math/exp_fcn_hifi.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -370,5 +371,6 @@ int32_t sofm_exp_fixed(int32_t x) return y; } +EXPORT_SYMBOL(sofm_exp_fixed); #endif diff --git a/src/math/fir_generic.c b/src/math/fir_generic.c index 0b19c6e14da1..24fbdc665988 100644 --- a/src/math/fir_generic.c +++ b/src/math/fir_generic.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ void fir_reset(struct fir_state_32x16 *fir) * reset so omitting setting also fir->delay to NULL. */ } +EXPORT_SYMBOL(fir_reset); int fir_delay_size(struct sof_fir_coef_data *config) { @@ -49,6 +51,7 @@ int fir_delay_size(struct sof_fir_coef_data *config) */ return (config->length + 4) * sizeof(int32_t); } +EXPORT_SYMBOL(fir_delay_size); int fir_init_coef(struct fir_state_32x16 *fir, struct sof_fir_coef_data *config) @@ -60,12 +63,14 @@ int fir_init_coef(struct fir_state_32x16 *fir, fir->coef = ASSUME_ALIGNED(&config->coef[0], 4); return 0; } +EXPORT_SYMBOL(fir_init_coef); void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data) { fir->delay = *data; *data += fir->length; /* Point to next delay line start */ } +EXPORT_SYMBOL(fir_init_delay); int32_t fir_32x16(struct fir_state_32x16 *fir, int32_t x) { diff --git a/src/math/fir_hifi2ep.c b/src/math/fir_hifi2ep.c index f95b039a15fa..7f3a2d42a829 100644 --- a/src/math/fir_hifi2ep.c +++ b/src/math/fir_hifi2ep.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ void fir_reset(struct fir_state_32x16 *fir) * reset so omitting setting also fir->delay to NULL. */ } +EXPORT_SYMBOL(fir_reset); int fir_delay_size(struct sof_fir_coef_data *config) { @@ -47,6 +49,7 @@ int fir_delay_size(struct sof_fir_coef_data *config) */ return (config->length + 2) * sizeof(int32_t); } +EXPORT_SYMBOL(fir_delay_size); int fir_init_coef(struct fir_state_32x16 *fir, struct sof_fir_coef_data *config) @@ -62,6 +65,7 @@ int fir_init_coef(struct fir_state_32x16 *fir, fir->coef = (ae_p16x2s *)&config->coef[0]; return 0; } +EXPORT_SYMBOL(fir_init_coef); void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data) { @@ -70,6 +74,7 @@ void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data) fir->rwp = (ae_p24x2f *)(fir->delay + fir->length - 1); *data += fir->length; /* Point to next delay line start */ } +EXPORT_SYMBOL(fir_init_delay); void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, int *rshift) @@ -77,6 +82,7 @@ void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, *lshift = (fir->out_shift < 0) ? -fir->out_shift : 0; *rshift = (fir->out_shift > 0) ? fir->out_shift : 0; } +EXPORT_SYMBOL(fir_get_lrshifts); /* HiFi EP has the follow number of reqisters that should not be exceeded * 4x 56 bit registers in register file Q diff --git a/src/math/fir_hifi3.c b/src/math/fir_hifi3.c index 30be6b8196cc..a9cb19e3072f 100644 --- a/src/math/fir_hifi3.c +++ b/src/math/fir_hifi3.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ void fir_reset(struct fir_state_32x16 *fir) * reset so omitting setting also fir->delay to NULL. */ } +EXPORT_SYMBOL(fir_reset); int fir_delay_size(struct sof_fir_coef_data *config) { @@ -48,6 +50,7 @@ int fir_delay_size(struct sof_fir_coef_data *config) */ return (config->length + 2) * sizeof(int32_t); } +EXPORT_SYMBOL(fir_delay_size); int fir_init_coef(struct fir_state_32x16 *fir, struct sof_fir_coef_data *config) @@ -63,6 +66,7 @@ int fir_init_coef(struct fir_state_32x16 *fir, fir->coef = (ae_f16x4 *)&config->coef[0]; return 0; } +EXPORT_SYMBOL(fir_init_coef); void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data) { @@ -71,6 +75,7 @@ void fir_init_delay(struct fir_state_32x16 *fir, int32_t **data) fir->rwp = (ae_int32 *)(fir->delay + fir->length - 1); *data += fir->length; /* Point to next delay line start */ } +EXPORT_SYMBOL(fir_init_delay); void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, int *rshift) @@ -78,6 +83,7 @@ void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, *lshift = (fir->out_shift < 0) ? -fir->out_shift : 0; *rshift = (fir->out_shift > 0) ? fir->out_shift : 0; } +EXPORT_SYMBOL(fir_get_lrshifts); /* HiFi EP has the follow number of reqisters that should not be exceeded * 4x 56 bit registers in register file Q @@ -245,5 +251,6 @@ void fir_32x16_2x_hifi3(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1, AE_S32_L_I(AE_ROUND32F48SSYM(b), (ae_int32 *)y1, 0); AE_S32_L_I(AE_ROUND32F48SSYM(a), (ae_int32 *)y0, 0); } +EXPORT_SYMBOL(fir_32x16_2x_hifi3); #endif diff --git a/src/math/lut_trig.c b/src/math/lut_trig.c index 5c88b957d413..a40729327932 100644 --- a/src/math/lut_trig.c +++ b/src/math/lut_trig.c @@ -6,6 +6,7 @@ #include #include +#include #include #define SOFM_LUT_SINE_C_Q20 341782638 /* 2 * SINE_NQUART / pi in Q12.20 */ @@ -106,3 +107,4 @@ int16_t sofm_lut_sin_fixed_16b(int32_t w) sine = s0 + q_mults_32x32(frac, delta, Q_SHIFT_BITS_64(31, 16, 16)); /* Q1.16 */ return sat_int16((sine + 1) >> 1); /* Round to Q1.15 */ } +EXPORT_SYMBOL(sofm_lut_sin_fixed_16b); diff --git a/src/math/numbers.c b/src/math/numbers.c index f45310fca2ba..8da912d3551a 100644 --- a/src/math/numbers.c +++ b/src/math/numbers.c @@ -179,4 +179,7 @@ uint32_t crc32(uint32_t base, const void *data, uint32_t bytes) #if !CONFIG_SOC_MIMX9352_A55 uint64_t __udivdi3(uint64_t a, uint64_t b); EXPORT_SYMBOL(__udivdi3); + +int64_t __divdi3(int64_t a, int64_t b); +EXPORT_SYMBOL(__divdi3); #endif diff --git a/src/module/audio/sink_api.c b/src/module/audio/sink_api.c index 856a6bb5689e..5ec904d61b2f 100644 --- a/src/module/audio/sink_api.c +++ b/src/module/audio/sink_api.c @@ -97,6 +97,7 @@ int sink_set_rate(struct sof_sink *sink, unsigned int rate) return sink->ops->on_audio_format_set(sink); return 0; } +EXPORT_SYMBOL(sink_set_rate); int sink_set_channels(struct sof_sink *sink, unsigned int channels) { @@ -114,6 +115,7 @@ int sink_set_buffer_fmt(struct sof_sink *sink, uint32_t buffer_fmt) return sink->ops->on_audio_format_set(sink); return 0; } +EXPORT_SYMBOL(sink_set_buffer_fmt); int sink_set_overrun(struct sof_sink *sink, bool overrun_permitted) { @@ -129,6 +131,7 @@ int sink_set_params(struct sof_sink *sink, struct sof_ipc_stream_params *params, return sink->ops->audio_set_ipc_params(sink, params, force_update); return 0; } +EXPORT_SYMBOL(sink_set_params); int sink_set_alignment_constants(struct sof_sink *sink, const uint32_t byte_align, const uint32_t frame_align_req) @@ -137,3 +140,4 @@ int sink_set_alignment_constants(struct sof_sink *sink, const uint32_t byte_alig return sink->ops->set_alignment_constants(sink, byte_align, frame_align_req); return 0; } +EXPORT_SYMBOL(sink_set_alignment_constants); diff --git a/src/samples/audio/Kconfig b/src/samples/audio/Kconfig index e853b0668f1a..7463d8c31412 100644 --- a/src/samples/audio/Kconfig +++ b/src/samples/audio/Kconfig @@ -2,27 +2,28 @@ 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 m if LIBRARY_DEFAULT_MODULAR + 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 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, 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/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