Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
c0c3e8c
(---section submitted PRs START)
kv2019i Mar 23, 2026
199dd94
(---section submitted PRs STOP)
kv2019i Mar 23, 2026
f3b4346
(---section: user LL infra START)
kv2019i Mar 27, 2026
ad8c62b
ipc: move standalone-test check later in ipc_init()
kv2019i Feb 10, 2026
ece25d4
audio: component: add comp_grant_access_to_thread()
kv2019i Feb 13, 2026
4541dbd
audio: component: replace k_mutex with sys_mutex for list_mutex
kv2019i Apr 22, 2026
e5cfa9c
rtos: alloc.h: add sof_sys_user_heap_get()
kv2019i Mar 18, 2026
856baa1
zephyr: lib: make sof_heap_alloc/free system calls
kv2019i May 8, 2026
9bdc003
schedule: zephyr_ll_user: make the heap accessible from user-space
kv2019i Feb 13, 2026
aefb8cd
schedule: zephyr_ll: convert pdata->sem into a dynamic object
kv2019i Feb 13, 2026
76ee496
schedule: zephyr_ll: replace dynamic k_sem with embedded sys_sem
kv2019i Apr 22, 2026
fb2a414
schedule: zephyr_ll_user: move user accessible heap to common partition
kv2019i Feb 13, 2026
e4c9895
dma: dma_sg: allocate on specific heap
kv2019i Feb 16, 2026
5ef8124
buffer: extend ability to allocate on specific heap to all functions
kv2019i May 5, 2026
4a58009
buffer: extend ability to allocate on specific heap to all functions,…
kv2019i May 8, 2026
fb7042b
app: overlays: ptl: add ll_usespace_overlay.conf
kv2019i Apr 14, 2026
2e8e272
app: overlays: ptl: disable cold/dram execution for now
kv2019i May 6, 2026
0a3a0aa
app: overlays: ptl: set CONFIG_SOF_ZEPHYR_LL_USER_HEAP_SIZE
kv2019i Apr 29, 2026
8ef98d2
(---section: user LL infra STOP)
kv2019i Mar 27, 2026
dab49cb
(---section host-zephyr START)
kv2019i Feb 19, 2026
75aaf2f
zephyr: userspace: sof_dma: allow circular SG lists
kv2019i Feb 19, 2026
2497049
zephyr: lib: dma: make DMA platform data available to user-space
kv2019i Feb 13, 2026
9ef6c17
audio: host-zephyr: select heap when allocating host buffers
kv2019i Feb 13, 2026
9fc60d7
audio: host-zephyr: pass component heap to dma_sg_alloc
kv2019i Feb 16, 2026
4420213
alloc.h: remove rbrelloac() and rbrealloc_align()
kv2019i Feb 16, 2026
041864c
audio: host-zephyr: ensure host data heap is set
kv2019i Feb 16, 2026
3ff827e
audio: host-zephyr: make component usable from user-space
kv2019i Apr 10, 2026
f904026
audio: host-zephyr: use module context for allocations
kv2019i May 8, 2026
5a9faaa
(---section host-zephyr STOP)
kv2019i Feb 19, 2026
9152a9e
(---section dai-zephyr START)
kv2019i Feb 19, 2026
065f98e
audio: dai-zephyr: make memory allocations user-space compatible
kv2019i May 5, 2026
2e840c7
lib: dai: make dai_get() and dai_put() compatible with user-space
kv2019i Feb 17, 2026
e5206e6
audio: dai-zephyr: rework calls to DMA driver, remove channel pointer
kv2019i Feb 17, 2026
e4cbdf3
audio: dai-zephyr: convert spinlock into mutex for properties
kv2019i Feb 17, 2026
a41927d
audio: dai-zephyr: migrate to use dai_get_properties_copy()
kv2019i Feb 18, 2026
3e5b5d7
dai: zephyr: replace k_mutex with sys_mutex for DAI lock
kv2019i Apr 22, 2026
9c57b85
audio: dai-zephyr: use module context for allocations
kv2019i May 8, 2026
0ef884b
(---section dai-zephyr STOP)
kv2019i Feb 19, 2026
304270d
(---section audio module infra START)
kv2019i Mar 3, 2026
ca6393a
audio: module_adapter: alloc from LL user heap if LL run in user
kv2019i May 5, 2026
71edb94
audio: copier: export copier endpoint ops to user-space
kv2019i Feb 26, 2026
55ffbae
(---section schduler changes START)
kv2019i Mar 3, 2026
1c13d48
schedule: zephyr_ll: add zephyr_ll_task_free()
kv2019i Feb 26, 2026
14a6652
schedule: zephyr_ll: add zephyr_ll_grant_access()
kv2019i Feb 26, 2026
62fb6f9
schedule: zephyr_ll_user: make double-mapping conditional
kv2019i Mar 4, 2026
797a773
schedule: allocate the scheduler objects with sof_heap_alloc
kv2019i Feb 26, 2026
a90f35a
WIP: schedule: limit user-LL to core0
kv2019i Feb 26, 2026
8cd17a6
zephyr: schedule: allow user-space to access scheduler list
kv2019i Feb 26, 2026
11c977f
zephyr: wrapper: modify platform_dai_wallclock() for user-space
kv2019i Feb 26, 2026
4d02361
schedule: add scheduler_init_context() and scheduler_free_context()
kv2019i Feb 27, 2026
c47ae1f
schedule: zephyr_ll: implement scheduler_init_context()
kv2019i Feb 26, 2026
c68dbe0
schedule: ll_schedule_domain: add domain_thread_init/free ops
kv2019i Mar 4, 2026
9848c9b
schedule: zephyr_ll: implement thread_init/free domain ops
kv2019i May 5, 2026
42fd203
schedule: zephyr_ll: ISR check is not needed when LL in user-space
kv2019i Mar 31, 2026
3c111d4
zephyr: userspace_helper: add new sys_user_heap_init()
kv2019i Mar 31, 2026
ebee27d
sched: ll_user: add independent heap size config for LL userspace
kv2019i Apr 29, 2026
a703323
(---section schduler changes END)
kv2019i Mar 3, 2026
7d47c95
(---section audio-user PRs START)
kv2019i Mar 25, 2026
da1ff91
schedule: zephyr_domain: use a different thread name for user LL
kv2019i Mar 24, 2026
f14eaf6
WIP: audio: module_adapter: use correct heap when freeing
kv2019i May 5, 2026
8d40f1b
coherent: disable core debug checks for user-space builds
kv2019i Mar 20, 2026
d932ac6
audio: place component driver list in user-space accessible partition
kv2019i Mar 24, 2026
58eec6a
audio: module_adapter: make adapter buffering user-space compatible
kv2019i Mar 24, 2026
103f105
audio: pipeline: use LL scheduler mutex for userspace pipeline triggers
kv2019i Feb 26, 2026
eecdeac
schedule: zephyr_ll: replace k_mutex with sys_mutex for scheduler lock
kv2019i Apr 22, 2026
1ec07e3
audio: buffer: move dp_heap_user lifecycle to IPC and module adapter
kv2019i May 5, 2026
9fe6625
Revert "audio: buffer: move dp_heap_user lifecycle to IPC and module …
kv2019i May 5, 2026
87df471
audio: host-zepher: add HOST_DMA_IPC_POSITION_UPDATES Kconfig
kv2019i May 5, 2026
a7ba822
audio: copier_host: make FPI sync group availble to user-space
kv2019i Mar 31, 2026
1bcc857
audio: copier: avoid IRQ lock/unlock in chmap code
kv2019i Mar 31, 2026
aa3fb90
audio: module_adapter: avoid IRQ lock/unlock in prepare()
kv2019i Mar 31, 2026
039d42d
audio: module_adapter: make data_blob compatible with user-space
kv2019i Apr 14, 2026
d20c8ee
audio: module-adapter: make generic.c user-space compatible
kv2019i Apr 16, 2026
8ea5294
audio: module_adapter: use module context for allocations
kv2019i May 8, 2026
eb08138
audio: module: generic: use module context for blob allocations
kv2019i May 8, 2026
7682c70
audio: make comp_drivers_get() accessible from user-space
kv2019i Apr 15, 2026
72d2e87
dai: turn dai_get_device() into a syscall
kv2019i Apr 15, 2026
9f99963
audio: chain_dma: add user-space memory and scheduling support
kv2019i Apr 21, 2026
e119c87
audio: chain-dma: use module context for allocations
kv2019i May 8, 2026
efb6a60
(---section audio user PRs STOP)
kv2019i Mar 25, 2026
07b9740
(---section: IPC user support START)
kv2019i Mar 17, 2026
145b87d
userspace: split ipc files into user and kernel features. REVISIT memcpy
kv2019i Apr 1, 2026
6e3c427
ipc4: helper: use LL scheduler lock for userspace builds
kv2019i Mar 26, 2026
62b575a
WIP: ipc: implement user-space IPC handling for CREATE_PIPELINE
kv2019i Mar 12, 2026
6a9345c
WIP: ipc: ipc4: route PIPELINE_DELETE to user-space handler
kv2019i Mar 30, 2026
21633c7
ipc: make IPC stack thread size configurable
Apr 1, 2026
22004b7
ipc: ipc4: use sof_heap_alloc in ipc4_add_comp_dev()
kv2019i Mar 19, 2026
51deb5c
ipc: turn ipc_msg_reply() into a system call
kv2019i Mar 30, 2026
86f60b0
ipc: ipc4: use correct API to get DMA status
kv2019i Mar 19, 2026
053e89d
ipc: ipc4: dai: fix direct use of DMA driver calls
kv2019i Apr 16, 2026
2c00c95
ipc: use application heap for IPC pipeline and component allocations
kv2019i Mar 20, 2026
599b042
ipc4: make fw_reg mutex available to user-space
kv2019i Apr 15, 2026
4a8606b
ipc: ipc4: helper: make ipc4_search_for_drv() userspace compatible
kv2019i Mar 31, 2026
1332f37
WIP: schedule: add multi-core support for user-space LL scheduler
kv2019i Apr 22, 2026
a7323c8
ipc: ipc-helper: trace context not used in user-space
kv2019i Apr 13, 2026
b1ddec5
ipc: ipc4: use the core number from IPC config
kv2019i May 5, 2026
380ade2
ipc: ipc4: helper: enable limited ipc_comp_connect() in user-space
kv2019i Apr 13, 2026
27bd403
WIP: ipc: ipc4: route MOD_CONFIG_GET/SET to user-space handler
kv2019i Apr 10, 2026
605c7bf
WIP: ipc: ipc4: route MOD_BIND/UNBIND to user-space handler
kv2019i Apr 10, 2026
d31d8a1
WIP: ipc: ipc4: route MOD_INIT_INSTANCE to user-space handler
kv2019i May 5, 2026
d73d59c
WIP: ipc: ipc4: route GLB_SET_PIPELINE_STATE to user-space handler
kv2019i Apr 16, 2026
1affcf9
WIP: ipc: ipc4: route MOD_LARGE_CONFIG_GET/SET user-space
kv2019i Apr 16, 2026
daadb34
(---section: IPC user support STOP)
kv2019i Mar 27, 2026
a0372fc
(---section: IPC notifications START)
kv2019i May 8, 2026
0dd7dcc
ipc: turn ipc_msg_send() into a system call if SOF_USERSPACE_LL=y
Apr 20, 2026
664a14a
ipc: make IPC message allocation userspace-safe
Apr 21, 2026
496ef76
ipc4: notification: make send_resource_notif() a syscall
Apr 23, 2026
9bb6f89
(---section: IPC notifications STOP)
kv2019i May 8, 2026
82d8a4c
ipc: add a mod_alloc_ctx context to IPC context
kv2019i May 8, 2026
be4bada
zephyr: lib: make vregion_alloc/free system calls
kv2019i May 5, 2026
b70a6ed
(---section test-case START)
kv2019i Feb 19, 2026
9557461
zephyr: test: userspace: add pipeline_two_components test
kv2019i Apr 22, 2026
e6271cf
(---section WIP mandatory changes START)
kv2019i Feb 19, 2026
98aff19
audio: pipeline: enable position reporting for user-space pipelines
kv2019i Mar 17, 2026
41243dc
WIP: ipc: expose coldrodata to IPC user thread
kv2019i Apr 16, 2026
c9f66dd
HACK: audio: collection of feature limitations to run LL in user
kv2019i Feb 26, 2026
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
27 changes: 27 additions & 0 deletions app/overlays/ptl/ll_userspace_overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CONFIG_SOF_USERSPACE_LL=y

# Problem with DSP panics due to illegal instruction hit in user-space if cold
# store execution is enabled. Disable it for now until rootcause is found.
CONFIG_COLD_STORE_EXECUTE_DRAM=n

# temporary (but for now mandatory) settings
CONFIG_SOF_ZEPHYR_USERSPACE_MODULE_HEAP_SIZE=16384
CONFIG_SOF_ZEPHYR_LL_USER_HEAP_SIZE=0x1f000

# make the drivers work in user-space
CONFIG_SOF_USERSPACE_INTERFACE_DMA=y
CONFIG_DAI_USERSPACE=y

# disable features that don't work in user-space (at least yet)
CONFIG_COLD_STORE_EXECUTE_DEBUG=n
CONFIG_CROSS_CORE_STREAM=n
CONFIG_INTEL_ADSP_MIC_PRIVACY=n
CONFIG_XRUN_NOTIFICATIONS_ENABLE=n
CONFIG_SOF_BOOT_TEST_ALLOWED=n
CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS=n
CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS=n

# disable llext (hits privilege issues in user-space now)
CONFIG_LLEXT_STORAGE_WRITABLE=n
CONFIG_LLEXT_EXPERIMENTAL=n
CONFIG_MODULES=n
23 changes: 0 additions & 23 deletions posix/include/rtos/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,6 @@ static inline void *rballoc(uint32_t flags, size_t bytes)
return rballoc_align(flags, bytes, PLATFORM_DCACHE_ALIGN);
}

