Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
f0065a0
(---section submitted PRs START)
kv2019i Mar 23, 2026
c84e5e6
(---section submitted PRs STOP)
kv2019i Mar 23, 2026
9011bd3
(---section: user LL infra START)
kv2019i Mar 27, 2026
1375774
ipc: move standalone-test check later in ipc_init()
kv2019i Feb 10, 2026
4992c5c
audio: component: add comp_grant_access_to_thread()
kv2019i Feb 13, 2026
4b88295
pipeline: protect component connections with a mutex
kv2019i Feb 12, 2026
7aa0732
audio: component: replace k_mutex with sys_mutex for list_mutex
kv2019i Apr 22, 2026
ceb9685
rtos: alloc.h: add sof_sys_user_heap_get()
kv2019i Mar 18, 2026
225c89c
zephyr: rtos: userspace_helper.h: add sysuser memory partition
kv2019i Mar 26, 2026
4c57ab1
zephyr: lib: make sof_heap_alloc/free system calls
kv2019i Feb 13, 2026
e51fc1e
schedule: zephyr_ll_user: make the heap accessible from user-space
kv2019i Feb 13, 2026
4592862
schedule: zephyr_ll: convert pdata->sem into a dynamic object
kv2019i Feb 13, 2026
dd8ab4c
schedule: zephyr_ll: replace dynamic k_sem with embedded sys_sem
kv2019i Apr 22, 2026
8aaa004
schedule: zephyr_ll_user: move user accessible heap to common partition
kv2019i Feb 13, 2026
6d617ae
dma: dma_sg: allocate on specific heap
kv2019i Feb 16, 2026
a9eac57
buffer: extend ability to allocate on specific heap to all functions
kv2019i Feb 16, 2026
7530c71
app: overlays: ptl: add ll_usespace_overlay.conf
kv2019i Apr 14, 2026
8adac7f
(---section: user LL infra STOP)
kv2019i Mar 27, 2026
5c30af4
(---section host-zephyr START)
kv2019i Feb 19, 2026
02e4706
zephyr: userspace: sof_dma: allow circular SG lists
kv2019i Feb 19, 2026
44eed12
zephyr: lib: dma: make DMA platform data available to user-space
kv2019i Feb 13, 2026
18748e8
audio: host-zephyr: select heap when allocating host buffers
kv2019i Feb 13, 2026
011ace6
audio: host-zephyr: rework calls to DMA driver, remove channel pointer
kv2019i Feb 16, 2026
e96c5e7
audio: host-zephyr: pass component heap to dma_sg_alloc
kv2019i Feb 16, 2026
1ec47dc
alloc.h: remove rbrelloac() and rbrealloc_align()
kv2019i Feb 16, 2026
1b437a5
audio: host-zephyr: ensure host data heap is set
kv2019i Feb 16, 2026
ade66ae
audio: host-zephyr: make component usable from user-space
kv2019i Apr 10, 2026
114f88a
(---section host-zephyr STOP)
kv2019i Feb 19, 2026
e68bd58
(---section dai-zephyr START)
kv2019i Feb 19, 2026
ca2841a
audio: buffer: replace notifier events with direct probe callbacks
kv2019i Feb 17, 2026
787d23d
audio: dai-zephyr: make memory allocations user-space compatible
kv2019i Feb 17, 2026
f48c064
lib: dai: make dai_get() and dai_put() compatible with user-space
kv2019i Feb 17, 2026
b61f3d2
audio: dai-zephyr: rework calls to DMA driver, remove channel pointer
kv2019i Feb 17, 2026
0cbbabc
audio: dai-zephyr: convert spinlock into mutex for properties
kv2019i Feb 17, 2026
b4f5bdf
audio: dai-zephyr: migrate to use dai_get_properties_copy()
kv2019i Feb 18, 2026
d0602c3
dai: zephyr: replace k_mutex with sys_mutex for DAI lock
kv2019i Apr 22, 2026
f52c0ed
(---section dai-zephyr STOP)
kv2019i Feb 19, 2026
5c78e03
(---section audio module infra START)
kv2019i Mar 3, 2026
13d0a61
audio: module_adapter: alloc from LL user heap if LL run in user
kv2019i Feb 12, 2026
86b5ec8
audio: copier: export copier endpoint ops to user-space
kv2019i Feb 26, 2026
628bd34
(---section schduler changes START)
kv2019i Mar 3, 2026
946b67f
schedule: zephyr_ll: add zephyr_ll_task_free()
kv2019i Feb 26, 2026
aed4440
schedule: zephyr_ll: add zephyr_ll_grant_access()
kv2019i Feb 26, 2026
557ed59
schedule: zephyr_ll_user: make double-mapping conditional
kv2019i Mar 4, 2026
72364c0
schedule: allocate the scheduler objects with sof_heap_alloc
kv2019i Feb 26, 2026
b7108f6
WIP: schedule: limit user-LL to core0
kv2019i Feb 26, 2026
e56d9b2
zephyr: schedule: allow user-space to access scheduler list
kv2019i Feb 26, 2026
c0b5745
zephyr: wrapper: modify platform_dai_wallclock() for user-space
kv2019i Feb 26, 2026
1686c64
schedule: add scheduler_init_context() and scheduler_free_context()
kv2019i Feb 27, 2026
a666ffc
schedule: zephyr_ll: implement scheduler_init_context()
kv2019i Feb 26, 2026
093d582
schedule: ll_schedule_domain: add domain_thread_init/free ops
kv2019i Mar 4, 2026
42ead8c
schedule: zephyr_ll: implement thread_init/free domain ops
kv2019i Mar 4, 2026
cc0fb6b
schedule: zephyr_ll: ISR check is not needed when LL in user-space
kv2019i Mar 31, 2026
e8db9ee
zephyr: userspace_helper: add new sys_user_heap_init()
kv2019i Mar 31, 2026
7d657df
(---section schduler changes END)
kv2019i Mar 3, 2026
f3a7027
(---section audio-user PRs START)
kv2019i Mar 25, 2026
ea2fd9c
schedule: zephyr_domain: use a different thread name for user LL
kv2019i Mar 24, 2026
c2c095d
WIP: audio: module_adapter: use correct heap when freeing
kv2019i Mar 20, 2026
2a8278a
coherent: disable core debug checks for user-space builds
kv2019i Mar 20, 2026
7f8dabc
audio: place component driver list in user-space accessible partition
kv2019i Mar 24, 2026
a11f7a6
audio: module_adapter: make adapter buffering user-space compatible
kv2019i Mar 24, 2026
4f88e54
audio: pipeline: use LL scheduler mutex for userspace pipeline triggers
kv2019i Feb 26, 2026
fc562f0
schedule: zephyr_ll: replace k_mutex with sys_mutex for scheduler lock
kv2019i Apr 22, 2026
d1bbfe6
audio: buffer: move dp_heap_user lifecycle to IPC and module adapter
kv2019i Feb 17, 2026
dc6d00a
audio: host-zepher: add HOST_DMA_IPC_POSITION_UPDATES Kconfig
kv2019i Mar 31, 2026
9d7663f
audio: copier_host: make FPI sync group availble to user-space
kv2019i Mar 31, 2026
b5d21f9
audio: copier: avoid IRQ lock/unlock in chmap code
kv2019i Mar 31, 2026
c5c9d99
audio: module_adapter: avoid IRQ lock/unlock in prepare()
kv2019i Mar 31, 2026
9fb382e
audio: module_adapter: make data_blob compatible with user-space
kv2019i Apr 14, 2026
85e2935
audio: module-adapter: make generic.c user-space compatible
kv2019i Apr 16, 2026
dcbf37e
audio: make comp_drivers_get() accessible from user-space
kv2019i Apr 15, 2026
5ea7484
dai: turn dai_get_device() into a syscall
kv2019i Apr 15, 2026
85a7635
audio: chain_dma: add user-space memory and scheduling support
kv2019i Apr 21, 2026
001652f
(---section audio user PRs STOP)
kv2019i Mar 25, 2026
adb4d18
(---section: IPC user support START)
kv2019i Mar 17, 2026
af720f1
userspace: split ipc files into user and kernel features. REVISIT memcpy
kv2019i Apr 1, 2026
e148d69
ipc4: helper: use LL scheduler lock for userspace builds
kv2019i Mar 26, 2026
9d306c8
WIP: ipc: implement user-space IPC handling for CREATE_PIPELINE
kv2019i Mar 12, 2026
d9dee9d
WIP: ipc: ipc4: route PIPELINE_DELETE to user-space handler
kv2019i Mar 30, 2026
2a84656
ipc: make IPC stack thread size configurable
Apr 1, 2026
8ad1f22
ipc: ipc4: use sof_heap_alloc in ipc4_add_comp_dev()
kv2019i Mar 19, 2026
237bae5
ipc: turn ipc_msg_reply() into a system call
kv2019i Mar 30, 2026
103e1c7
ipc: ipc4: use correct API to get DMA status
kv2019i Mar 19, 2026
ba8bd71
ipc: ipc4: dai: fix direct use of DMA driver calls
kv2019i Apr 16, 2026
eb266e6
ipc: use application heap for IPC pipeline and component allocations
kv2019i Mar 20, 2026
cd00090
ipc4: make fw_reg mutex available to user-space
kv2019i Apr 15, 2026
78cb3bd
ipc: ipc4: helper: make ipc4_search_for_drv() userspace compatible
kv2019i Mar 31, 2026
93e6185
WIP: schedule: add multi-core support for user-space LL scheduler
kv2019i Apr 22, 2026
ef92c30
ipc: ipc-helper: trace context not used in user-space
kv2019i Apr 13, 2026
564fe14
ipc: ipc4: use the core number from IPC config
kv2019i Apr 13, 2026
41eb699
ipc: ipc4: helper: enable limited ipc_comp_connect() in user-space
kv2019i Apr 13, 2026
b376fa8
WIP: ipc: ipc4: route MOD_CONFIG_GET/SET to user-space handler
kv2019i Apr 10, 2026
74ebf9c
WIP: ipc: ipc4: route MOD_BIND/UNBIND to user-space handler
kv2019i Apr 10, 2026
b967cf4
WIP: ipc: ipc4: route MOD_INIT_INSTANCE to user-space handler
kv2019i Apr 15, 2026
bd1e9c3
WIP: ipc: ipc4: route GLB_SET_PIPELINE_STATE to user-space handler
kv2019i Apr 16, 2026
b0b772b
WIP: ipc: ipc4: route MOD_LARGE_CONFIG_GET/SET user-space
kv2019i Apr 16, 2026
ebd7ad8
(---section: IPC user support STOP)
kv2019i Mar 27, 2026
13f3d81
(---section: START fixes for multipipeline tetss)
kv2019i Apr 30, 2026
e0d2254
sched: ll_user: add independent heap size config for LL userspace
kv2019i Apr 29, 2026
982613b
app: overlays: ptl: set CONFIG_SOF_ZEPHYR_LL_USER_HEAP_SIZE
kv2019i Apr 29, 2026
953f285
(---section: STOP fixes for multipipeline tetss)
kv2019i Apr 30, 2026
4cf9b47
(---section: START IPC user notifications)
kv2019i Apr 30, 2026
9021025
ipc: turn ipc_msg_send() into a system call if SOF_USERSPACE_LL=y
Apr 20, 2026
092de1e
ipc: make IPC message allocation userspace-safe
Apr 21, 2026
0bd5c20
(---section: STOP IPC user notifications)
kv2019i Apr 30, 2026
15aac6c
(---section test-case START)
kv2019i Feb 19, 2026
c2a7c8b
zephyr: test: userspace: add pipeline_two_components test
kv2019i Apr 22, 2026
a722b7a
(---section WIP mandatory changes START)
kv2019i Feb 19, 2026
5c2063a
audio: pipeline: enable position reporting for user-space pipelines
kv2019i Mar 17, 2026
c58cf14
WIP: ipc: expose coldrodata to IPC user thread
kv2019i Apr 16, 2026
6a36525
HACK: audio: collection of feature limitations to run LL in user
kv2019i Feb 26, 2026
a22a976
[DO NOT MERGE] zephyr.yml: use Zephyr PR107341
kv2019i Apr 22, 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
23 changes: 23 additions & 0 deletions app/overlays/ptl/ll_userspace_overlay.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CONFIG_SOF_USERSPACE_LL=y

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

