diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index e236a2b659e6..d13985b5fa3f 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -15,7 +15,7 @@ The SOF firmware is built with a modular, layered architecture to support multip ### 2.1 OS Abstraction and RTOS * **Zephyr RTOS:** Modern SOF extensively leverages the Zephyr RTOS for core operating system services, including thread scheduling, synchronization, logging, and hardware abstraction. -* **XTOS / Bare-metal (Legacy):** Older platforms or specific stripped-down environments might use XTOS or bare-metal abstractions. +* **Host builds:** The host library, testbench and unit tests run on the host, with POSIX replacements for the RTOS headers (`posix/include`). ### 2.2 Inter-Process Communication (IPC) The IPC subsystem is responsible for all communication between the Host OS and the DSP Firmware. diff --git a/posix/include/rtos/bit.h b/posix/include/rtos/bit.h index 3dde908c2d6b..dd287d80ec68 100644 --- a/posix/include/rtos/bit.h +++ b/posix/include/rtos/bit.h @@ -5,8 +5,8 @@ * Author: Liam Girdwood */ -#ifndef __XTOS_RTOS_BIT_H__ -#define __XTOS_RTOS_BIT_H__ +#ifndef __POSIX_RTOS_BIT_H__ +#define __POSIX_RTOS_BIT_H__ #if ASSEMBLY #define BIT(b) (1 << (b)) @@ -24,4 +24,4 @@ #define GET_BITS(b_hi, b_lo, x) \ (((x) & MASK(b_hi, b_lo)) >> (b_lo)) -#endif /* __XTOS_RTOS_BIT_H__ */ +#endif /* __POSIX_RTOS_BIT_H__ */ diff --git a/posix/include/rtos/kernel.h b/posix/include/rtos/kernel.h index 9fa3962a3589..37c0e0989c37 100644 --- a/posix/include/rtos/kernel.h +++ b/posix/include/rtos/kernel.h @@ -14,7 +14,7 @@ #include #ifdef __ZEPHYR__ -#error "This file should only be included in XTOS builds." +#error "This file should only be included in host builds." #endif typedef uint32_t k_ticks_t; diff --git a/posix/include/rtos/panic.h b/posix/include/rtos/panic.h index 4ae6a716a05c..e4aca1661f56 100644 --- a/posix/include/rtos/panic.h +++ b/posix/include/rtos/panic.h @@ -13,7 +13,7 @@ #include #ifdef __ZEPHYR__ -#error "This file should only be included in XTOS builds." +#error "This file should only be included in host builds." #endif /* __ZEPHYR__ */ #ifdef __clang_analyzer__ diff --git a/posix/include/sof/lib/io.h b/posix/include/sof/lib/io.h index 07f1e5aa1fbe..fabce74bfd02 100644 --- a/posix/include/sof/lib/io.h +++ b/posix/include/sof/lib/io.h @@ -5,8 +5,8 @@ * Author: Liam Girdwood */ -#ifndef __XTOS_POSIX_LIB_IO_H__ -#define __XTOS_POSIX_LIB_IO_H__ +#ifndef __POSIX_SOF_LIB_IO_H__ +#define __POSIX_SOF_LIB_IO_H__ #include @@ -85,4 +85,4 @@ static inline void io_reg_update_bits8(uint32_t reg, uint8_t mask, #endif -#endif /* __XTOS_POSIX_LIB_IO_H__ */ +#endif /* __POSIX_SOF_LIB_IO_H__ */ diff --git a/scripts/set_xtensa_params.sh b/scripts/set_xtensa_params.sh index a3932818edc1..a853c6c813f1 100644 --- a/scripts/set_xtensa_params.sh +++ b/scripts/set_xtensa_params.sh @@ -162,7 +162,7 @@ case "$platform" in ;; esac -# Pre-zephyr "XTOS" build, testbench,... +# Testbench build (rebuild-testbench.sh) case "$platform" in mtl|lnl|ptl|acp_7_0|mt8196|nvl) SOF_CC_BASE='clang';; diff --git a/src/audio/google/google_rtc_audio_processing.c b/src/audio/google/google_rtc_audio_processing.c index 8e372f492bf0..28e36f3eb430 100644 --- a/src/audio/google/google_rtc_audio_processing.c +++ b/src/audio/google/google_rtc_audio_processing.c @@ -35,7 +35,7 @@ /* Zephyr provides uncached memory for static variables on SMP, but we * are single-core component and know we can safely use the cache for - * AEC work. XTOS SOF is cached by default, so stub the Zephyr API. + * AEC work. Host builds have no Zephyr cache API, so stub it. */ #ifdef __ZEPHYR__ #include diff --git a/src/include/README.md b/src/include/README.md index 4332b684d619..2f4a7e32ad2a 100644 --- a/src/include/README.md +++ b/src/include/README.md @@ -1,6 +1,6 @@ ** SOF Header Layout ** -Today SOF is somewhat coupled with xtensa xtos/HAL and it's own SOF RTOS logic. +SOF used to be coupled with the Xtensa XTOS/HAL and its own SOF RTOS logic. This coupling is reflected in the headers where we have a mix of RTOS and common headers at the top level ```src/include``` directory. diff --git a/src/include/sof/lib/uuid.h b/src/include/sof/lib/uuid.h index 2d8ca2ca82f4..0a6dd585708e 100644 --- a/src/include/sof/lib/uuid.h +++ b/src/include/sof/lib/uuid.h @@ -94,9 +94,9 @@ struct sof_uuid_entry { __attribute__((alias("_" #uuid_name))) uuid_name #else -/* XTOS SOF emits two definitions, one into the runtime (which may not - * be linked if unreferenced) and a separate one that goes into a - * special section via handling in the linker script. +/* Host builds emit two definitions, one into the runtime (which may not + * be linked if unreferenced) and a separate one in the .static_uuids + * section. */ #define _UUID(uuid_name) (&(uuid_name ## _ldc)) #define _RT_UUID(uuid_name) (&(uuid_name)) diff --git a/src/ipc/CMakeLists.txt b/src/ipc/CMakeLists.txt index 3608369cda7d..46c620b0bb37 100644 --- a/src/ipc/CMakeLists.txt +++ b/src/ipc/CMakeLists.txt @@ -4,7 +4,7 @@ if (CONFIG_IPC_MAJOR_4) add_subdirectory(ipc4) endif() -# Common to Zephyr and XTOS +# Common to the Zephyr and host builds add_local_sources(sof ipc-common.c ipc-helper.c diff --git a/src/ipc/ipc4/CMakeLists.txt b/src/ipc/ipc4/CMakeLists.txt index cd7984becd40..60c66a8bb4e0 100644 --- a/src/ipc/ipc4/CMakeLists.txt +++ b/src/ipc/ipc4/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -# Files common to Zephyr and XTOS +# Files common to the Zephyr and host builds add_local_sources(sof handler-user.c helper.c diff --git a/src/kernel/arch/host/include/arch/drivers/idc.h b/src/kernel/arch/host/include/arch/drivers/idc.h index 3f3e67b89d76..7a81509d99c1 100644 --- a/src/kernel/arch/host/include/arch/drivers/idc.h +++ b/src/kernel/arch/host/include/arch/drivers/idc.h @@ -14,6 +14,6 @@ #else -#error "This file shouldn't be included from outside of XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of the host rtos/idc.h" #endif /* __POSIX_RTOS_IDC_H__ */ diff --git a/src/kernel/arch/host/include/arch/schedule/task.h b/src/kernel/arch/host/include/arch/schedule/task.h index 2b89d264e0a6..b5b646e22882 100644 --- a/src/kernel/arch/host/include/arch/schedule/task.h +++ b/src/kernel/arch/host/include/arch/schedule/task.h @@ -20,6 +20,6 @@ #else -#error "This file shouldn't be included from outside of XTOS's posix/task.h" +#error "This file shouldn't be included from outside of the host rtos/task.h" #endif /* __POSIX_RTOS_TASK_H__ */ diff --git a/src/kernel/arch/host/include/arch/sof.h b/src/kernel/arch/host/include/arch/sof.h deleted file mode 100644 index 9b4d7a1da993..000000000000 --- a/src/kernel/arch/host/include/arch/sof.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2016 Intel Corporation. All rights reserved. - * - * Author: Liam Girdwood - */ - -#ifdef __XTOS_RTOS_SOF_H__ - -#ifndef __ARCH_SOF_H__ -#define __ARCH_SOF_H__ - -#endif /* __ARCH_SOF_H__ */ - -#else - -#error "This file shouldn't be included from outside of XTOS's rtos/sof.h" - -#endif /* __XTOS_RTOS_SOF_H__ */ diff --git a/src/kernel/arch/host/lib/ams.c b/src/kernel/arch/host/lib/ams.c deleted file mode 100644 index 946611d26fa1..000000000000 --- a/src/kernel/arch/host/lib/ams.c +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// -// Copyright(c) 2023 Intel Corporation. All rights reserved. -// -// Author: Krzysztof Frydryk - -/** - * \file - * \brief Xtensa Asynchronous Messaging Service implementation file - * \authors Krzysztof Frydryk - */ - -#include -#include -#include - -static struct async_message_service *host_ams; - -struct async_message_service **arch_ams_get(void) -{ - return &host_ams; -} diff --git a/src/kernel/ipc/ipc-common-kernel.c b/src/kernel/ipc/ipc-common-kernel.c index 8b180c6a1aff..77c167d5984c 100644 --- a/src/kernel/ipc/ipc-common-kernel.c +++ b/src/kernel/ipc/ipc-common-kernel.c @@ -174,10 +174,6 @@ struct k_work_q *ipc_send_wq_get(void) static void schedule_ipc_worker(void) { - /* - * note: in XTOS builds, this is handled in - * task_main_primary_core() - */ #if defined(__ZEPHYR__) && !CONFIG_SOF_BOOT_TEST_STANDALONE /* with SOF_BOOT_TEST_STANDALONE, ipc_init() does not set up the work queue */ k_work_schedule_for_queue(&ipc_send_wq, &ipc_send_work, K_USEC(IPC_PERIOD_USEC)); diff --git a/src/kernel/ipc/ipc3/CMakeLists.txt b/src/kernel/ipc/ipc3/CMakeLists.txt index 02a2d337c53d..f02394875620 100644 --- a/src/kernel/ipc/ipc3/CMakeLists.txt +++ b/src/kernel/ipc/ipc3/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -# Files common to Zephyr and XTOS +# Files common to the Zephyr and host builds add_local_sources(sof handler.c helper.c diff --git a/src/kernel/platform/amd/common/include/platform/drivers/idc.h b/src/kernel/platform/amd/common/include/platform/drivers/idc.h index 03b3aae68ba8..b6e22f29702d 100644 --- a/src/kernel/platform/amd/common/include/platform/drivers/idc.h +++ b/src/kernel/platform/amd/common/include/platform/drivers/idc.h @@ -5,7 +5,7 @@ * Author: Basavaraj Hiregoudar * SaiSurya, Ch */ -#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__) +#ifdef __ZEPHYR_RTOS_IDC_H__ #ifndef __PLATFORM_DRIVERS_IDC_H__ #define __PLATFORM_DRIVERS_IDC_H__ @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; } #else -#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h" #endif diff --git a/src/kernel/platform/imx8/include/platform/drivers/idc.h b/src/kernel/platform/imx8/include/platform/drivers/idc.h index f85abef65924..701661d393c0 100644 --- a/src/kernel/platform/imx8/include/platform/drivers/idc.h +++ b/src/kernel/platform/imx8/include/platform/drivers/idc.h @@ -5,7 +5,7 @@ * Author: Daniel Baluta */ -#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__) +#ifdef __ZEPHYR_RTOS_IDC_H__ #ifndef __PLATFORM_DRIVERS_IDC_H__ #define __PLATFORM_DRIVERS_IDC_H__ @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; } #else -#error "This file shouldn't be included from outside of Zepyhr/XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h" #endif diff --git a/src/kernel/platform/imx8m/include/platform/drivers/idc.h b/src/kernel/platform/imx8m/include/platform/drivers/idc.h index 0352e459a715..d9c4883d622f 100644 --- a/src/kernel/platform/imx8m/include/platform/drivers/idc.h +++ b/src/kernel/platform/imx8m/include/platform/drivers/idc.h @@ -5,7 +5,7 @@ * Author: Daniel Baluta */ -#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__) +#ifdef __ZEPHYR_RTOS_IDC_H__ #ifndef __PLATFORM_DRIVERS_IDC_H__ #define __PLATFORM_DRIVERS_IDC_H__ @@ -23,6 +23,6 @@ static inline int idc_init(void) { return 0; } #else -#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h" #endif diff --git a/src/kernel/platform/imx8ulp/include/platform/drivers/idc.h b/src/kernel/platform/imx8ulp/include/platform/drivers/idc.h index 44829152c2a1..5cb90a4b2c50 100644 --- a/src/kernel/platform/imx8ulp/include/platform/drivers/idc.h +++ b/src/kernel/platform/imx8ulp/include/platform/drivers/idc.h @@ -6,7 +6,7 @@ * Author: Zhang Peng */ -#if defined(__XTOS_RTOS_IDC_H__) || defined(__ZEPHYR_RTOS_IDC_H__) +#ifdef __ZEPHYR_RTOS_IDC_H__ #ifndef __PLATFORM_DRIVERS_IDC_H__ #define __PLATFORM_DRIVERS_IDC_H__ @@ -24,6 +24,6 @@ static inline int idc_init(void) { return 0; } #else -#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of Zephyr's rtos/idc.h" #endif diff --git a/src/kernel/platform/library/include/platform/drivers/idc.h b/src/kernel/platform/library/include/platform/drivers/idc.h index e538884bbb5f..c9ed7fab4662 100644 --- a/src/kernel/platform/library/include/platform/drivers/idc.h +++ b/src/kernel/platform/library/include/platform/drivers/idc.h @@ -37,6 +37,6 @@ static inline int idc_restore(void) #else -#error "This file shouldn't be included from outside of Zephyr/XTOS's rtos/idc.h" +#error "This file shouldn't be included from outside of the host rtos/idc.h" #endif diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index e37ff18808aa..ed9b620aba4a 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -7,11 +7,9 @@ if(CONFIG_SOF_FULL_ZEPHYR_APPLICATION) if(CONFIG_ZEPHYR_POSIX) set(ARCH host) set(PLATFORM "posix") - set(PLATFORM_HEADERS "posix") else() # firmware build supports only xtensa arch for now set(ARCH xtensa) - set(PLATFORM_HEADERS "xtos") endif() # Appends literal with path of the source file relative to the project root @@ -201,9 +199,9 @@ zephyr_include_directories(${SOF_SRC_PATH}/include/sof/audio/module_adapter/libr # New, "de-centralized Zephyr" way. Requires "is_zephyr()" conditionals in -# the decentralized CMakeLists.txt files shared with XTOS. +# the decentralized CMakeLists.txt files shared with the host builds. -# XTOS duplicate in sof/scripts/misc.cmake; keep in sync +# Host build duplicate in sof/scripts/cmake/misc.cmake; keep in sync macro(is_zephyr ret) if(CONFIG_ZEPHYR_SOF_MODULE) set(${ret} TRUE) @@ -212,7 +210,7 @@ macro(is_zephyr ret) endif() endmacro() -# Wrappers for compatibility and re-use of existing, XTOS CMake files. +# Wrappers for the CMake files shared with the host builds. # Do NOT use these macros in this file or in any other Zephyr-specific # CMake code. macro(add_local_sources target) diff --git a/zephyr/Kconfig b/zephyr/Kconfig index a29d11d3a76a..148374c533a8 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -266,7 +266,7 @@ config ZEPHYR_NATIVE_DRIVERS Enable Zephyr native api drivers for host and dai audio components host-zephyr dai-zephyr - will be used instead of legacy xtos version. + will be used instead of the legacy SOF drivers. config DMA_MTK_SOF_HOST_DMA bool "MediaTek SOF host DMA driver" diff --git a/zephyr/README b/zephyr/README index 79f4f7edc34d..ab96a36305ff 100644 --- a/zephyr/README +++ b/zephyr/README @@ -1,14 +1,9 @@ SOF with Zephyr RTOS ==================== -SOF currently uses the Cadence Xtos/HAL and it's own kernel functions as -its RTOS. SOF is moving to use Zephyr as it's RTOS in parallel to current -releases using xtos. - -The initial "alpha" of SOF on Zephyr will use the Zephyr RTOS for boot, IRQs, -scheduling and memory allocation. Subsequent release will use more Zephyr -functionality as code is moved from SOF to Zephyr (i.e. EDF scheduler updates -copied from SOF to Zephyr). +SOF uses the Zephyr RTOS for boot, IRQs, scheduling and memory allocation. +Zephyr is the only supported RTOS: the XTOS (Cadence Xtos/HAL) firmware build +has been removed. Building SOF on Zephyr ====================== diff --git a/zephyr/include/rtos/interrupt.h b/zephyr/include/rtos/interrupt.h index 6be9e55ee3c2..a14a795e8e7a 100644 --- a/zephyr/include/rtos/interrupt.h +++ b/zephyr/include/rtos/interrupt.h @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright(c) 2022 Intel Corporation. All rights reserved. - * - * TODO: IMX support, today IRQ is supported via SOF xtos API. */ #ifndef __ZEPHYR_RTOS_INTERRUPT_H__ @@ -12,7 +10,7 @@ * to native drivers. */ #if defined(CONFIG_AMD) && !defined(CONFIG_ZEPHYR_NATIVE_DRIVERS) -/* imx currently has no IRQ driver in Zephyr so we force to xtos IRQ */ +/* AMD platforms without native drivers use the legacy SOF interrupt API */ #include #else diff --git a/zephyr/include/sof/lib/dma.h b/zephyr/include/sof/lib/dma.h index 145478db30f3..9d24a7097e55 100644 --- a/zephyr/include/sof/lib/dma.h +++ b/zephyr/include/sof/lib/dma.h @@ -50,10 +50,10 @@ struct k_heap; * Definitions in this file are used by following SOF code: * - Some use of SOF DMA data types and definitions exists in * generic application code (in IPC, host handling and a few other - * places). To support both XTOS and Zephyr builds, these + * places). To support both the host and Zephyr builds, these * definitions must be provided by the RTOS layer. * - SOF builds where Zephyr is used but platform has not yet - * moved to native Zephyr drivers, so legacy/XTOS DMA are used. + * moved to native Zephyr drivers, so the legacy SOF DMA drivers are used. * - Linking DMA resources to audio usages. Even SOF builds with * native Zephyr build still use some SOF side DMA definitions * to describe system DMA resources in terms of their capabilities diff --git a/zephyr/include/sof/trace/preproc.h b/zephyr/include/sof/trace/preproc.h index d0333c7751c7..94bcb60c6444 100644 --- a/zephyr/include/sof/trace/preproc.h +++ b/zephyr/include/sof/trace/preproc.h @@ -9,7 +9,7 @@ #ifndef CONFIG_ZEPHYR_LOG /* - * Unlike the XTOS version of this macro, this does not silence all + * Unlike the host version of this macro, this does not silence all * compiler warnings about unused variables. */ #define SOF_TRACE_UNUSED(arg1, ...) ((void)arg1) diff --git a/zephyr/wrapper.c b/zephyr/wrapper.c index 0a32cfb701e5..f57231c1582f 100644 --- a/zephyr/wrapper.c +++ b/zephyr/wrapper.c @@ -59,7 +59,7 @@ DECLARE_TR_CTX(zephyr_tr, SOF_UUID(zephyr_uuid), LOG_LEVEL_INFO); const char irq_name_level2[] = "level2"; const char irq_name_level5[] = "level5"; -/* imx currently has no IRQ driver in Zephyr so we force to xtos IRQ */ +/* AMD platforms without native drivers use the legacy SOF interrupt API */ #if defined(CONFIG_AMD) && !defined(CONFIG_ZEPHYR_NATIVE_DRIVERS) int interrupt_register(uint32_t irq, void(*handler)(void *arg), void *arg) {