Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
bc2c514
scripts: create symlink for community base FW binary
lrgirdwo Oct 8, 2025
ab21ed6
scripts: vscode: use script dir as fallback workspace
lrgirdwo Nov 5, 2025
2ae160c
scripts: use local directory if workspace not defined.
lrgirdwo Nov 13, 2025
c2df198
vpages: Add a simple virtual continuous page allocator
lrgirdwo Oct 23, 2025
2e8fda2
vregion: Add support for per pipeline/module virtual regions
lrgirdwo Oct 23, 2025
b6b8c4c
module: memory: split out module memory API to new files.
lrgirdwo Nov 11, 2025
434047d
TEST: vregion: force enable for testing.
lrgirdwo Oct 23, 2025
fa64804
wip: pipeline: add support for pipeline vregion.
lrgirdwo Oct 23, 2025
dc3231e
wip: vregion: add DP module support for vregion.
lrgirdwo Oct 23, 2025
4d03353
module: adapter: move pipeline discovery before we alloc module
lrgirdwo Nov 12, 2025
de47258
module: generic: use module memory APIs
lrgirdwo Nov 12, 2025
b31de06
module: adapter: use module memory APIs
lrgirdwo Nov 12, 2025
60ea9ae
module: cadence: use module memory APIs
lrgirdwo Nov 12, 2025
7415622
fast-get: use mod-alloc() API for fast-get internal usage.
lrgirdwo Nov 18, 2025
7e46033
module: vregions: add module support to use virtual regions
lrgirdwo Nov 12, 2025
ef65da9
cmocka: fix valigrind leaks
lrgirdwo Nov 18, 2025
5ea392c
cmocka: add mod_alloc() APIs to cmocka tests.
lrgirdwo Nov 18, 2025
3ab5d58
wip: trace: add a simple trace point tht kernel can print
lrgirdwo Nov 21, 2025
fcdff70
ipc4: helper: fix buffer size always being cleared after set.
lrgirdwo Nov 21, 2025
ec50b14
module_adapter: ipc4 stream params never have extended data
lrgirdwo Nov 21, 2025
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
90 changes: 90 additions & 0 deletions posix/include/sof/lib/vregion.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright(c) 2025 Intel Corporation.

/* Pre Allocated Contiguous Virtual Region */
#ifndef __SOF_LIB_VREGION_H__
#define __SOF_LIB_VREGION_H__

#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

struct vregion;

/**
* @brief Create a new virtual region instance.
*
* Create a new virtual region instance with specified static, dynamic, and shared static sizes
* plus an optional read-only text partition and optional shared static partition.
* Total size is the sum of static, dynamic, shared static, and text sizes.
*
* @param[in] lifetime_size Size of the virtual region lifetime partition.
* @param[in] interim_size Size of the virtual region interim partition.
* @param[in] lifetime_shared_size Size of the virtual region shared lifetime partition.
* @param[in] interim_shared_size Size of the virtual region shared interim partition.
* @param[in] text_size Size of the optional read-only text partition.
* @return struct vregion* Pointer to the new virtual region instance, or NULL on failure.
*/
struct vregion *vregion_create(size_t lifetime_size, size_t interim_size,
size_t lifetime_shared_size, size_t interim_shared_size,
size_t text_size);

/**
* @brief Destroy a virtual region instance.
*
* Free all associated resources and deallocate the virtual region instance.
*
* @param[in] vr Pointer to the virtual region instance to destroy.
*/
void vregion_destroy(struct vregion *vr);

/**
* @brief Memory types for virtual region allocations.
* Used to specify the type of memory allocation within a virtual region.
*/
enum vregion_mem_type {
VREGION_MEM_TYPE_INTERIM, /* interim allocation that can be freed */
VREGION_MEM_TYPE_LIFETIME, /* lifetime allocation */
VREGION_MEM_TYPE_INTERIM_SHARED, /* shared interim allocation */
VREGION_MEM_TYPE_LIFETIME_SHARED /* shared lifetime allocation */
};
void *vregion_alloc(struct vregion *vr, enum vregion_mem_type type, size_t size);

/**
* @brief Allocate aligned memory from the specified virtual region.
*
* Allocate aligned memory from the specified virtual region based on the memory type.
*
* @param[in] vr Pointer to the virtual region instance.
* @param[in] type Type of memory to allocate (static, dynamic, or shared static).
* @param[in] size Size of memory to allocate in bytes.
* @param[in] alignment Alignment of memory to allocate in bytes.
* @return void* Pointer to the allocated memory, or NULL on failure.
*/
void *vregion_alloc_align(struct vregion *vr, enum vregion_mem_type type,
size_t size, size_t alignment);

/**
* @brief Free memory allocated from the specified virtual region.
*
* Free memory previously allocated from the specified virtual region.
*
* @param[in] vr Pointer to the virtual region instance.
* @param[in] ptr Pointer to the memory to free.
*/
void vregion_free(struct vregion *vr, void *ptr);