# 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
24 changes: 1 addition & 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 All @@ -141,6 +118,7 @@ void *sof_heap_alloc(struct k_heap *heap, uint32_t flags, size_t bytes,
size_t alignment);
void sof_heap_free(struct k_heap *heap, void *addr);
struct k_heap *sof_sys_heap_get(void);
struct k_heap *sof_sys_user_heap_get(void);

/**
* Calculates length of the null-terminated string.
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
104 changes: 39 additions & 65 deletions src/audio/buffers/comp_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <rtos/interrupt.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <sof/lib/notifier.h>
#include <sof/list.h>
#include <sof/schedule/dp_schedule.h>
#include <rtos/spinlock.h>
Expand Down Expand Up @@ -147,28 +146,17 @@ static void comp_buffer_free(struct sof_audio_buffer *audio_buffer)

struct comp_buffer *buffer = container_of(audio_buffer, struct comp_buffer, audio_buffer);

struct buffer_cb_free cb_data = {
.buffer = buffer,
};

buf_dbg(buffer, "buffer_free()");

notifier_event(buffer, NOTIFIER_ID_BUFFER_FREE,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));

/* In case some listeners didn't unregister from buffer's callbacks */
notifier_unregister_all(NULL, buffer);
#if CONFIG_PROBE
if (buffer->probe_cb_free)
buffer->probe_cb_free(buffer->probe_cb_arg);
#endif

