Skip to content
Draft
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
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ src/audio/google/* @thesofproject/google

# platforms
src/kernel/platform/imx8/** @dbaluta
src/platform/imx8/** @dbaluta
src/kernel/platform/amd/** @bhiregoudar @sunilkumardommati
src/kernel/platform/mtk/** @yaochunhung @kuanhsuncheng

Expand Down
28 changes: 8 additions & 20 deletions scripts/kernel_user_partition.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ src/audio/host-legacy.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.
# SOF_MODULE_INIT() registration hook used by every module, and
# sof/lib/mailbox.h: the mailbox windows are mapped into the user-space
# LL and IPC threads, and their layout is in the user-space platform
# headers in src/platform.
[kernel-headers]
src/include/sof/drivers/*
src/include/sof/platform.h
src/include/sof/llext_manager.h
src/include/sof/ipc/driver.h
src/include/sof/lib/agent.h
src/include/sof/lib/cpu-clk-manager.h
src/include/sof/lib/mailbox.h
src/include/sof/lib/perf_cnt.h
src/include/sof/lib/watchdog.h
src/kernel/platform/*
Expand All @@ -55,52 +57,38 @@ zephyr/include/sof/lib/vpage.h

# Zephyr headers that only kernel code may include: kernel internals and
# driver APIs that are not system calls.
# Not listed on purpose: zephyr/drivers/dma.h. Its types and constants are
# the arguments of the sof_dma_*() system calls in sof/lib/sof_dma.h, so
# user-space code needs them. User-space code must not call its dma_*()
# driver functions directly, which this include check cannot catch.
[zephyr-kernel-headers]
kernel/include/*
include/zephyr/drivers/dma.h
include/zephyr/pm/device_runtime.h

# User-space sources that still include kernel-only headers, removed one
# by one by the partition work (#11306). With --strict, a leak in any
# other user-space source is an error, so this list must only shrink.
# It covers the CI build configurations and the user-space overlays.
[leak-baseline]
src/audio/asrc/asrc.c
src/audio/chain_dma.c
src/audio/component.c
src/audio/copier/copier.c
src/audio/copier/copier_dai.c
src/audio/copier/copier_gain.c
src/audio/copier/copier_host.c
src/audio/copier/copier_ipcgtw.c
src/audio/dai-zephyr.c
src/audio/data_blob.c
src/audio/host-zephyr.c
src/audio/intel_uaol.c
src/audio/kpb.c
src/audio/module_adapter/iadk/kpb_service.cpp
src/audio/module_adapter/iadk/system_agent.cpp
src/audio/module_adapter/iadk/timestamping_service_provider.cpp
src/audio/module_adapter/library/native_system_service.c
src/audio/module_adapter/module_adapter_ipc4.c
src/audio/pipeline/pipeline-graph.c
src/audio/pipeline/pipeline-schedule.c
src/audio/pipeline/pipeline-stream.c
src/audio/pipeline/pipeline-xrun.c
src/audio/volume/volume.c
src/audio/volume/volume_ipc4.c
src/debug/tester/tester_simple_dram_test.c
src/ipc/ipc-common.c
src/ipc/ipc-helper.c
src/ipc/ipc4/dai.c
src/ipc/ipc4/handler-user.c
src/ipc/ipc4/helper.c
src/lib/dai.c
src/lib/dma.c
src/lib/notifier.c
src/samples/audio/detect_test.c
src/schedule/zephyr_domain.c
src/schedule/zephyr_dp_schedule.c
src/schedule/zephyr_dp_schedule_application.c
src/schedule/zephyr_dp_schedule_thread.c
src/schedule/zephyr_ll.c
1 change: 1 addition & 0 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <sof/lib/notifier.h>
#include <sof/lib/uuid.h>
#include <sof/lib/dma.h>
#include <sof/lib/memory.h>
#include <sof/list.h>
#include <rtos/spinlock.h>
#include <rtos/string.h>
Expand Down
1 change: 0 additions & 1 deletion src/include/sof/lib/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <platform/lib/mailbox.h>
#include <rtos/panic.h>
#include <rtos/cache.h>
#include <sof/lib/memory.h>
#include <rtos/string.h>
#include <stddef.h>
#include <stdint.h>
Expand Down
3 changes: 3 additions & 0 deletions src/include/sof/schedule/ll_schedule_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
#include <rtos/panic.h>
#include <rtos/alloc.h>
#include <sof/lib/cpu.h>
#ifndef __ZEPHYR__
/* for clock_ms_to_ticks() in domain_init() */
#include <rtos/clk.h>
#endif
#include <sof/schedule/ll_schedule.h>
#include <rtos/sof.h>
#include <rtos/spinlock.h>
Expand Down
1 change: 1 addition & 0 deletions src/kernel/arch/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# includes
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/kernel/arch/host/include)
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/kernel/platform/library/include)
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/platform/library/include)
include(CheckCCompilerFlag)