/**
* @brief Log virtual region memory usage.
*
* @param[in] vr Pointer to the virtual region instance.
*/
void vregion_info(struct vregion *vr);

#ifdef __cplusplus
}
#endif

#endif /* __SOF_LIB_VREGION_H__ */
7 changes: 5 additions & 2 deletions scripts/sof-testbench-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ usage() {
}

if [ -z "${SOF_WORKSPACE}" ]; then
echo "Error: environment variable SOF_WORKSPACE need to be set to top level sof directory"
exit 1
# fallback to the script directory default path
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SOF_REPO=$(dirname "$SCRIPT_DIR")
SOF_WORKSPACE="$SOF_REPO/../"
echo "Using default SOF environment at $SOF_WORKSPACE"
fi

OUTWAV=
Expand Down
19 changes: 9 additions & 10 deletions scripts/vscode-task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
# Simple helper script for vscode task support.
# Current vscode tasks have difficulty executing multiple commands.

# check if Zephyr environment is set up
if [ ! -z "$ZEPHYR_BASE" ]; then
VENV_DIR="$ZEPHYR_BASE/.venv"
echo "Using Zephyr environment at $ZEPHYR_BASE"
elif [ ! -z "$SOF_WORKSPACE" ]; then
VENV_DIR="$SOF_WORKSPACE/zephyr/.venv"
echo "Using SOF/Zephyr environment at $SOF_WORKSPACE"
# check if SOF workspace environment is set up
if [ ! -z "$SOF_WORKSPACE" ]; then
VENV_DIR="$SOF_WORKSPACE/.venv"
echo "Using SOF environment at $SOF_WORKSPACE"
else
# fallback to the zephyr default from the getting started guide
VENV_DIR="$HOME/zephyrproject/.venv"
echo "Using default Zephyr environment at $VENV_DIR"
# fallback to the script directory default path
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SOF_REPO=$(dirname "$SCRIPT_DIR")
VENV_DIR="$SOF_REPO/../.venv"
echo "Using default SOF environment at $VENV_DIR"
fi

# start the virtual environment
Expand Down
10 changes: 10 additions & 0 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,16 @@ def install_platform(platform, sof_output_dir, platf_build_environ, platform_wco

os.makedirs(alias_key_dir, exist_ok=True)
symlink_or_copy(install_key_dir, output_fwname, alias_key_dir, alias_fwname)

# Also create the "plain" sof-<platform>.ri symlink in the
# sof/<vendor>/sof-ipc4/<platform> directory, so that when
# copying the entire sof/<vendor>/sof-ipc4 directory to
# the target, all platforms are there.
alias_vendor_dir = pathlib.Path(sof_output_dir, p_alias).parent
alias_ipc4_dir = pathlib.Path(alias_vendor_dir, p_alias)
alias_install_key_dir = alias_ipc4_dir / "community"
os.makedirs(alias_ipc4_dir, exist_ok=True)
symlink_or_copy(alias_install_key_dir, alias_fwname, alias_ipc4_dir, alias_fwname)
else:
# non deployable builds and IPC3 deployable builds are using the same symlink scheme
# The production key is usually different
Expand Down
11 changes: 9 additions & 2 deletions src/audio/module_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof module_adapter.c module_adapter_ipc3.c module/generic.c)
add_local_sources(sof module_adapter.c module_adapter_ipc3.c module/generic.c
module/memory-common.c module/memory-heap.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof module_adapter.c module_adapter_ipc4.c module/generic.c)
add_local_sources(sof module_adapter.c module_adapter_ipc4.c module/generic.c
module/memory-common.c)
if(CONFIG_SOF_VREGIONS)
add_local_sources(sof module/memory-regions.c)
else()
add_local_sources(sof module/memory-heap.c)
endif()
endif()

is_zephyr(zephyr)
Expand Down
8 changes: 4 additions & 4 deletions src/audio/module_adapter/module/cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ static int cadence_codec_init(struct processing_module *mod)
}

/* allocate memory for runtime set up config */
codec->cfg.data = rmalloc(SOF_MEM_FLAG_USER,
cfg->param_size);
codec->cfg.data = mod_alloc_ext(mod, SOF_MEM_FLAG_USER,
cfg->param_size, 0);
if (!codec->cfg.data) {
comp_err(dev, "failed to alloc runtime setup config");
ret = -ENOMEM;
Expand Down Expand Up @@ -326,7 +326,7 @@ static int cadence_codec_init(struct processing_module *mod)
return 0;

free_cfg2:
rfree(codec->cfg.data);
mod_free(mod, codec->cfg.data);
free_cfg:
rfree(setup_cfg->data);
free:
Expand Down Expand Up @@ -866,7 +866,7 @@ static int cadence_codec_free(struct processing_module *mod)
{
struct cadence_codec_data *cd = module_get_private_data(mod);

rfree(cd->setup_cfg.data);
mod_free(mod, cd->setup_cfg.data);
mod_free_all(mod);
rfree(cd->self);
rfree(cd);
Expand Down
Loading