Skip to content

Commit 7fd0a7a

Browse files
kv2019iaescolar
authored andcommitted
soc: intel_adsp: replace icache ISR workaround with custom idle solution
A workaround to avoid icache corruption was added in commit be881d4 ("arch: xtensa: add isync to interrupt vector"). This patch implements a different workaround by adding custom logic to idle entry on affected Intel ADSP platforms. To safely enter "waiti" when clock gating is enabled, we need to ensure icache is both unlocked and invalidated upon entry. Signed-off-by: Kai Vehmanen <[email protected]>
1 parent 213bad1 commit 7fd0a7a

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

arch/xtensa/include/xtensa_asm2_s.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,6 @@ _Level\LVL\()Vector:
609609
s32i a2, a1, ___xtensa_irq_bsa_t_a2_OFFSET
610610
s32i a3, a1, ___xtensa_irq_bsa_t_a3_OFFSET
611611

612-
#ifdef CONFIG_ADSP_IDLE_CLOCK_GATING
613-
/* Needed when waking from low-power waiti state */
614-
isync
615-
#endif
616-
617612
/* Level "1" is the exception handler, which uses a different
618613
* calling convention. No special register holds the
619614
* interrupted PS, instead we just assume that the CPU has

soc/intel/intel_adsp/ace/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ config SOC_SERIES_INTEL_ADSP_ACE
88
select ATOMIC_OPERATIONS_BUILTIN if "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc"
99
select ARCH_HAS_COHERENCE
1010
select SCHED_IPI_SUPPORTED
11+
select ARCH_CPU_IDLE_CUSTOM
1112
select DW_ICTL_ACE
1213
select SOC_HAS_RUNTIME_NUM_CPUS
1314
select HAS_PM

soc/intel/intel_adsp/ace/power.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,25 @@ void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
437437
}
438438

439439
#endif /* CONFIG_PM */
440+
441+
#ifdef CONFIG_ARCH_CPU_IDLE_CUSTOM
442+
443+
__no_optimization
444+
void arch_cpu_idle(void)
445+
{
446+
uint32_t cpu = arch_proc_id();
447+
448+
sys_trace_idle();
449+
450+
/*
451+
* unlock and invalidate icache if clock gating is allowed
452+
*/
453+
if (!(DSPCS.bootctl[cpu].bctl & DSPBR_BCTL_WAITIPCG)) {
454+
xthal_icache_all_unlock();
455+
xthal_icache_all_invalidate();
456+
}
457+
458+
__asm__ volatile ("waiti 0");
459+
}
460+
461+
#endif /* CONFIG_ARCH_CPU_IDLE_CUSTOM */

0 commit comments

Comments
 (0)