if (NOT CONFIG_SOF_ZEPHYR_STRICT_HEADERS)
Expand Down
1 change: 1 addition & 0 deletions src/kernel/audio/base_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <sof/lib/cpu-clk-manager.h>
#include <sof/lib/cpu.h>
#include <sof/lib/mailbox.h>
#include <sof/lib/memory.h>
#include <sof/platform.h>
#include <sof/lib_manager.h>
#include <rtos/clk.h>
Expand Down
1 change: 1 addition & 0 deletions src/kernel/audio/base_fw_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <sof/lib/memory.h>
#include <sof/lib_manager.h>
#include <sof/platform.h>

#include <ipc4/base_fw.h>
#include <ipc4/alh.h>
Expand Down
1 change: 1 addition & 0 deletions src/kernel/ipc/ipc3/host-page-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <sof/ipc/driver.h>
#include <rtos/alloc.h>
#include <sof/lib/dma.h>
#include <sof/lib/memory.h>
#include <sof/platform.h>
#include <ipc/stream.h>
#include <ipc/topology.h>
Expand Down
5 changes: 3 additions & 2 deletions src/kernel/platform/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Platform Support (`src/kernel/platform`)

> **Runs in:** Kernel-only — platform bring-up, memory maps, interrupt wiring and IPC mailbox
> windows are supervisor-context concerns and never run in a user thread. See
> **Runs in:** Kernel-only — platform bring-up, memory maps and interrupt wiring are
> supervisor-context concerns and never run in a user thread. The mailbox headers, which
> user-space code uses, are in [`src/platform`](../../platform/README.md). See
> [User/kernel split](../../include/sof/userspace/README.md).

This directory contains SoC/platform-specific integration (e.g. Intel ACE, MediaTek, i.MX),
Expand Down
24 changes: 1 addition & 23 deletions src/kernel/platform/ace30/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,7 @@
#include <mem_window.h>
#include <sof/lib/cpu.h>

/* HP SRAM windows */
#define WIN_BASE(n) DT_REG_ADDR(DT_PHANDLE(MEM_WINDOW_NODE(n), memory))

/* window 0 */
#define SRAM_SW_REG_BASE ((uint32_t)(WIN_BASE(0) + WIN0_OFFSET))
#define SRAM_SW_REG_SIZE 0x1000

#define SRAM_OUTBOX_BASE (SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE)
#define SRAM_OUTBOX_SIZE 0x1000

/* window 1 */
#define SRAM_INBOX_BASE ((uint32_t)(WIN_BASE(1) + WIN1_OFFSET))
#define SRAM_INBOX_SIZE ((uint32_t)WIN_SIZE(1))

/* window 2 */
#define SRAM_DEBUG_BASE ((uint32_t)(WIN_BASE(2) + WIN2_OFFSET))
#define SRAM_DEBUG_SIZE 0x800

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#include <platform/lib/mailbox_layout.h>

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
Expand Down
26 changes: 1 addition & 25 deletions src/kernel/platform/imx8/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#define SDRAM0_BASE 0x92400000
#define SDRAM0_SIZE 0x800000

#define SDRAM1_BASE 0x92C00000
#define SDRAM1_SIZE 0x800000

#define XSHAL_MU13_SIDEB_BYPASS_PADDR 0x5D310000
Expand Down Expand Up @@ -72,30 +71,7 @@
* +---------------------+----------------+-----------------------------------+
*/

/* Mailbox configuration */
#define SRAM_OUTBOX_BASE SDRAM1_BASE
#define SRAM_OUTBOX_SIZE 0x1000
#define SRAM_OUTBOX_OFFSET 0

#define SRAM_INBOX_BASE (SRAM_OUTBOX_BASE + SRAM_OUTBOX_SIZE)
#define SRAM_INBOX_SIZE 0x1000
#define SRAM_INBOX_OFFSET SRAM_OUTBOX_SIZE