struct k_heap *heap = buffer->audio_buffer.heap;

rfree(buffer->stream.addr);
sof_heap_free(heap, buffer->stream.addr);
sof_heap_free(heap, buffer);
if (heap) {
struct dp_heap_user *mod_heap_user = container_of(heap, struct dp_heap_user, heap);

if (!--mod_heap_user->client_count)
rfree(mod_heap_user);
}
}

APP_TASK_DATA static const struct source_ops comp_buffer_source_ops = {
Expand Down Expand Up @@ -218,6 +206,7 @@ static struct comp_buffer *buffer_alloc_struct(struct k_heap *heap,

memset(buffer, 0, sizeof(*buffer));

buffer->heap = heap;
buffer->flags = flags;
/* Force channels to 2 for init to prevent bad call to clz in buffer_init_stream */
buffer->stream.runtime_stream_params.channels = 2;
Expand Down Expand Up @@ -254,7 +243,7 @@ struct comp_buffer *buffer_alloc(struct k_heap *heap, size_t size, uint32_t flag
return NULL;
}

stream_addr = rballoc_align(flags, size, align);
stream_addr = sof_heap_alloc(heap, flags, size, align);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commit, that is mentioned in the commit message, only moved buffer context objects to particular heaps. This commit moves actual data buffers to them too, which is different and (arguably) more risky

if (!stream_addr) {
tr_err(&buffer_tr, "could not alloc size = %zu bytes of flags = 0x%x",
size, flags);
Expand All @@ -264,9 +253,11 @@ struct comp_buffer *buffer_alloc(struct k_heap *heap, size_t size, uint32_t flag
buffer = buffer_alloc_struct(heap, stream_addr, size, flags, is_shared);
if (!buffer) {
tr_err(&buffer_tr, "could not alloc buffer structure");
rfree(stream_addr);
sof_heap_free(heap, stream_addr);
}

buffer->heap = heap;

return buffer;
}

Expand All @@ -292,7 +283,7 @@ struct comp_buffer *buffer_alloc_range(struct k_heap *heap, size_t preferred_siz
preferred_size += minimum_size - preferred_size % minimum_size;

for (size = preferred_size; size >= minimum_size; size -= minimum_size) {
stream_addr = rballoc_align(flags, size, align);
stream_addr = sof_heap_alloc(heap, flags, size, align);
if (stream_addr)
break;
}
Expand All @@ -308,9 +299,11 @@ struct comp_buffer *buffer_alloc_range(struct k_heap *heap, size_t preferred_siz
buffer = buffer_alloc_struct(heap, stream_addr, size, flags, is_shared);
if (!buffer) {
tr_err(&buffer_tr, "could not alloc buffer structure");
rfree(stream_addr);
sof_heap_free(heap, stream_addr);
}

buffer->heap = heap;

return buffer;
}

Expand Down Expand Up @@ -341,14 +334,8 @@ 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));
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(buffer->heap, buffer->flags, size, alignment);

/* 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 +344,10 @@ 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) {
sof_heap_free(buffer->heap, audio_stream_get_addr(&buffer->stream));
buffer->stream.addr = new_ptr;
}

buffer_init_stream(buffer, size);

Expand Down Expand Up @@ -389,22 +378,11 @@ 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) {
new_ptr = sof_heap_alloc(buffer->heap, buffer->flags, new_size, alignment);
if (new_ptr)
break;
}

/* we couldn't allocate bigger chunk */
Expand All @@ -415,8 +393,10 @@ 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) {
sof_heap_free(buffer->heap, audio_stream_get_addr(&buffer->stream));
buffer->stream.addr = new_ptr;
}

buffer_init_stream(buffer, new_size);

Expand Down Expand Up @@ -478,12 +458,6 @@ bool buffer_params_match(struct comp_buffer *buffer,

void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)
{
struct buffer_cb_transact cb_data = {
.buffer = buffer,
.transaction_amount = bytes,
.transaction_begin_address = audio_stream_get_wptr(&buffer->stream),
};

/* return if no bytes */
if (!bytes) {
#if CONFIG_SOF_LOG_DBG_BUFFER
Expand All @@ -499,10 +473,19 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)
return;
}

audio_stream_produce(&buffer->stream, bytes);
#if CONFIG_PROBE
if (buffer->probe_cb_produce) {
struct buffer_cb_transact cb_data = {
.buffer = buffer,
.transaction_amount = bytes,
.transaction_begin_address = audio_stream_get_wptr(&buffer->stream),
};

notifier_event(buffer, NOTIFIER_ID_BUFFER_PRODUCE,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));
buffer->probe_cb_produce(buffer->probe_cb_arg, &cb_data);
}
#endif

