Skip to content
Open
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
9 changes: 9 additions & 0 deletions soc/intel/intel_adsp/ace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,12 @@ config SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS
help
Specify the number of NOPs in Intel Audio DSP specific
arch_spin_relax().

config SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID
bool "Add CPU ID to offset NOPs"
depends on SOC_SERIES_INTEL_ADSP_ACE_CUSTOM_MORE_SPIN_RELAX_NOPS
help
Add CPU ID to the number of NOPs in arch_spin_relax().
This is to add some variations to the loop for each CPU to
further avoid them hitting the RCW transactions at the same
time.
9 changes: 8 additions & 1 deletion soc/intel/intel_adsp/ace/spin_relax.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
#include <zephyr/toolchain.h>
#include <zephyr/sys/util_macro.h>

#include <zephyr/arch/xtensa/arch_inlines.h>

#ifdef CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS
void arch_spin_relax(void)
{
register uint32_t remaining = CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS;

#if defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID)
remaining += arch_proc_id();
Copy link
Contributor

Choose a reason for hiding this comment

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

without going too deeply into this - is this enough? The variable is decremented by 4, so maybe arch_proc_id() * 4?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it, though I feel like always adding 20 NOPs on CPU #5 seems too much.

#endif /* CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID */

while (remaining > 0) {
#if (CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS % 4) == 0
#if !defined(CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID) && \
(CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS % 4) == 0
remaining -= 4;

/*
Expand Down
3 changes: 3 additions & 0 deletions tests/kernel/smp/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID=y
3 changes: 3 additions & 0 deletions tests/kernel/smp/boards/intel_adsp_ace20_lnl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID=y
3 changes: 3 additions & 0 deletions tests/kernel/smp/boards/intel_adsp_ace30_ptl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID=y
3 changes: 3 additions & 0 deletions tests/kernel/smp/boards/intel_adsp_ace40_nvl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_INTEL_ADSP_ACE_NUM_SPIN_RELAX_NOPS_ADD_CPU_ID=y