#define SRAM_DEBUG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE)
#define SRAM_DEBUG_SIZE 0x800
#define SRAM_DEBUG_OFFSET (SRAM_INBOX_OFFSET + SRAM_INBOX_SIZE)

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800
#define SRAM_EXCEPT_OFFSET (SRAM_DEBUG_OFFSET + SRAM_DEBUG_SIZE)

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#define SRAM_STREAM_OFFSET (SRAM_EXCEPT_OFFSET + SRAM_EXCEPT_SIZE)

#define SRAM_TRACE_BASE (SRAM_STREAM_BASE + SRAM_STREAM_SIZE)
#define SRAM_TRACE_SIZE 0x1000
#define SRAM_TRACE_OFFSET (SRAM_STREAM_OFFSET + SRAM_STREAM_SIZE)
#include <platform/lib/mailbox_layout.h>

#define SOF_MAILBOX_SIZE (SRAM_INBOX_SIZE + SRAM_OUTBOX_SIZE \
+ SRAM_DEBUG_SIZE + SRAM_EXCEPT_SIZE \
Expand Down
26 changes: 1 addition & 25 deletions src/kernel/platform/imx8m/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#define SDRAM0_BASE 0x92400000
#define SDRAM0_SIZE 0x800000

#define SDRAM1_BASE 0x92C00000
#define SDRAM1_SIZE 0x800000

#define XSHAL_MU2_SIDEB_BYPASS_PADDR 0x30E70000
Expand Down Expand Up @@ -90,30 +89,7 @@
* +---------------------+----------------+-----------------------------------+
*/

/* Mailbox configuration */
#define SRAM_OUTBOX_BASE SDRAM1_BASE
#define SRAM_OUTBOX_SIZE 0x1000
#define SRAM_OUTBOX_OFFSET 0

#define SRAM_INBOX_BASE (SRAM_OUTBOX_BASE + SRAM_OUTBOX_SIZE)
#define SRAM_INBOX_SIZE 0x1000
#define SRAM_INBOX_OFFSET SRAM_OUTBOX_SIZE

#define SRAM_DEBUG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE)
#define SRAM_DEBUG_SIZE 0x800
#define SRAM_DEBUG_OFFSET (SRAM_INBOX_OFFSET + SRAM_INBOX_SIZE)

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800
#define SRAM_EXCEPT_OFFSET (SRAM_DEBUG_OFFSET + SRAM_DEBUG_SIZE)

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#define SRAM_STREAM_OFFSET (SRAM_EXCEPT_OFFSET + SRAM_EXCEPT_SIZE)

#define SRAM_TRACE_BASE (SRAM_STREAM_BASE + SRAM_STREAM_SIZE)
#define SRAM_TRACE_SIZE 0x1000
#define SRAM_TRACE_OFFSET (SRAM_STREAM_OFFSET + SRAM_STREAM_SIZE)
#include <platform/lib/mailbox_layout.h>

#define SOF_MAILBOX_SIZE (SRAM_INBOX_SIZE + SRAM_OUTBOX_SIZE \
+ SRAM_DEBUG_SIZE + SRAM_EXCEPT_SIZE \
Expand Down
26 changes: 1 addition & 25 deletions src/kernel/platform/imx8ulp/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#define SDRAM0_BASE 0x1a000000
#define SDRAM0_SIZE 0x800000

#define SDRAM1_BASE 0x1a800000
#define SDRAM1_SIZE 0x800000

/* physical address in Arm side */
Expand Down Expand Up @@ -74,30 +73,7 @@
* +---------------------+----------------+-----------------------------------+
*/

/* Mailbox configuration */
#define SRAM_OUTBOX_BASE SDRAM1_BASE
#define SRAM_OUTBOX_SIZE 0x1000
#define SRAM_OUTBOX_OFFSET 0

#define SRAM_INBOX_BASE (SRAM_OUTBOX_BASE + SRAM_OUTBOX_SIZE)
#define SRAM_INBOX_SIZE 0x1000
#define SRAM_INBOX_OFFSET SRAM_OUTBOX_SIZE