audio_stream_produce(&buffer->stream, bytes);

#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "((buffer->avail << 16) | buffer->free) = %08x, ((buffer->id << 16) | buffer->size) = %08x",
Expand All @@ -519,12 +502,6 @@ void comp_update_buffer_produce(struct comp_buffer *buffer, uint32_t bytes)

void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes)
{
struct buffer_cb_transact cb_data = {
.buffer = buffer,
.transaction_amount = bytes,
.transaction_begin_address = audio_stream_get_rptr(&buffer->stream),
};

CORE_CHECK_STRUCT(&buffer->audio_buffer);

/* return if no bytes */
Expand All @@ -544,9 +521,6 @@ void comp_update_buffer_consume(struct comp_buffer *buffer, uint32_t bytes)

audio_stream_consume(&buffer->stream, bytes);

notifier_event(buffer, NOTIFIER_ID_BUFFER_CONSUME,
NOTIFIER_TARGET_CORE_LOCAL, &cb_data, sizeof(cb_data));

#if CONFIG_SOF_LOG_DBG_BUFFER
buf_dbg(buffer, "(buffer->avail << 16) | buffer->free = %08x, (buffer->id << 16) | buffer->size = %08x, (buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)) = %08x",
(audio_stream_get_avail_bytes(&buffer->stream) << 16) |
Expand Down
Loading