Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions posix/include/rtos/userspace_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2026 Intel Corporation.
*/

/**
* \file posix/include/rtos/userspace_data.h
* \brief Placement of data that user-space threads must be able to access.
*
* Only the memory partition placement attributes, so that user-space code
* can use them without the kernel memory domain helpers in
* rtos/userspace_helper.h.
*/
#ifndef __POSIX_RTOS_USERSPACE_DATA_H__
#define __POSIX_RTOS_USERSPACE_DATA_H__

#define APP_TASK_BSS
#define APP_TASK_DATA
#define APP_SYSUSER_BSS
#define APP_SYSUSER_DATA

#endif /* __POSIX_RTOS_USERSPACE_DATA_H__ */
5 changes: 1 addition & 4 deletions posix/include/rtos/userspace_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

#include <rtos/alloc.h>

#define APP_TASK_BSS
#define APP_TASK_DATA
#define APP_SYSUSER_BSS
#define APP_SYSUSER_DATA
#include <rtos/userspace_data.h>

struct sys_heap;

Expand Down
3 changes: 2 additions & 1 deletion scripts/kernel_user_partition.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ src/audio/mic_privacy_manager/*
src/audio/module_adapter/library/userspace_proxy.c

# SOF headers that only kernel code may include.
# Not listed on purpose: rtos/init.h, which only provides the
# SOF_MODULE_INIT() registration hook used by every module.
[kernel-headers]
src/include/sof/drivers/*
src/include/sof/platform.h
Expand All @@ -51,7 +53,6 @@ src/include/sof/lib/watchdog.h
src/platform/*
zephyr/include/rtos/clk.h
zephyr/include/rtos/idc.h
zephyr/include/rtos/init.h
zephyr/include/rtos/interrupt.h
zephyr/include/rtos/interrupt-legacy.h
zephyr/include/rtos/timer.h
Expand Down
1 change: 1 addition & 0 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sof/platform.h>
#include <rtos/string.h>
#include <sof/ut.h>
#include <sof/lib/dai.h>
#include <ipc/control.h>
#include <ipc/stream.h>
#include <ipc/topology.h>
Expand Down
1 change: 0 additions & 1 deletion src/audio/asrc/asrc_farrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <sof/common.h>
#include <rtos/panic.h>
#include <sof/math/numbers.h>
#include <sof/platform.h>
#include <rtos/string.h>
#include <sof/trace/trace.h>
#include <sof/audio/format.h>
Expand Down
4 changes: 4 additions & 0 deletions src/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@
#include <sof_versions.h>
#include <sof/lib/cpu-clk-manager.h>
#include <sof/lib/cpu.h>
#include <sof/lib/mailbox.h>
#include <sof/platform.h>
#include <sof/lib_manager.h>
#include <rtos/clk.h>
#include <rtos/init.h>
#include <rtos/timer.h>
#include <sof/audio/module_adapter/module/generic.h>
#include <sof/schedule/dp_schedule.h>
#include <sof/schedule/ll_schedule.h>
#include <sof/debug/telemetry/performance_monitor.h>
#include <sof/debug/telemetry/telemetry.h>
#include <sof/debug/telemetry/performance_monitor.h>
#include <sof/lib/dma.h>
#include <sof/schedule/schedule.h>
/* FIXME:
* Builds for some platforms like tgl fail because their defines related to memory windows are
* already defined somewhere else. Remove this ifdef after it's cleaned up
Expand Down
1 change: 1 addition & 0 deletions src/audio/base_fw_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <zephyr/logging/log_ctrl.h>

#include <rtos/string.h>
#include <rtos/timer.h>
#include <sof/tlv.h>
#include <sof/lib/dai.h>
#include <ipc/dai.h>
Expand Down
1 change: 0 additions & 1 deletion src/audio/buffers/comp_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <sof/audio/sink_source_utils.h>
#include <rtos/userspace_helper.h>
#include <sof/common.h>
#include <rtos/interrupt.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <sof/lib/vregion.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <sof/lib/perf_cnt.h>
#include <sof/lib/uuid.h>
#include <sof/list.h>
#include <rtos/sof.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <stddef.h>
#include <stdint.h>
#include <sof/audio/module_adapter/module/generic.h>
#include <sof/lib/mailbox.h>
#include "copier.h"
#include "host_copier.h"
#include "dai_copier.h"
Expand Down
1 change: 1 addition & 0 deletions src/audio/copier/copier_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <sof/tlv.h>
#include <sof/trace/trace.h>
#include <sof/audio/module_adapter/module/generic.h>
#include <sof/lib/mailbox.h>
#include <rtos/userspace_helper.h>
#include "copier.h"
#include "host_copier.h"
Expand Down
2 changes: 1 addition & 1 deletion src/audio/copier/copier_ipcgtw.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <sof/trace/trace.h>
#include <sof/lib/memory.h>
#include <sof/ut.h>
#include <rtos/init.h>
#include <sof/lib/mailbox.h>
#include "copier.h"
#include "ipcgtw_copier.h"

Expand Down
1 change: 1 addition & 0 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Keyon Jie <yang.jie@linux.intel.com>

#include <sof/audio/buffer.h>
#include <sof/audio/audio_stream_hw.h>
#include <sof/audio/component_ext.h>
#include <sof/audio/format.h>
#include <sof/audio/pipeline.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/data_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <ipc/control.h>
#include <sof/audio/component.h>
#include <sof/audio/data_blob.h>
#include <sof/lib/mailbox.h>

LOG_MODULE_REGISTER(data_blob, CONFIG_SOF_LOG_LEVEL);

Expand Down
1 change: 1 addition & 0 deletions src/audio/host-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Keyon Jie <yang.jie@linux.intel.com>

#include <sof/audio/buffer.h>
#include <sof/audio/audio_stream_hw.h>
#include <sof/audio/component_ext.h>
#include <sof/audio/pcm_converter.h>
#include <sof/audio/pipeline.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/module_adapter/library/userspace_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <sof/llext_manager.h>
#include <sof/audio/component.h>
#include <sof/schedule/dp_schedule.h>
#include <sof/lib/mailbox.h>
#include <rtos/userspace_helper.h>
#include <utilities/array.h>
#include <zephyr/sys/sem.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/module_adapter/module/dolby/dax.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Author: Jun Lai <jun.lai@dolby.com>
*/