#define SRAM_DEBUG_BASE (SRAM_INBOX_BASE + SRAM_INBOX_SIZE)
#define SRAM_DEBUG_SIZE 0x2800
#define SRAM_DEBUG_OFFSET (SRAM_INBOX_OFFSET + SRAM_INBOX_SIZE)

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800
#define SRAM_EXCEPT_OFFSET (SRAM_DEBUG_OFFSET + SRAM_DEBUG_SIZE)

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#define SRAM_STREAM_OFFSET (SRAM_EXCEPT_OFFSET + SRAM_EXCEPT_SIZE)

#define SRAM_TRACE_BASE (SRAM_STREAM_BASE + SRAM_STREAM_SIZE)
#define SRAM_TRACE_SIZE 0x1000
#define SRAM_TRACE_OFFSET (SRAM_STREAM_OFFSET + SRAM_STREAM_SIZE)
#include <platform/lib/mailbox_layout.h>

#define SOF_MAILBOX_SIZE (SRAM_INBOX_SIZE + SRAM_OUTBOX_SIZE \
+ SRAM_DEBUG_SIZE + SRAM_EXCEPT_SIZE \
Expand Down
4 changes: 1 addition & 3 deletions src/kernel/platform/library/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ struct sof;

#define SOF_STACK_SIZE (CONFIG_SOF_STACK_SIZE)

uint8_t *get_library_mailbox(void);

#define MAILBOX_BASE get_library_mailbox()
#include <platform/lib/mailbox_layout.h>

#define PLATFORM_HEAP_SYSTEM 2
#define PLATFORM_HEAP_SYSTEM_RUNTIME CONFIG_CORE_COUNT
Expand Down
24 changes: 1 addition & 23 deletions src/kernel/platform/lunarlake/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,7 @@
#include <mem_window.h>
#include <sof/lib/cpu.h>

/* HP SRAM windows */
#define WIN_BASE(n) DT_REG_ADDR(DT_PHANDLE(MEM_WINDOW_NODE(n), memory))

/* window 0 */
#define SRAM_SW_REG_BASE ((uint32_t)(WIN_BASE(0) + WIN0_OFFSET))
#define SRAM_SW_REG_SIZE 0x1000

#define SRAM_OUTBOX_BASE (SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE)
#define SRAM_OUTBOX_SIZE 0x1000

/* window 1 */
#define SRAM_INBOX_BASE ((uint32_t)(WIN_BASE(1) + WIN1_OFFSET))
#define SRAM_INBOX_SIZE ((uint32_t)WIN_SIZE(1))

/* window 2 */
#define SRAM_DEBUG_BASE ((uint32_t)(WIN_BASE(2) + WIN2_OFFSET))
#define SRAM_DEBUG_SIZE 0x800

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#include <platform/lib/mailbox_layout.h>

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
Expand Down
24 changes: 1 addition & 23 deletions src/kernel/platform/meteorlake/include/platform/lib/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,7 @@
#include <mem_window.h>
#include <sof/lib/cpu.h>

/* HP SRAM windows */
#define WIN_BASE(n) DT_REG_ADDR(DT_PHANDLE(MEM_WINDOW_NODE(n), memory))

/* window 0 */
#define SRAM_SW_REG_BASE ((uint32_t)(WIN_BASE(0) + WIN0_OFFSET))
#define SRAM_SW_REG_SIZE 0x1000

#define SRAM_OUTBOX_BASE (SRAM_SW_REG_BASE + SRAM_SW_REG_SIZE)
#define SRAM_OUTBOX_SIZE 0x1000

/* window 1 */
#define SRAM_INBOX_BASE ((uint32_t)(WIN_BASE(1) + WIN1_OFFSET))
#define SRAM_INBOX_SIZE ((uint32_t)WIN_SIZE(1))

/* window 2 */
#define SRAM_DEBUG_BASE ((uint32_t)(WIN_BASE(2) + WIN2_OFFSET))
#define SRAM_DEBUG_SIZE 0x800

#define SRAM_EXCEPT_BASE (SRAM_DEBUG_BASE + SRAM_DEBUG_SIZE)
#define SRAM_EXCEPT_SIZE 0x800

#define SRAM_STREAM_BASE (SRAM_EXCEPT_BASE + SRAM_EXCEPT_SIZE)
#define SRAM_STREAM_SIZE 0x1000
#include <platform/lib/mailbox_layout.h>

/* Stack configuration */
#define SOF_STACK_SIZE 0x1000
Expand Down
Loading
Loading