Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Oct 28, 2025

All normal SOF builds use Zephyr build system, so common settings like system core count can be simply set based on Zephyr build options.

There are a few speciality builds left to build SOF without Zephyr. Testbench, cmocka and the SOF ALSA plugin are a few such examples. To keep these builds functional, add a simple definition of key Zephyr definitions (like in this case MP_MAX_NUM_CPUS) to allow these builds to use common build rules even when Zephyr definitions are not available.

The old arch/host/Kconfig is removed. It is no longer needed and caused confusion as it added a unconditional default to CORE_COUNT that was used (more or less unintentionally) by some of the speciality build targets.

All normal SOF builds use Zephyr build system, so common settings
like system core count can be simply set based on Zephyr build options.

There are a few speciality builds left to build SOF without Zephyr.
Testbench, cmocka and the SOF ALSA plugin are a few such examples.
To keep these builds functional, add a simple definition of key
Zephyr definitions (like in this case MP_MAX_NUM_CPUS) to allow these
builds to use common build rules even when Zephyr definitions are not
available.

The old arch/host/Kconfig is removed. It is no longer needed and caused
confusion as it added a unconditional default to CORE_COUNT that was
used (more or less unintentionally) by some of the speciality build
targets.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI review requested due to automatic review settings October 28, 2025 13:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies the configuration of core counts in the SOF build system by leveraging Zephyr's MP_MAX_NUM_CPUS definition and removing redundant configuration. The changes allow both Zephyr-based builds and specialty non-Zephyr builds (testbench, cmocka, SOF ALSA plugin) to use common build rules.

  • Removed platform-specific defaults from MAX_CORE_COUNT and made it derive from MP_MAX_NUM_CPUS
  • Simplified CORE_COUNT to always default to MP_MAX_NUM_CPUS with a range constraint
  • Removed the confusing arch/host/Kconfig file that provided an unconditional default

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/platform/Kconfig Added MP_MAX_NUM_CPUS definition for non-Zephyr builds; simplified MAX_CORE_COUNT and CORE_COUNT to derive from MP_MAX_NUM_CPUS
src/arch/host/Kconfig Removed file entirely to eliminate redundant and confusing CORE_COUNT default

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kv2019i
Copy link
Collaborator Author

kv2019i commented Oct 28, 2025

@nashif This is handle the CORE_COUNT of #10321

# For non-Zephyr builds like testbench, cmocka and SOF ALSA plugin,
# set core count separately.
#
if !ZEPHYR_SOF_MODULE
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this defined? isnt this in Zephyr and when SOF is a module? It will go away AFAIK, so we need a better way to detect a zephyr build I guess.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nashif Indeed, the two-way dependencies are even more complicated. We do use this ZEPHYR_SOF_MODULE already elsewhere, so we need a replacement anyways.

So in short, when we check out the work/sof/west.yml manifest, and build with

west build --board intel_adsp/ace30/ptl /work/sof/app 

We should have some Kconfig enabled to identify this is a west build that includes Zephyr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nashif Ok, CONFIG_ZEPHYR_SOF_MODULES is still ok, it is set even with your zephyrproject-rtos/zephyr#97946 . IOW it is set by Zephyr build system based on the manifest content, and in normal SOF build, it looks like:

$ cat /home/kvehmane/work/build-ptl/zephyr_modules.txt 
"sof":"/home/kvehmane/work/sof":"/home/kvehmane/work/sof/zephyr"
"cmsis_6":"/home/kvehmane/work/modules/hal/cmsis_6":"${ZEPHYR_CMSIS_6_CMAKE_DIR}"
"hal_nxp":"/home/kvehmane/work/modules/hal/nxp":"${ZEPHYR_HAL_NXP_CMAKE_DIR}"
"xtensa":"/home/kvehmane/work/modules/hal/xtensa":"/home/kvehmane/pr/work/modules/hal/xtensa"
"mbedtls":"/home/kvehmane/work/modules/crypto/mbedtls":"${ZEPHYR_MBEDTLS_CMAKE_DIR}"
"mipi-sys-t":"/home/kvehmane/work/modules/debug/mipi-sys-t":"/home/kvehmane/work/modules/debug/mipi-sys-t"

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Thinking long term it probably make sense to namespace our Kconfigs to avoid collisions or confusions with Zephyr, e.g. we had a CORE_COUNT collision many year ago.