#include <rtos/atomic.h>
#include <rtos/spinlock.h>
#include <sof/audio/module_adapter/module/generic.h>
#include <dax_inf.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/module_adapter/module/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sof/lib/fast-get.h>
#include <sof/lib/vregion.h>
#include <sof/schedule/dp_schedule.h>
#include <sof/schedule/schedule.h>
#if CONFIG_IPC_MAJOR_4
#include <ipc4/header.h>
#include <ipc4/module.h>
Expand Down
2 changes: 1 addition & 1 deletion src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#include <sof/common.h>
#include <sof/platform.h>
#include <sof/ut.h>
#include <sof/schedule/schedule.h>
#if CONFIG_IPC_MAJOR_4
#include <ipc4/base_fw.h>
#include <ipc4/header.h>
#include <ipc4/module.h>
#endif
#include <rtos/interrupt.h>
#include <rtos/kernel.h>
#include <limits.h>
#include <stdint.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/pipeline/pipeline-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sof/lib/uuid.h>
#include <sof/compiler_attributes.h>
#include <sof/list.h>
#include <sof/lib/mailbox.h>
#include <rtos/spinlock.h>
#include <rtos/string.h>
#include <rtos/clk.h>
Expand Down
1 change: 0 additions & 1 deletion src/audio/pipeline/pipeline-params.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <sof/audio/buffer.h>
#include <sof/audio/component_ext.h>
#include <sof/audio/pipeline.h>
#include <sof/lib/mm_heap.h>
#include <sof/compiler_attributes.h>
#include <sof/list.h>
#include <rtos/spinlock.h>
Expand Down
2 changes: 2 additions & 0 deletions src/audio/pipeline/pipeline-xrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
#include <sof/audio/pipeline.h>
#include <sof/ipc/msg.h>
#include <sof/list.h>
#include <sof/lib/mailbox.h>
#include <rtos/spinlock.h>
#include <rtos/string.h>
#include <rtos/timer.h>
#include <ipc/header.h>
#include <ipc/stream.h>
#include <ipc/topology.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/volume/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <rtos/bit.h>
#include <sof/common.h>
#include <sof/trace/trace.h>
#include <sof/lib/mailbox.h>
#include <ipc/stream.h>
#include <user/trace.h>
#include <stddef.h>
Expand Down
1 change: 1 addition & 0 deletions src/drivers/amd/rembrandt/acp_hs_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <platform/fw_scratch_mem.h>
#include <sof/lib/io.h>
#include <platform/chip_offset_byte.h>
#include <platform/chip_registers.h>

SOF_DEFINE_REG_UUID(hsdai);
/* unused with Zephyr, generates no output */
Expand Down
30 changes: 0 additions & 30 deletions src/include/sof/audio/audio_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <sof/compiler_attributes.h>
#include <rtos/panic.h>
#include <sof/math/numbers.h>
#include <sof/lib/dma.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <ipc/stream.h>
Expand Down Expand Up @@ -695,35 +694,6 @@ static inline void audio_stream_consume(struct audio_stream *buffer, uint32_t by
buffer->free = buffer->size - buffer->avail;
}

#ifdef __ZEPHYR__
/**
* Replicates the hardware state of the DMA buffer as a struct audio_stream.
* @param stream Stream to update.
* @param dma_status DMA buffer hardware state (struct dma_status from Zephyr).
*/
static inline void audio_stream_sync_to_hw(struct audio_stream *stream,
const struct dma_status *dma_status)
{
uintptr_t buf_start = (uintptr_t)audio_stream_get_addr(stream);

/* Note: It is assumed here that dma_status values are reported as bytes. However,
* this is actually platform-specific. Although unlikely, they could be, for example,
* words on some particular platform, and changes should be made here to address
* such case.
*/

assert(dma_status->write_position < audio_stream_get_size(stream));
assert(dma_status->read_position < audio_stream_get_size(stream));
assert(dma_status->pending_length <= audio_stream_get_size(stream));
assert(dma_status->free <= audio_stream_get_size(stream));

audio_stream_set_wptr(stream, (void *)(buf_start + dma_status->write_position));
audio_stream_set_rptr(stream, (void *)(buf_start + dma_status->read_position));
audio_stream_set_avail(stream, dma_status->pending_length);
audio_stream_set_free(stream, dma_status->free);
}
#endif /* __ZEPHYR__ */

/**
* Resets the buffer.
* @param buffer Buffer to reset.
Expand Down
54 changes: 54 additions & 0 deletions src/include/sof/audio/audio_stream_hw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2020 - 2023 Intel Corporation. All rights reserved.
*/

/**
* \file include/sof/audio/audio_stream_hw.h
* \brief Synchronisation of an audio stream with the state of its DMA buffer
*
* Kept separate from sof/audio/audio_stream.h because it needs the Zephyr
* DMA driver definitions, which most users of the audio stream API do not.
* Only available in Zephyr builds.
*/

#ifndef __SOF_AUDIO_AUDIO_STREAM_HW_H__
#define __SOF_AUDIO_AUDIO_STREAM_HW_H__

#include <sof/audio/audio_stream.h>
#include <stdint.h>
Comment thread
lgirdwood marked this conversation as resolved.

#ifdef __ZEPHYR__

#include <zephyr/drivers/dma.h>

/**
* Replicates the hardware state of the DMA buffer as a struct audio_stream.
* @param stream Stream to update.
* @param dma_status DMA buffer hardware state (struct dma_status from Zephyr).
*/
static inline void audio_stream_sync_to_hw(struct audio_stream *stream,
const struct dma_status *dma_status)
{
uintptr_t buf_start = (uintptr_t)audio_stream_get_addr(stream);

/* Note: It is assumed here that dma_status values are reported as bytes. However,
* this is actually platform-specific. Although unlikely, they could be, for example,
* words on some particular platform, and changes should be made here to address
* such case.
*/

assert(dma_status->write_position < audio_stream_get_size(stream));
assert(dma_status->read_position < audio_stream_get_size(stream));
assert(dma_status->pending_length <= audio_stream_get_size(stream));
assert(dma_status->free <= audio_stream_get_size(stream));

audio_stream_set_wptr(stream, (void *)(buf_start + dma_status->write_position));
audio_stream_set_rptr(stream, (void *)(buf_start + dma_status->read_position));
audio_stream_set_avail(stream, dma_status->pending_length);
audio_stream_set_free(stream, dma_status->free);
}

#endif /* __ZEPHYR__ */

#endif /* __SOF_AUDIO_AUDIO_STREAM_HW_H__ */
7 changes: 3 additions & 4 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
#include <sof/audio/format.h>
#include <sof/audio/pipeline.h>
#include <sof/debug/telemetry/telemetry.h>
#include <rtos/idc.h>
#include <rtos/mutex.h>
#include <rtos/userspace_helper.h>
#include <sof/lib/dai.h>
#include <rtos/userspace_data.h>
Comment thread
lgirdwood marked this conversation as resolved.
#include <sof/lib/uuid.h>
#include <sof/schedule/schedule.h>
#include <ipc/control.h>
#include <sof/ipc/topology.h>
#include <kernel/abi.h>
Expand All @@ -37,6 +34,8 @@ struct sof_ipc_stream_posn;
struct dai_hw_params;
struct timestamp_data;
struct dai_ts_data;
struct dai_data;
struct task;

/** \addtogroup component_infra_api
* @{
Expand Down
4 changes: 4 additions & 0 deletions src/include/sof/audio/component_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#include <sof/audio/component.h>
#include <ipc/topology.h>
/* TODO: the cross-core helpers below send IDC messages, which is kernel only */
#include <rtos/idc.h>
#include <sof/lib/dai.h>
#include <sof/schedule/schedule.h>

/** \addtogroup component_infra_api
* @{
Expand Down
1 change: 0 additions & 1 deletion src/include/sof/audio/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#define __SOF_AUDIO_PIPELINE_H__

#include <sof/lib/cpu.h>
#include <sof/lib/mailbox.h>
#include <sof/list.h>
#include <rtos/task.h>
#include <rtos/sof.h>
Expand Down
2 changes: 0 additions & 2 deletions src/include/sof/ipc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#include <sof/audio/ipc-config.h>
#include <sof/audio/pipeline.h>
#include <rtos/alloc.h>
#include <sof/lib/memory.h>
#include <sof/list.h>
#include <sof/platform.h>
#include <rtos/task.h>
#include <rtos/sof.h>
#include <rtos/spinlock.h>
Expand Down
Loading
Loading