/**
* Changes size of the memory block allocated.
* @param ptr Address of the block to resize.
* @param flags Flags, see SOF_MEM_FLAG_...
* @param bytes New size in bytes.
* @param old_bytes Old size in bytes.
* @param alignment Alignment in bytes.
* @return Pointer to the resized memory of NULL if failed.
*/
void *rbrealloc_align(void *ptr, uint32_t flags, size_t bytes,
size_t old_bytes, uint32_t alignment);

/**
* Similar to rballoc_align(), returns resized buffer aligned to
* PLATFORM_DCACHE_ALIGN.
*/
static inline void *rbrealloc(void *ptr, uint32_t flags,
size_t bytes, size_t old_bytes)
{
return rbrealloc_align(ptr, flags, bytes, old_bytes,
PLATFORM_DCACHE_ALIGN);
}

/**
* Frees the memory block.
* @param ptr Pointer to the memory block.
Expand Down
21 changes: 21 additions & 0 deletions posix/include/rtos/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,25 @@ static inline int sys_mutex_unlock(struct sys_mutex *mutex)
return 0;
}

/* provide a no-op implementation for zephyr/sys/sem.h */

struct sys_sem {
};

static inline int sys_sem_init(struct sys_sem *sem, unsigned int initial_count,
unsigned int limit)
{
return 0;
}

static inline int sys_sem_give(struct sys_sem *sem)
{
return 0;
}

static inline int sys_sem_take(struct sys_sem *sem, k_timeout_t timeout)
{
return 0;
}

#endif
6 changes: 4 additions & 2 deletions posix/include/sof/lib/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

struct comp_buffer;
struct comp_dev;
struct k_heap;

/** \addtogroup sof_dma_drivers DMA Drivers
* DMA Drivers API specification.
Expand Down Expand Up @@ -511,13 +512,14 @@ static inline void dma_sg_init(struct dma_sg_elem_array *ea)
ea->elems = NULL;
}

int dma_sg_alloc(struct dma_sg_elem_array *ea,
int dma_sg_alloc(struct k_heap *heap,
struct dma_sg_elem_array *ea,
uint32_t flags,
uint32_t direction,
uint32_t buffer_count, uint32_t buffer_bytes,
uintptr_t dma_buffer_addr, uintptr_t external_addr);

void dma_sg_free(struct dma_sg_elem_array *ea);
void dma_sg_free(struct k_heap *heap, struct dma_sg_elem_array *ea);

/**
* \brief Get the total size of SG buffer
Expand Down
8 changes: 8 additions & 0 deletions src/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ config HOST_DMA_STREAM_SYNCHRONIZATION
for each group, different than the default one determined by the system tick frequency.
This feature will allow host lower power consumption in scenarios with deep buffering.

config HOST_DMA_IPC_POSITION_UPDATES
bool "Support for stream position updates via IPC messages"
default y if IPC_MAJOR_3
help
Support firmware functionality to report stream position updates
by sending a IPC message whenever one period of audio is transfferred.
Most platforms provide more efficient ways to query the DMA status.

config COMP_CHAIN_DMA
bool "Chain DMA component"
depends on IPC_MAJOR_4
Expand Down
113 changes: 87 additions & 26 deletions src/audio/buffers/comp_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,16 @@ static void comp_buffer_free(struct sof_audio_buffer *audio_buffer)

struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;

#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
vregion_free(alloc->vreg, buffer->stream.addr);
else
sof_heap_free(alloc->heap, buffer->stream.addr);
#else
rfree(buffer->stream.addr);
#endif

if (alloc && alloc->vreg) {
vregion_free(alloc->vreg, buffer);
if (!vregion_put(alloc->vreg))
Expand Down Expand Up @@ -254,7 +263,15 @@ struct comp_buffer *buffer_alloc(struct mod_alloc_ctx *alloc, size_t size, uint3
return NULL;
}

#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
stream_addr = vregion_alloc_align(alloc->vreg, VREGION_MEM_TYPE_INTERIM, size, align);
else
stream_addr = sof_heap_alloc(alloc->heap, flags, size, align);
#else
stream_addr = rballoc_align(flags, size, align);
#endif
if (!stream_addr) {
tr_err(&buffer_tr, "could not alloc size = %zu bytes of flags = 0x%x",
size, flags);
Expand All @@ -264,7 +281,15 @@ struct comp_buffer *buffer_alloc(struct mod_alloc_ctx *alloc, size_t size, uint3
buffer = buffer_alloc_struct(alloc, stream_addr, size, flags, is_shared);
if (!buffer) {
tr_err(&buffer_tr, "could not alloc buffer structure");
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
vregion_free(alloc->vreg, stream_addr);
else
sof_heap_free(alloc->heap, stream_addr);
#else
rfree(stream_addr);
#endif
}

return buffer;
Expand Down Expand Up @@ -292,7 +317,15 @@ struct comp_buffer *buffer_alloc_range(struct mod_alloc_ctx *alloc, size_t prefe
preferred_size += minimum_size - preferred_size % minimum_size;

for (size = preferred_size; size >= minimum_size; size -= minimum_size) {
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
stream_addr = vregion_alloc_align(alloc->vreg, VREGION_MEM_TYPE_INTERIM, size, align);
else
stream_addr = sof_heap_alloc(alloc->heap, flags, size, align);
#else
stream_addr = rballoc_align(flags, size, align);
#endif
if (stream_addr)
break;
}
Expand All @@ -308,7 +341,15 @@ struct comp_buffer *buffer_alloc_range(struct mod_alloc_ctx *alloc, size_t prefe
buffer = buffer_alloc_struct(alloc, stream_addr, size, flags, is_shared);
if (!buffer) {
tr_err(&buffer_tr, "could not alloc buffer structure");
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
vregion_free(alloc->vreg, stream_addr);
else
sof_heap_free(alloc->heap, stream_addr);
#else
rfree(stream_addr);
#endif
}

return buffer;
Expand All @@ -329,6 +370,7 @@ void buffer_zero(struct comp_buffer *buffer)
int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignment)
{
void *new_ptr = NULL;
struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;

CORE_CHECK_STRUCT(&buffer->audio_buffer);

Expand All @@ -341,14 +383,16 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignmen
if (size == audio_stream_get_size(&buffer->stream))
return 0;

if (!alignment)
new_ptr = rbrealloc(audio_stream_get_addr(&buffer->stream),
buffer->flags | SOF_MEM_FLAG_NO_COPY,
size, audio_stream_get_size(&buffer->stream));
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
new_ptr = vregion_alloc_align(alloc->vreg, VREGION_MEM_TYPE_INTERIM, size, alignment);
else
new_ptr = rbrealloc_align(audio_stream_get_addr(&buffer->stream),
buffer->flags | SOF_MEM_FLAG_NO_COPY, size,
audio_stream_get_size(&buffer->stream), alignment);
new_ptr = sof_heap_alloc(alloc->heap, buffer->flags, size, alignment);
#else
new_ptr = rballoc_align(buffer->flags, size, alignment);
#endif

/* we couldn't allocate bigger chunk */
if (!new_ptr && size > audio_stream_get_size(&buffer->stream)) {
buf_err(buffer, "resize can't alloc %u bytes of flags 0x%x",
Expand All @@ -357,8 +401,18 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignmen
}

/* use bigger chunk, else just use the old chunk but set smaller */
if (new_ptr)
if (new_ptr) {
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
vregion_free(alloc->vreg, audio_stream_get_addr(&buffer->stream));
else
sof_heap_free(alloc->heap, audio_stream_get_addr(&buffer->stream));
#else
rfree(audio_stream_get_addr(&buffer->stream));
#endif
buffer->stream.addr = new_ptr;
}

buffer_init_stream(buffer, size);

Expand All @@ -368,10 +422,10 @@ int buffer_set_size(struct comp_buffer *buffer, uint32_t size, uint32_t alignmen
int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, size_t minimum_size,
uint32_t alignment)
{
void *ptr = audio_stream_get_addr(&buffer->stream);
const size_t actual_size = audio_stream_get_size(&buffer->stream);
void *new_ptr = NULL;
size_t new_size;
struct mod_alloc_ctx *alloc = buffer->audio_buffer.alloc;

CORE_CHECK_STRUCT(&buffer->audio_buffer);

Expand All @@ -389,22 +443,19 @@ int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, siz
if (preferred_size == actual_size)
return 0;

if (!alignment) {
for (new_size = preferred_size; new_size >= minimum_size;
new_size -= minimum_size) {
new_ptr = rbrealloc(ptr, buffer->flags | SOF_MEM_FLAG_NO_COPY,
new_size, actual_size);
if (new_ptr)
break;
}
} else {
for (new_size = preferred_size; new_size >= minimum_size;
new_size -= minimum_size) {
new_ptr = rbrealloc_align(ptr, buffer->flags | SOF_MEM_FLAG_NO_COPY,
new_size, actual_size, alignment);
if (new_ptr)
break;
}
for (new_size = preferred_size; new_size >= minimum_size;
new_size -= minimum_size) {
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
new_ptr = vregion_alloc_align(alloc->vreg, VREGION_MEM_TYPE_INTERIM, new_size, alignment);
else
new_ptr = sof_heap_alloc(alloc->heap, buffer->flags, new_size, alignment);
#else
new_ptr = rballoc_align(buffer->flags, new_size, alignment);
#endif
if (new_ptr)
break;
}

/* we couldn't allocate bigger chunk */
Expand All @@ -415,8 +466,18 @@ int buffer_set_size_range(struct comp_buffer *buffer, size_t preferred_size, siz
}

/* use bigger chunk, else just use the old chunk but set smaller */
if (new_ptr)
if (new_ptr) {
#ifdef CONFIG_SOF_USERSPACE_LL
assert(alloc);
if (alloc->vreg)
vregion_free(alloc->vreg, audio_stream_get_addr(&buffer->stream));
else
sof_heap_free(alloc->heap, audio_stream_get_addr(&buffer->stream));
#else
rfree(audio_stream_get_addr(&buffer->stream));
#endif
buffer->stream.addr = new_ptr;
}

buffer_init_stream(buffer, new_size);

Expand Down
Loading
Loading