@lgirdwood
Copy link
Member

@lrudyX bad DUT ?

@kv2019i
Copy link
Collaborator Author

kv2019i commented Oct 28, 2025

V2 pushed:

@kv2019i
Copy link
Collaborator Author

kv2019i commented Oct 28, 2025

The imx95_evk build fails for some reason. I can run this OK locally, but in github job it keeps failing:

west build --build-dir build-imx95 --board imx95_evk/mimx9596/m7/ddr /__w/sof/sof/sof/app -- -DEXTRA_CFLAGS=-Werror -DEXTRA_CXXFLAGS=-Werror '-DEXTRA_AFLAGS=-Werror -Wa,--fatal-warnings' --warn-uninitialized -DEXTRA_CONF_FILE=/__w/sof/sof/sof/app/configs/repro-build.conf

... not sure what goes wrong and how it is related to this PR, but seems to be systematic. FYI @thesofproject/nxp

@LaurentiuM1234
Copy link
Contributor

LaurentiuM1234 commented Oct 28, 2025

The imx95_evk build fails for some reason. I can run this OK locally, but in github job it keeps failing:

west build --build-dir build-imx95 --board imx95_evk/mimx9596/m7/ddr /__w/sof/sof/sof/app -- -DEXTRA_CFLAGS=-Werror -DEXTRA_CXXFLAGS=-Werror '-DEXTRA_AFLAGS=-Werror -Wa,--fatal-warnings' --warn-uninitialized -DEXTRA_CONF_FILE=/__w/sof/sof/sof/app/configs/repro-build.conf

... not sure what goes wrong and how it is related to this PR, but seems to be systematic. FYI @thesofproject/nxp

I believe it's because of zephyrproject-rtos/zephyr#97988. #10319 should do the trick but we'll most likely need a manifest update?

LE: can't test right now but I think it's actually because of CONFIG_SOF, which is dropped in this PR? Before zephyrproject-rtos/zephyr#97988 we would set the rimage target for imx95 based on CONFIG_SOF (if set to y then add target, otherwise don't)

@kv2019i would it be too inconvenient if we had #10319 go in before this one?

LE (2): I think we can make do without the manifest update from #10319 and just have the rimage-related bit go into this PR? This way, we can avoid having to look at the potential CI failures caused by the manifest update itself. If you're ok with this option, I'll double check tomorrow to make sure everything works well.

@kv2019i
Copy link
Collaborator Author

kv2019i commented Oct 29, 2025

Thanks a lot @LaurentiuM1234 for quick response and analysis. That is indeed the problem. I was doing this to pave the way for zephyrproject-rtos/zephyr#97946 (do all SOF side changes we can do beforehand). But there's no rush, we can for sure let #10319 go in first. Let me actually split #10334 and #10335 again, so then we can go in order:

  1. platform: simplify setting CORE_COUNT and MAX_CORE_COUNT #10334 or zephyr: CMakeLists.txt: add rimage support for the imx95 target #10319
  2. zephyr: stop using CONFIG_SOF to identify Zephyr build (w/ Zephyr Nov/20 update) #10335
  3. ready for Zephyr upstream with CONFIG_SOF removed

We seem to have DUT issues in Intel CI @abonislawski @lrudyX , one DUT is failing all the time (also for this PR).

@kv2019i kv2019i force-pushed the 202510-corecount-refactor branch from c0fc72b to 7ceab0b Compare October 29, 2025 08:08
@kv2019i
Copy link
Collaborator Author

kv2019i commented Oct 29, 2025

V3:

@lrudyX
Copy link

lrudyX commented Oct 30, 2025

@lrudyX bad DUT ?

Yes, DUT problem has been solved. I see green for this PR.

@kv2019i kv2019i merged commit 2a6422c into thesofproject:main Oct 30, 2025
73 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants