From aa998a1bb5bf7b54e1af92c3b9d0a99d02d7d7a1 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 7 May 2024 15:33:42 +0200 Subject: [PATCH 1/9] compile: replace 'typeof' with '__typeof__' globally When compiled with '-std=c99' or newer 'typeof' is unavailable and '__typeof__' should be used instead [1]. [1] https://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html Signed-off-by: Guennadi Liakhovetski --- src/include/sof/common.h | 6 +++--- src/include/sof/debug/debug.h | 10 +++++----- src/include/sof/math/numbers.h | 8 ++++---- xtos/include/sof/list.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index 349b806e08a8..6968f3ba44e5 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -117,7 +117,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif #define container_of(ptr, type, member) \ - ({const typeof(((type *)0)->member)*__memberptr = (ptr); \ + ({const __typeof__(((type *)0)->member)*__memberptr = (ptr); \ (type *)((char *)__memberptr - offsetof(type, member)); }) /* * typeof() doesn't preserve __attribute__((address_space(x))) sparse @@ -127,7 +127,7 @@ * re-inforce the address space onto the new pointer. */ #define attr_container_of(ptr, type, member, attr) \ - ({const typeof(((type *)0)->member) attr *__memberptr = (ptr); \ + ({const __typeof__(((type *)0)->member) attr *__memberptr = (ptr); \ (type *)((char attr *)__memberptr - offsetof(type, member)); }) #define ffs(i) __builtin_ffs(i) @@ -219,7 +219,7 @@ * alignment. This compiler builtin may not be available on all compilers so * this macro can be defined as NULL if needed. */ -#define ASSUME_ALIGNED(x, a) ((typeof(x))__builtin_assume_aligned((x), a)) +#define ASSUME_ALIGNED(x, a) ((__typeof__(x))__builtin_assume_aligned((x), a)) #endif /* __XCC__ */ #endif /* __ASSEMBLER__ */ diff --git a/src/include/sof/debug/debug.h b/src/include/sof/debug/debug.h index 9a836b1b443d..8103da3012b8 100644 --- a/src/include/sof/debug/debug.h +++ b/src/include/sof/debug/debug.h @@ -140,7 +140,7 @@ /* swap an endianness of 32-bit word */ #define bswap32(N) ({ \ - typeof(N) n = (N); \ + __typeof__(N) n = (N); \ ((n & 0x000000FF) << 24) | \ ((n & 0x0000FF00) << 8) | \ ((n & 0x00FF0000) >> 8) | \ @@ -153,10 +153,10 @@ */ #define dump_hex(ptr, idx, len) \ do { \ - typeof(idx) __i = (idx); \ - typeof(ptr) __p = (ptr) + __i; \ - typeof(idx) __l = (len) - __i; \ - typeof(idx) __n = __l > 4 ? 4 : __l; \ + __typeof__(idx) __i = (idx); \ + __typeof__(ptr) __p = (ptr) + __i; \ + __typeof__(idx) __l = (len) - __i; \ + __typeof__(idx) __n = __l > 4 ? 4 : __l; \ if (__n == 4) { \ comp_info(dev, "%08x%08x%08x%08x", bswap32(__p[0]), bswap32(__p[1]), \ bswap32(__p[2]), bswap32(__p[3])); \ diff --git a/src/include/sof/math/numbers.h b/src/include/sof/math/numbers.h index 6ecfc9024463..1fd61f6324eb 100644 --- a/src/include/sof/math/numbers.h +++ b/src/include/sof/math/numbers.h @@ -20,18 +20,18 @@ #define MAX(a, b) ((a) < (b) ? (b) : (a)) #define ROUND_DOWN(size, alignment) ({ \ - typeof(size) __size = (size); \ - typeof(alignment) __alignment = (alignment); \ + __typeof__(size) __size = (size); \ + __typeof__(alignment) __alignment = (alignment); \ __size - (__size % __alignment); \ }) #endif /* ! __ZEPHYR__ */ #define ABS(a) ({ \ - typeof(a) __a = (a); \ + __typeof__(a) __a = (a); \ __a < 0 ? -__a : __a; \ }) #define SGN(a) ({ \ - typeof(a) __a = (a); \ + __typeof__(a) __a = (a); \ __a < 0 ? -1 : \ __a > 0 ? 1 : 0; \ }) diff --git a/xtos/include/sof/list.h b/xtos/include/sof/list.h index a81576fb5e68..048c28633ef3 100644 --- a/xtos/include/sof/list.h +++ b/xtos/include/sof/list.h @@ -86,7 +86,7 @@ static inline int list_item_is_last(struct list_item *item, /* get the next container object in the list */ #define list_next_item(object, member) \ - list_item((object)->member.next, typeof(*(object)), member) + list_item((object)->member.next, __typeof__(*(object)), member) /* list iterator */ #define list_for_item(item, list) \ From 3358827e19b17205f12b92e11ab2029c3f18e353 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 10 May 2024 10:56:35 +0200 Subject: [PATCH 2/9] llext: add and use macros for easier LLEXT conversion Add 3 macros to simplify LLEXT module implementation and use them in mixin-mixout and eq_iir. Only two of them can be used in smart_amp_test_ipc4.c so far, because it's also used for LMDK-style module building. Signed-off-by: Guennadi Liakhovetski --- src/include/module/module/llext.h | 36 +++++++++++++++++++++++++ src/samples/audio/smart_amp_test_ipc4.c | 16 ++++------- 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 src/include/module/module/llext.h diff --git a/src/include/module/module/llext.h b/src/include/module/module/llext.h new file mode 100644 index 000000000000..61532e3fb70f --- /dev/null +++ b/src/include/module/module/llext.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright(c) 2024 Intel Corporation. All rights reserved. + */ + +#ifndef MODULE_LLEXT_H +#define MODULE_LLEXT_H + +#define SOF_LLEXT_MODULE_MANIFEST(manifest_name, entry, affinity, mod_uuid) \ +{ \ + .module = { \ + .name = manifest_name, \ + .uuid = {mod_uuid}, \ + .entry_point = (uint32_t)(entry), \ + .type = { \ + .load_type = SOF_MAN_MOD_TYPE_LLEXT, \ + .domain_ll = 1, \ + }, \ + .affinity_mask = (affinity), \ + } \ +} + +#define SOF_LLEXT_MOD_ENTRY(name, interface) \ +static const struct module_interface *name##_llext_entry(void *mod_cfg, \ + void *parent_ppl, void **mod_ptr) \ +{ \ + return interface; \ +} + +#define SOF_LLEXT_BUILDINFO \ +static const struct sof_module_api_build_info buildinfo __section(".mod_buildinfo") __used = { \ + .format = SOF_MODULE_API_BUILD_INFO_FORMAT, \ + .api_version_number.full = SOF_MODULE_API_CURRENT_VERSION, \ +} + +#endif diff --git a/src/samples/audio/smart_amp_test_ipc4.c b/src/samples/audio/smart_amp_test_ipc4.c index 789f70a5b149..811f3e0b125e 100644 --- a/src/samples/audio/smart_amp_test_ipc4.c +++ b/src/samples/audio/smart_amp_test_ipc4.c @@ -407,19 +407,16 @@ SOF_MODULE_INIT(smart_amp_test, sys_comp_module_smart_amp_test_interface_init); #ifdef MAJOR_IADSP_API_VERSION /* modular: system-services or dynamic link */ -static const struct module_interface *loadable_module_main(void *mod_cfg, - void *parent_ppl, - void **mod_ptr) -{ - return &smart_amp_test_interface; -} +#include + +SOF_LLEXT_MOD_ENTRY(smart_amp_test, &smart_amp_test_interface); static const struct sof_man_module_manifest main_manifest __section(".module") __attribute__((used)) = { .module = { .name = "SMATEST", .uuid = {0x1E, 0x96, 0x7A, 0x16, 0xE4, 0x8A, 0xEA, 0x11, 0x89, 0xF1, 0x00, 0x0C, 0x29, 0xCE, 0x16, 0x35}, - .entry_point = (uint32_t)loadable_module_main, + .entry_point = (uint32_t)smart_amp_test_llext_entry, .type = { #ifdef __SOF_MODULE_SERVICE_BUILD__ .load_type = SOF_MAN_MOD_TYPE_MODULE, @@ -440,10 +437,7 @@ DECLARE_LOADABLE_MODULE_API_VERSION(smart_amp_test); #else /* dynamic link */ -static const struct sof_module_api_build_info buildinfo __section(".mod_buildinfo") __attribute__((used)) = { - .format = SOF_MODULE_API_BUILD_INFO_FORMAT, - .api_version_number.full = SOF_MODULE_API_CURRENT_VERSION, -}; +SOF_LLEXT_BUILDINFO; #endif From 0283582bfd56a838c30d9d0703b6b6e25a7ea8c8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 3 May 2024 16:43:55 +0200 Subject: [PATCH 3/9] llext: update to use add_llext_target() Zephyr now provides a convenient cmake API for LLEXT modules, update SOF to use it by defining common cmake functions. Signed-off-by: Guennadi Liakhovetski --- scripts/xtensa-build-zephyr.py | 6 +- src/samples/audio/smart_amp_test_ipc4.c | 2 +- .../audio/smart_amp_test_llext/CMakeLists.txt | 102 +----------------- zephyr/CMakeLists.txt | 62 ++++++++++- 4 files changed, 69 insertions(+), 103 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 770efda47794..95091423852b 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -931,8 +931,8 @@ def install_lib(sof_lib_dir, abs_build_dir, platform_wconfig): dst = sof_lib_dir / llext_file rimage_cfg = entry_path / 'rimage_config.toml' - llext_input = entry_path / (llext_base + '.so') - llext_output = entry_path / llext_file + llext_input = entry_path / (llext_base + '.llext') + llext_output = entry_path / (llext_file + '.ri') sign_cmd = [str(platform_wconfig.get("rimage.path")), "-o", str(llext_output), "-e", "-c", str(rimage_cfg), @@ -947,7 +947,7 @@ def install_lib(sof_lib_dir, abs_build_dir, platform_wconfig): # Thus we're left with a choice between a 150-character # long line and an illogical split like this with open(dst, 'wb') as fdst, open(llext_output, 'rb') as fllext, open( - llext_output.with_suffix('.llext.xman'), 'rb') as fman: + llext_output.with_suffix('.ri.xman'), 'rb') as fman: # Concatenate the manifest and the llext shutil.copyfileobj(fman, fdst) shutil.copyfileobj(fllext, fdst) diff --git a/src/samples/audio/smart_amp_test_ipc4.c b/src/samples/audio/smart_amp_test_ipc4.c index 811f3e0b125e..c0d6acc872aa 100644 --- a/src/samples/audio/smart_amp_test_ipc4.c +++ b/src/samples/audio/smart_amp_test_ipc4.c @@ -404,7 +404,7 @@ SOF_MODULE_INIT(smart_amp_test, sys_comp_module_smart_amp_test_interface_init); #endif -#ifdef MAJOR_IADSP_API_VERSION +#if defined(MAJOR_IADSP_API_VERSION) || defined(CONFIG_SAMPLE_SMART_AMP_MODULE) /* modular: system-services or dynamic link */ #include diff --git a/src/samples/audio/smart_amp_test_llext/CMakeLists.txt b/src/samples/audio/smart_amp_test_llext/CMakeLists.txt index 265290e38a75..873eb61de81b 100644 --- a/src/samples/audio/smart_amp_test_llext/CMakeLists.txt +++ b/src/samples/audio/smart_amp_test_llext/CMakeLists.txt @@ -1,102 +1,8 @@ # Copyright (c) 2023 Intel Corporation. # SPDX-License-Identifier: Apache-2.0 -# FIXME: This *WILL* be converted to add_llext_target() as long as that's -# reasonably possible, and if it isn't, a *significant* effort will be made to -# make that possible - -cmake_minimum_required(VERSION 3.20.0) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(smart_amp_test) - -SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) - -set(MODULE "smart_amp_test") -cmake_path(SET SOF_BASE NORMALIZE ${PROJECT_SOURCE_DIR}/../../../..) - -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/../${MODULE}.toml uuids REGEX "^[ \t]*uuid *=") - -file(WRITE ${PROJECT_BINARY_DIR}/llext.uuid "") - -foreach(line IN LISTS uuids) - # extract UUID value - drop the 'uuid = ' part of the assignment line - string(REGEX REPLACE "^[ \t]*uuid *= \"([0-9A-F\-]*)\"" "\\1" uuid ${line}) - file(APPEND ${PROJECT_BINARY_DIR}/llext.uuid "${uuid}\n") -endforeach() - -add_library(${MODULE} SHARED) - -target_sources(${MODULE} PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/../smart_amp_test_ipc4.c -) - -sof_append_relative_path_definitions(${MODULE}) - -target_include_directories(${MODULE} PRIVATE - "${ZEPHYR_BASE}/include" - "${ZEPHYR_BASE}/soc/intel/intel_adsp/common/include" - "${ZEPHYR_BASE}/soc/intel/intel_adsp/ace/include/ace15_mtpm" - "${ZEPHYR_BASE}/../modules/hal/xtensa/include" - "${ZEPHYR_BASE}/../modules/hal/xtensa/zephyr/soc/intel_ace15_mtpm" - "${SOF_BASE}/src/include" - "${SOF_BASE}/src/arch/xtensa/include" - "${SOF_BASE}/src/platform/meteorlake/include" - "${SOF_BASE}/src/platform/intel/ace/include" - "${SOF_BASE}/src/include/sof/audio/module_adapter/iadk" - "${SOF_BASE}/zephyr/include" - "${SOF_BASE}/xtos/include" - "${SOF_BASE}/tools/rimage/src/include" - "${PROJECT_BINARY_DIR}/../include/generated" -) - -set(MODULE_PROPERTIES HPSRAM_ADDR "0xa06c1000") -set_target_properties(${MODULE} PROPERTIES ${MODULE_PROPERTIES}) - -set(MODULE_COMPILE_DEF - __ZEPHYR__=1 - __XTENSA__ - KERNEL - MAJOR_IADSP_API_VERSION=5 - MIDDLE_IADSP_API_VERSION=0 - MINOR_IADSP_API_VERSION=0 -) -target_compile_definitions(${MODULE} PRIVATE ${MODULE_COMPILE_DEF}) - -target_compile_options(${MODULE} PRIVATE - -imacros${PROJECT_BINARY_DIR}/../include/generated/autoconf.h - -save-temps -O2 -) - -if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr") -set(MODULE_LINKER_PARAMS -nostdlib -nodefaultlibs) -set(EXTRA_LINKER_PARAMS -shared) -set(COPY_CMD ${CMAKE_STRIP} -R .xt.* -o ${MODULE}.so ${MODULE}_pre.so) -else() -set(MODULE_LINKER_PARAMS -nostdlib -nodefaultlibs -r) -set(EXTRA_LINKER_PARAMS) -set(COPY_CMD ${CMAKE_OBJCOPY} -R .xt.* ${MODULE}_pre.so ${MODULE}.so) -endif() - -target_link_options(${MODULE} PRIVATE - ${MODULE_LINKER_PARAMS} -) - -add_custom_command(OUTPUT lib${MODULE}_out.so - DEPENDS ${MODULE} - COMMAND ${CMAKE_C_COMPILER} -E ${CMAKE_CURRENT_LIST_DIR}/llext.toml.h -P -DREM= - -I${SOF_BASE} -I${SOF_BASE}src - -imacros ../include/generated/autoconf.h - -o rimage_config.toml - COMMAND ${SOF_BASE}scripts/llext_link_helper.py - -f lib${MODULE}.so -t "0xa06ca000" ${CMAKE_C_COMPILER} -- - ${MODULE_LINKER_PARAMS} ${EXTRA_LINKER_PARAMS} -fPIC - -o ${MODULE}_pre.so $ - COMMAND ${COPY_CMD} - COMMAND_EXPAND_LISTS +# 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 ) - -add_custom_target(${MODULE}_llext ALL - DEPENDS lib${MODULE}_out.so -) - -add_dependencies(${MODULE} zephyr_interface) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index e6889be1187b..c0038a72989a 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -35,6 +35,66 @@ function(sof_append_relative_path_definitions target) endforeach() endfunction() +# 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 *=") + + foreach(line IN LISTS uuids) + # extract UUID value - drop the 'uuid = ' part of the assignment line + string(REGEX REPLACE "^[ \t]*uuid *= \"([0-9A-F\-]*)\"" "\\1" uuid ${line}) + file(APPEND ${ZEPHYR_BINARY_DIR}/${module}_llext/llext.uuid "${uuid}\n") + endforeach() +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}") + + cmake_path(SET SOF_BASE NORMALIZE ${APPLICATION_SOURCE_DIR}/..) + + sof_llext_write_uuids(${module}) + + add_llext_target(${module} + OUTPUT ${PROJECT_BINARY_DIR}/${module}_llext/${module}.llext + SOURCES ${SOF_LLEXT_SOURCES} + ) + + target_include_directories(${module}_llext_lib PRIVATE + "${SOF_BASE}/xtos/include" + "${SOF_BASE}/src/include" + "${SOF_BASE}/tools/rimage/src/include" + ) + + sof_append_relative_path_definitions(${module}_llext_lib) + + add_llext_command(TARGET ${module} + PRE_BUILD + COMMAND ${CMAKE_C_COMPILER} -E ${CMAKE_CURRENT_LIST_DIR}/llext.toml.h -P -DREM= + -I${SOF_BASE} -I${SOF_BASE}src + -imacros ../include/generated/autoconf.h + -o rimage_config.toml + ) + + if("${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "zephyr") + set(EXTRA_LINKER_PARAMS -nostdlib -nodefaultlibs -shared) + else() + set(EXTRA_LINKER_PARAMS -nostdlib -nodefaultlibs -r) + endif() + + get_target_property(proc_in_file ${module} lib_output) + get_target_property(proc_out_file ${module} pkg_input) + add_llext_command(TARGET ${module} + POST_BUILD + COMMAND ${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} + $ + ) +endfunction() + # Initial SOF module will contain # # 1. Application logic - pipeline, audio components, IPC processing, topology @@ -796,7 +856,7 @@ elseif(CONFIG_IPC_MAJOR_4) if(CONFIG_SAMPLE_SMART_AMP STREQUAL "m") add_subdirectory(${SOF_SAMPLES_PATH}/audio/smart_amp_test_llext ${PROJECT_BINARY_DIR}/smart_amp_test_llext) - add_dependencies(app smart_amp_test_llext) + add_dependencies(app smart_amp_test) elseif(CONFIG_SAMPLE_SMART_AMP) zephyr_library_sources( ${SOF_SAMPLES_PATH}/audio/smart_amp_test_ipc4.c From 8b9803c25176fc7639f47c9c3fdda4761d255295 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 7 May 2024 12:48:48 +0200 Subject: [PATCH 4/9] build: remove a redundant call to 'str()' west.configuration.get() already returns a string, no need to call 'str()' on it again. Signed-off-by: Guennadi Liakhovetski --- scripts/xtensa-build-zephyr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 95091423852b..c0f9d48e82a7 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -934,7 +934,7 @@ 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 = [str(platform_wconfig.get("rimage.path")), "-o", str(llext_output), + sign_cmd = [platform_wconfig.get("rimage.path"), "-o", str(llext_output), "-e", "-c", str(rimage_cfg), "-k", str(signing_key), "-l", "-r", str(llext_input)] From d2cfe1cea3f6d96ab23ab762061c5dcbfee9035d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 3 Apr 2024 09:29:17 +0200 Subject: [PATCH 5/9] mixin-mixout: make modular Convert mixin-mixout to a loadable llext module. Signed-off-by: Guennadi Liakhovetski --- app/overlays/mtl/module_overlay.conf | 1 + src/audio/mixin_mixout/Kconfig | 2 +- src/audio/mixin_mixout/llext/CMakeLists.txt | 11 ++++++++ src/audio/mixin_mixout/llext/llext.toml.h | 6 +++++ src/audio/mixin_mixout/mixin_mixout.c | 28 ++++++++++++++++++++- src/audio/mixin_mixout/mixin_mixout.toml | 8 ++++-- tools/rimage/config/mtl.toml.h | 2 ++ zephyr/CMakeLists.txt | 18 ++++++++----- 8 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 src/audio/mixin_mixout/llext/CMakeLists.txt create mode 100644 src/audio/mixin_mixout/llext/llext.toml.h diff --git a/app/overlays/mtl/module_overlay.conf b/app/overlays/mtl/module_overlay.conf index 172a8ea28e82..263f9f3f5ce0 100644 --- a/app/overlays/mtl/module_overlay.conf +++ b/app/overlays/mtl/module_overlay.conf @@ -1 +1,2 @@ CONFIG_SAMPLE_SMART_AMP=m +CONFIG_COMP_MIXIN_MIXOUT=m diff --git a/src/audio/mixin_mixout/Kconfig b/src/audio/mixin_mixout/Kconfig index 2315023d61d1..852b23f18e08 100644 --- a/src/audio/mixin_mixout/Kconfig +++ b/src/audio/mixin_mixout/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause config COMP_MIXIN_MIXOUT - bool "Mixin_mixout component" + tristate "Mixin_mixout component" depends on IPC_MAJOR_4 default y help diff --git a/src/audio/mixin_mixout/llext/CMakeLists.txt b/src/audio/mixin_mixout/llext/CMakeLists.txt new file mode 100644 index 000000000000..a9743e379d54 --- /dev/null +++ b/src/audio/mixin_mixout/llext/CMakeLists.txt @@ -0,0 +1,11 @@ +# 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/llext/llext.toml.h b/src/audio/mixin_mixout/llext/llext.toml.h new file mode 100644 index 000000000000..bfadd2c55a96 --- /dev/null +++ b/src/audio/mixin_mixout/llext/llext.toml.h @@ -0,0 +1,6 @@ +#include +#define LOAD_TYPE "2" +#include "../mixin_mixout.toml" + +[module] +count = __COUNTER__ diff --git a/src/audio/mixin_mixout/mixin_mixout.c b/src/audio/mixin_mixout/mixin_mixout.c index 576b46bb31f7..a9efde4cb25e 100644 --- a/src/audio/mixin_mixout/mixin_mixout.c +++ b/src/audio/mixin_mixout/mixin_mixout.c @@ -31,7 +31,7 @@ #include "mixin_mixout.h" -LOG_MODULE_REGISTER(mixer, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_REGISTER(mixin_mixout, CONFIG_SOF_LOG_LEVEL); /* mixin 39656eb2-3b71-4049-8d3f-f92cd5c43c09 */ DECLARE_SOF_RT_UUID("mix_in", mixin_uuid, 0x39656eb2, 0x3b71, 0x4049, @@ -964,3 +964,29 @@ static const struct module_interface mixout_interface = { DECLARE_MODULE_ADAPTER(mixout_interface, mixout_uuid, mixout_tr); SOF_MODULE_INIT(mixout, sys_comp_module_mixout_interface_init); + +#if CONFIG_COMP_MIXIN_MIXOUT_MODULE +/* modular: llext dynamic link */ + +#include +#include + +#include + +#define UUID_MIXIN 0xB2, 0x6E, 0x65, 0x39, 0x71, 0x3B, 0x49, 0x40, \ + 0x8D, 0x3F, 0xF9, 0x2C, 0xD5, 0xC4, 0x3C, 0x09 +#define UUID_MIXOUT 0x5A, 0x50, 0x56, 0x3C, 0xD7, 0x24, 0x8F, 0x41, \ + 0xBD, 0xDC, 0xC1, 0xF5, 0xA3, 0xAC, 0x2A, 0xE0 + +SOF_LLEXT_MOD_ENTRY(mixin, &mixin_interface); +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_BUILDINFO; + +#endif diff --git a/src/audio/mixin_mixout/mixin_mixout.toml b/src/audio/mixin_mixout/mixin_mixout.toml index 9aedd0c7dc9d..4e799f86bdbf 100644 --- a/src/audio/mixin_mixout/mixin_mixout.toml +++ b/src/audio/mixin_mixout/mixin_mixout.toml @@ -1,10 +1,14 @@ +#ifndef LOAD_TYPE +#define LOAD_TYPE "0" +#endif + [[module.entry]] name = "MIXIN" uuid = "39656EB2-3B71-4049-8D3F-F92CD5C43C09" affinity_mask = "0x1" instance_count = "30" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "1" auto_start = "0" sched_caps = [1, 0x00008000] @@ -30,7 +34,7 @@ affinity_mask = "0x1" instance_count = "30" domain_types = "0" - load_type = "0" + load_type = LOAD_TYPE module_type = "2" auto_start = "0" sched_caps = [1, 0x00008000] diff --git a/tools/rimage/config/mtl.toml.h b/tools/rimage/config/mtl.toml.h index a1c23dbcba2c..9efd19360469 100644 --- a/tools/rimage/config/mtl.toml.h +++ b/tools/rimage/config/mtl.toml.h @@ -24,7 +24,9 @@ index = __COUNTER__ +#ifdef CONFIG_COMP_MIXIN_MIXOUT #include