Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Volume LLEXT #9172

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d5b3a93
llext: fix Windows builds
lyakh Jun 7, 2024
4f4783d
ipc4: a failure to find a driver might not be fatal
lyakh Jun 7, 2024
4120cc1
samples: (cosmetic) clean up Kconfig spacing
lyakh Jun 13, 2024
0bf7192
llext: add a convenience Kconfig option to build LLEXT modules
lyakh Jun 13, 2024
43ebb89
mtl: build all supporting code as LLEXT modules
lyakh Jun 13, 2024
1b2026c
llext: add maximum instance count support
lyakh Jun 14, 2024
f41e726
rimage: propagate maximum module instance counts
lyakh Jun 14, 2024
2937c5b
log: disable the logging task before clearing log state
lyakh Jun 17, 2024
8bd91c1
eq_iir: reduce logging verbosity during freeing
lyakh Jun 17, 2024
03d8b8a
llext: add missing modules to LNL overlay
lyakh Jun 13, 2024
7467ecf
llext: automatically calculate module addresses
lyakh May 30, 2024
799ef93
src: convert to a loadable module
lyakh Jun 13, 2024
faea605
volume: move gain.toml and peakvol.toml into volume.toml
lyakh May 28, 2024
f39cb29
llext: export 2 symbols, required for modular volume
lyakh May 28, 2024
ec2676a
volume: add LLEXT support
lyakh May 28, 2024
18337c5
eq-fir: enable building as an llext module
lyakh Jun 3, 2024
0221491
asrc: enable building as an llext module
lyakh Jun 3, 2024
3ce65e6
drc: enable building as an llext module
lyakh Jun 3, 2024
87cd5ba
llext: export symbols, required for eq_fir
lyakh Jun 19, 2024
9c4ff6d
drc: make modular on MTL and LNL
lyakh Jun 19, 2024
f0616f8
west: update to Zephyr with latest LLEXT fixes
lyakh Jun 19, 2024
b702762
[DNM] Disable KCPS_DYNAMIC_CLOCK_CONTROL to test speaker-test
lyakh Jun 26, 2024
a62fcda
llext: fix multi-core use cases
lyakh Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
6 changes: 3 additions & 3 deletions app/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/overlays/lnl/module_overlay.conf
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions app/overlays/mtl/module_overlay.conf
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions scripts/llext_link_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand All @@ -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
Expand Down
47 changes: 47 additions & 0 deletions scripts/llext_offset_calc.py
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 3 additions & 1 deletion scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import gzip
import dataclasses
import concurrent.futures as concurrent
import re

from west import configuration as west_config

Expand Down Expand Up @@ -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)]
Expand Down
5 changes: 3 additions & 2 deletions src/audio/asrc/Kconfig
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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"

Expand Down
23 changes: 20 additions & 3 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#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
6 changes: 5 additions & 1 deletion src/audio/asrc/asrc.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

[[module.entry]]
name = "ASRC"
uuid = "66B4402D-B468-42F2-81A7-B37121863DD4"
affinity_mask = "0x3"
instance_count = "2"
domain_types = "0"

load_type = "0"
load_type = LOAD_TYPE
module_type = "9"
auto_start = "0"
sched_caps = [1, 0x00008000]
Expand Down
10 changes: 10 additions & 0 deletions src/audio/asrc/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
6 changes: 6 additions & 0 deletions src/audio/asrc/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../asrc.toml"

[module]
count = __COUNTER__
1 change: 1 addition & 0 deletions src/audio/data_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/audio/drc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions src/audio/drc/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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 <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

#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
6 changes: 5 additions & 1 deletion src/audio/drc/drc.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#ifndef LOAD_TYPE
#define LOAD_TYPE "0"
#endif

REM # DRC module config
[[module.entry]]
name = "DRC"
uuid = "B36EE4DA-006F-47F9-A06D-FECBE2D8B6CE"
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]
Expand Down
11 changes: 11 additions & 0 deletions src/audio/drc/llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
6 changes: 6 additions & 0 deletions src/audio/drc/llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <tools/rimage/config/platform.toml>
#define LOAD_TYPE "2"
#include "../drc.toml"

[module]
count = __COUNTER__
3 changes: 2 additions & 1 deletion src/audio/eq_fir/Kconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading
Loading