diff --git a/.github/workflows/zephyr.yml b/.github/workflows/zephyr.yml index 9751b628a3c3..1ead43174544 100644 --- a/.github/workflows/zephyr.yml +++ b/.github/workflows/zephyr.yml @@ -156,6 +156,12 @@ jobs: - zephyr_revision: mnfst IPC_platforms: wcl imx95 + # The default configuration targets Linux, also build the + # internal CI configuration (app/internal_ci_overlay.conf). + - zephyr_revision: mnfst + IPC_platforms: lnl ptl + config_overlay: internal_ci + steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Download a full clone to fix `git describe`, sof_version.h and @@ -232,6 +238,7 @@ jobs: --cmake-args=-DEXTRA_AFLAGS='-Werror -Wa,--fatal-warnings' \ --cmake-args=--warn-uninitialized \ --overlay=sof/app/configs/repro-build.conf \ + ${{ matrix.config_overlay && format('--overlay=sof/app/{0}_overlay.conf', matrix.config_overlay) || '' }} \ --no-tarball \ ${{ matrix.build_opts }} ${{ matrix.IPC_platforms }} @@ -252,7 +259,7 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 if: always() with: - name: linux-build ${{ matrix.build_opts }} ${{ matrix.IPC_platforms }} + name: linux-build ${{ matrix.build_opts }} ${{ matrix.IPC_platforms }}${{ matrix.config_overlay && format(' {0}', matrix.config_overlay) || '' }} if-no-files-found: error path: | build-sof-staging diff --git a/Kconfig.sof b/Kconfig.sof index 3c8d8af05db9..d5644117b302 100644 --- a/Kconfig.sof +++ b/Kconfig.sof @@ -50,11 +50,14 @@ config FAST_GET config SOF_OS_LINUX_COMPAT_PRIORITY bool "Prioritize backwards compatibility for old Linux kernels" + default y help Build option to maintain maximal backwards compatibility with old versions of Linux SOF driver. When this is not set, firmware may require newer version of host, and/or use features that are not - available in stable Linux kernel trees. + available in stable Linux kernel trees. This is enabled by default + as the default SOF build targets the Linux SOF driver, it is + disabled by app/internal_ci_overlay.conf. rsource "Kconfig.xtos" diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index fe9b208fe99f..5f7061246549 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -4,19 +4,37 @@ cmake_minimum_required(VERSION 3.21.0) # Board specific overlays (these must be before find_package(Zephyr)) # ------------------------------------------------------------------- +# +# The default build targets the Linux SOF driver. Overlays added here +# are put before any user given overlays, so that the user overlays +# take precedence. -# Intel ACE3.x and newer (e.g. ptl, wcl, nvl): if "os_linux_overlay" -# used, also add "ll_userspace_overlay". The board target may be given -# in full in BOARD ("intel_adsp/ace30/ptl") or split into BOARD and -# BOARD_QUALIFIERS ("intel_adsp" + "ace30/ptl"), so match on both. -if(DEFINED EXTRA_CONF_FILE AND - "${BOARD}/${BOARD_QUALIFIERS}" MATCHES "^intel_adsp/ace[3-9][0-9]/") - string(FIND "${EXTRA_CONF_FILE}" "os_linux_overlay" _linux_overlay_idx) - string(FIND "${EXTRA_CONF_FILE}" "ll_userspace_overlay" _ll_overlay_idx) - if(_linux_overlay_idx GREATER_EQUAL 0 AND _ll_overlay_idx LESS 0) - list(APPEND EXTRA_CONF_FILE - "${CMAKE_CURRENT_SOURCE_DIR}/ll_userspace_overlay.conf") +# The board target may be given in full in BOARD ("intel_adsp/ace30/ptl") +# or split into BOARD and BOARD_QUALIFIERS ("intel_adsp" + "ace30/ptl"), +# so normalize the concatenation of the two. +string(REGEX REPLACE "/+" "/" _sof_board "${BOARD}/${BOARD_QUALIFIERS}") +string(REGEX REPLACE "/$" "" _sof_board "${_sof_board}") +string(REPLACE "/" "_" _sof_board_conf "${_sof_board}") + +# Zephyr merges the overlays given in EXTRA_CONF_FILE and the deprecated +# OVERLAY_CONFIG, from both CMake variables and the environment, so look +# at all of them to find out which overlays are used. +set(_sof_conf_files "${EXTRA_CONF_FILE};$ENV{EXTRA_CONF_FILE};${OVERLAY_CONFIG};$ENV{OVERLAY_CONFIG}") + +if("${_sof_conf_files}" MATCHES "internal_ci_overlay") + # Internal CI build: also add the board specific internal CI overlay, + # if there is one. + set(_sof_ci_overlay + "${CMAKE_CURRENT_SOURCE_DIR}/overlays/internal_ci/${_sof_board_conf}.conf") + if(EXISTS "${_sof_ci_overlay}") + list(PREPEND EXTRA_CONF_FILE "${_sof_ci_overlay}") endif() +elseif("${_sof_board}" MATCHES "^intel_adsp/ace[3-9][0-9]/" AND + NOT "${_sof_conf_files}" MATCHES "ll_userspace_overlay") + # Intel ACE3.x and newer (e.g. ptl, wcl, nvl): Linux builds use + # user-space LL. + list(PREPEND EXTRA_CONF_FILE + "${CMAKE_CURRENT_SOURCE_DIR}/ll_userspace_overlay.conf") endif() find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 6c45ffef2007..9eab3366ac0d 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -62,7 +62,7 @@ CONFIG_SYS_CLOCK_TICKS_PER_SEC=12000 # Zephyr / power settings CONFIG_ADSP_IDLE_CLOCK_GATING=y -CONFIG_ADSP_IMR_CONTEXT_SAVE=y +CONFIG_ADSP_IMR_CONTEXT_SAVE=n CONFIG_PM_PREWAKEUP_CONV_MODE_CEIL=y CONFIG_PM_DEVICE_RUNTIME_ASYNC=n diff --git a/app/boards/intel_adsp_ace30_ptl.conf b/app/boards/intel_adsp_ace30_ptl.conf index 43f718981453..b04e31ea0610 100644 --- a/app/boards/intel_adsp_ace30_ptl.conf +++ b/app/boards/intel_adsp_ace30_ptl.conf @@ -66,7 +66,7 @@ CONFIG_XTENSA_MMU_NUM_L2_TABLES=50 CONFIG_SYS_CLOCK_TICKS_PER_SEC=12000 # Zephyr / power settings -CONFIG_ADSP_IMR_CONTEXT_SAVE=y +CONFIG_ADSP_IMR_CONTEXT_SAVE=n CONFIG_PM_PREWAKEUP_CONV_MODE_CEIL=y CONFIG_PM_DEVICE_RUNTIME_ASYNC=n @@ -81,7 +81,6 @@ CONFIG_DYNAMIC_THREAD=y CONFIG_DYNAMIC_THREAD_ALLOC=y CONFIG_DYNAMIC_THREAD_PREFER_ALLOC=y CONFIG_SOF_STACK_SIZE=8192 -CONFIG_SOF_USERSPACE_PROXY=y CONFIG_MAX_THREAD_BYTES=3 CONFIG_MAX_DOMAIN_PARTITIONS=32 diff --git a/app/boards/intel_adsp_ace30_wcl.conf b/app/boards/intel_adsp_ace30_wcl.conf index 98f5ba341fc3..77797e16b757 100644 --- a/app/boards/intel_adsp_ace30_wcl.conf +++ b/app/boards/intel_adsp_ace30_wcl.conf @@ -61,7 +61,7 @@ CONFIG_MM_DRV_INTEL_VIRTUAL_REGION_COUNT=3 CONFIG_SYS_CLOCK_TICKS_PER_SEC=12000 # Zephyr / power settings -CONFIG_ADSP_IMR_CONTEXT_SAVE=y +CONFIG_ADSP_IMR_CONTEXT_SAVE=n CONFIG_PM_PREWAKEUP_CONV_MODE_CEIL=y CONFIG_PM_DEVICE_RUNTIME_ASYNC=n diff --git a/app/boards/intel_adsp_ace40_nvl.conf b/app/boards/intel_adsp_ace40_nvl.conf index 4576e5a45210..5f75ab52b423 100644 --- a/app/boards/intel_adsp_ace40_nvl.conf +++ b/app/boards/intel_adsp_ace40_nvl.conf @@ -58,7 +58,7 @@ CONFIG_MM_DRV_INTEL_VIRTUAL_REGION_COUNT=3 CONFIG_SYS_CLOCK_TICKS_PER_SEC=12000 # Zephyr / power settings -CONFIG_ADSP_IMR_CONTEXT_SAVE=y +CONFIG_ADSP_IMR_CONTEXT_SAVE=n CONFIG_PM_PREWAKEUP_CONV_MODE_CEIL=y CONFIG_SRAM_RETENTION_MODE=n CONFIG_PM_DEVICE_RUNTIME_ASYNC=n @@ -67,7 +67,7 @@ CONFIG_PM_DEVICE_RUNTIME_ASYNC=n CONFIG_LOG_BACKEND_ADSP=n CONFIG_WINSTREAM_CONSOLE=n CONFIG_LOG_RUNTIME_FILTERING=y -CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=1 +CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=3 # Zephyr / debug: temporary, until fixed CONFIG_GDBSTUB=n diff --git a/app/boards/intel_adsp_ace40_nvls.conf b/app/boards/intel_adsp_ace40_nvls.conf index 67cdb0e2cb86..f6cf5e494022 100644 --- a/app/boards/intel_adsp_ace40_nvls.conf +++ b/app/boards/intel_adsp_ace40_nvls.conf @@ -59,7 +59,7 @@ CONFIG_MM_DRV_INTEL_VIRTUAL_REGION_COUNT=3 CONFIG_SYS_CLOCK_TICKS_PER_SEC=12000 # Zephyr / power settings -CONFIG_ADSP_IMR_CONTEXT_SAVE=y +CONFIG_ADSP_IMR_CONTEXT_SAVE=n CONFIG_PM_PREWAKEUP_CONV_MODE_CEIL=y CONFIG_SRAM_RETENTION_MODE=n CONFIG_PM_DEVICE_RUNTIME_ASYNC=n @@ -68,7 +68,7 @@ CONFIG_PM_DEVICE_RUNTIME_ASYNC=n CONFIG_LOG_BACKEND_ADSP=n CONFIG_WINSTREAM_CONSOLE=n CONFIG_LOG_RUNTIME_FILTERING=y -CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=1 +CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=3 # Zephyr / debug: temporary, until fixed CONFIG_GDBSTUB=n diff --git a/app/internal_ci_overlay.conf b/app/internal_ci_overlay.conf new file mode 100644 index 000000000000..4dbdc677549a --- /dev/null +++ b/app/internal_ci_overlay.conf @@ -0,0 +1,19 @@ +# +# Overlay definitions to build SOF firmware for internal CI +# +# The default SOF build (board config files) targets the Linux SOF +# driver. This overlay restores the configuration that was used +# for non-Linux builds before Linux became the default. +# +# When this overlay is used, app/CMakeLists.txt also: +# - does not include the Intel ACE3.x+ LL userspace overlay +# (ll_userspace_overlay.conf) +# - includes the board specific internal CI overlay from +# overlays/internal_ci/.conf, if present +# + +# Do not restrict firmware to features supported by stable +# Linux SOF driver versions. This also enables the additional +# virtual heap buffers (VIRTUAL_HEAP_EXTENDED) on platforms +# that support them. +CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY=n diff --git a/app/ll_userspace_overlay.conf b/app/ll_userspace_overlay.conf index 79ebcff70252..a4b8e9affe06 100644 --- a/app/ll_userspace_overlay.conf +++ b/app/ll_userspace_overlay.conf @@ -1,9 +1,9 @@ # This is overlay configuration file to enable user-space LL audio # pipeline support. # -# NOTE: this overlay is automatically included if an Intel ACE3.x -# or newer target (e.g. ptl, wcl, nvl) is built with generic -# "os_linux_overlay.conf" +# NOTE: this overlay is automatically included when an Intel ACE3.x +# or newer target (e.g. ptl, wcl, nvl) is built, unless the +# build uses "internal_ci_overlay.conf" # Enable user-space LL support in SOF # ----------------------------------- diff --git a/app/os_linux_overlay.conf b/app/os_linux_overlay.conf index 18024b4e6106..62b9eaf19bf0 100644 --- a/app/os_linux_overlay.conf +++ b/app/os_linux_overlay.conf @@ -1,27 +1,11 @@ # -# Overlay definitions to build SOF firmware for use -# with SOF driver in Linux kernel +# DEPRECATED: the default SOF build now targets the Linux SOF driver, +# so this overlay is no longer needed and is intentionally empty. +# +# It is kept so that existing build scripts that pass +# "-o app/os_linux_overlay.conf" keep working, and it will be removed +# in a future release. +# +# The previous non-Linux default configuration is available via +# app/internal_ci_overlay.conf. # - -# As a general rule, update of SOF firmware shall never -# break existing systems by depending on Linux kernel patches -# that have been upstreamed after commercial availability -# of a product. -CONFIG_SOF_OS_LINUX_COMPAT_PRIORITY=y - -# SOF Linux driver does not require FW to retain its -# state, so context save can be disabled -CONFIG_ADSP_IMR_CONTEXT_SAVE=n -CONFIG_SOF_USERSPACE_PROXY=n - -# Logging options - -# Set default runtime log level to INFO (3). -# Note: This setting only has effect when CONFIG_LOG_RUNTIME_FILTERING is enabled. -# By default, the runtime level equals the compile-time level, but it is explicitly -# set here to INFO to ensure expected behavior if platform configurations set a -# lower default level (e.g., ERROR). -CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=3 - -# Disable additional VMH buffers to use memory for virtual regions. -CONFIG_VIRTUAL_HEAP_EXTENDED=n diff --git a/app/overlays/internal_ci/intel_adsp_ace20_lnl.conf b/app/overlays/internal_ci/intel_adsp_ace20_lnl.conf new file mode 100644 index 000000000000..84d3d917ddb6 --- /dev/null +++ b/app/overlays/internal_ci/intel_adsp_ace20_lnl.conf @@ -0,0 +1,5 @@ +# Board specific internal CI settings for lnl, automatically +# included after internal_ci_overlay.conf. See internal_ci_overlay.conf. + +# Retain FW context in IMR over D3 +CONFIG_ADSP_IMR_CONTEXT_SAVE=y diff --git a/app/overlays/internal_ci/intel_adsp_ace30_ptl.conf b/app/overlays/internal_ci/intel_adsp_ace30_ptl.conf new file mode 100644 index 000000000000..41ef31989f2a --- /dev/null +++ b/app/overlays/internal_ci/intel_adsp_ace30_ptl.conf @@ -0,0 +1,8 @@ +# Board specific internal CI settings for ptl, automatically +# included after internal_ci_overlay.conf. See internal_ci_overlay.conf. + +# Retain FW context in IMR over D3 +CONFIG_ADSP_IMR_CONTEXT_SAVE=y + +# Run userspace modules inside the userspace proxy +CONFIG_SOF_USERSPACE_PROXY=y diff --git a/app/overlays/internal_ci/intel_adsp_ace30_wcl.conf b/app/overlays/internal_ci/intel_adsp_ace30_wcl.conf new file mode 100644 index 000000000000..bfd636b2ca29 --- /dev/null +++ b/app/overlays/internal_ci/intel_adsp_ace30_wcl.conf @@ -0,0 +1,5 @@ +# Board specific internal CI settings for wcl, automatically +# included after internal_ci_overlay.conf. See internal_ci_overlay.conf. + +# Retain FW context in IMR over D3 +CONFIG_ADSP_IMR_CONTEXT_SAVE=y diff --git a/app/overlays/internal_ci/intel_adsp_ace40_nvl.conf b/app/overlays/internal_ci/intel_adsp_ace40_nvl.conf new file mode 100644 index 000000000000..0ca9debdd7ac --- /dev/null +++ b/app/overlays/internal_ci/intel_adsp_ace40_nvl.conf @@ -0,0 +1,8 @@ +# Board specific internal CI settings for nvl, automatically +# included after internal_ci_overlay.conf. See internal_ci_overlay.conf. + +# Retain FW context in IMR over D3 +CONFIG_ADSP_IMR_CONTEXT_SAVE=y + +# Default runtime log level ERROR +CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=1 diff --git a/app/overlays/internal_ci/intel_adsp_ace40_nvls.conf b/app/overlays/internal_ci/intel_adsp_ace40_nvls.conf new file mode 100644 index 000000000000..351b38d316e4 --- /dev/null +++ b/app/overlays/internal_ci/intel_adsp_ace40_nvls.conf @@ -0,0 +1,8 @@ +# Board specific internal CI settings for nvls, automatically +# included after internal_ci_overlay.conf. See internal_ci_overlay.conf. + +# Retain FW context in IMR over D3 +CONFIG_ADSP_IMR_CONTEXT_SAVE=y + +# Default runtime log level ERROR +CONFIG_LOG_RUNTIME_DEFAULT_LEVEL=1 diff --git a/src/include/sof/userspace/README.md b/src/include/sof/userspace/README.md index 7106f6b6465c..e0c8498c227c 100644 --- a/src/include/sof/userspace/README.md +++ b/src/include/sof/userspace/README.md @@ -12,13 +12,13 @@ easy to maintain. ## Why this exists -SOF supports several privilege configurations. On PTL (`intel_adsp_ace30_ptl`) the board -config enables `CONFIG_USERSPACE` and `CONFIG_SOF_USERSPACE_PROXY`, running individual audio -modules in isolated user threads via the proxy container. For Linux builds -(`os_linux_overlay.conf`), `app/CMakeLists.txt` automatically includes -`app/ll_userspace_overlay.conf` on Intel ACE3.x and newer targets (e.g. ptl, wcl, nvl), which -additionally enables `CONFIG_SOF_USERSPACE_LL` so the entire LL pipeline and the module-facing -IPC run in user threads. This is the standard Linux build configuration for these targets. +SOF supports several privilege configurations. The default build targets the Linux SOF +driver: on Intel ACE3.x and newer targets (e.g. ptl, wcl, nvl), `app/CMakeLists.txt` +automatically includes `app/ll_userspace_overlay.conf`, which enables `CONFIG_USERSPACE` and +`CONFIG_SOF_USERSPACE_LL` so the entire LL pipeline and the module-facing IPC run in user +threads. With `app/internal_ci_overlay.conf` the LL userspace overlay is not included and, on +PTL (`intel_adsp_ace30_ptl`), `CONFIG_SOF_USERSPACE_PROXY` is enabled instead, running +individual audio modules in isolated user threads via the proxy container. The kernel keeps the OS/HAL, boot, drivers, and the syscall validators in both cases. The privilege boundary is real, but nothing in the source *layout* signals which side a given diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 867100623b42..25e11934dbed 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -120,11 +120,12 @@ config VIRTUAL_HEAP_EXTENDED bool "Extend the Virtual Heap configuration with additional buffers" depends on MM_DRV_INTEL_ADSP_MTL_TLB depends on VIRTUAL_HEAP - default y + default y if !SOF_OS_LINUX_COMPAT_PRIORITY help Enable additional Virtual Heap buffers. Some configurations need this while others need the memory for other purposes, e.g. for the virtual - page / virtual region storage. + page / virtual region storage. Linux builds do not need the + additional buffers. config SOF_ZEPHYR_VIRTUAL_HEAP_REGION_SIZE hex "Size in bytes of virtual memory region for virtual heap shared for all cores" diff --git a/zephyr/test/userspace/README.md b/zephyr/test/userspace/README.md index 6c14300ee333..8d9034ac6b58 100644 --- a/zephyr/test/userspace/README.md +++ b/zephyr/test/userspace/README.md @@ -24,6 +24,7 @@ Building for Intel Panther Lake: ./scripts/xtensa-build-zephyr.py --cmake-args=-DCONFIG_SOF_BOOT_TEST_STANDALONE=y \ --cmake-args=-DCONFIG_SOF_USERSPACE_INTERFACE_DMA=y \ --cmake-args=-DCONFIG_SOF_USERSPACE_LL=y \ + -o app/internal_ci_overlay.conf \ -o app/overlays/ptl/userspace_overlay.conf -o app/winconsole_overlay.conf ptl Running test: