arch: xtensa: add waiti wakeup hook

On some platforms there is a need to perform tasks after
coming back from waiti.

There is no central interrupts processing function in SOF.
Every interrupt is registered separaterly, so we need to execute
'wake up' functions in xtos interrupts handlers.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
Janusz Jankowski 2020-01-24 14:35:31 +01:00
parent 82d8ba075d
commit 76544f5a13
9 changed files with 45 additions and 1 deletions

View File

@ -17,4 +17,13 @@ config SMP
help
Indicates that architecture uses multiple cores
config WAKEUP_HOOK
bool
default n
help
Enables hook that is called and after coming back from WAITI.
This config should be selected by other platform-level configs.
Platforms that use it, have to implement hook function
platform_interrupt_on_wakeup.
endmenu

View File

@ -1,3 +1,3 @@
# SPDX-License-Identifier: BSD-3-Clause
add_local_sources(sof timer.c)
add_local_sources(sof interrupt.c timer.c)

View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2020 Intel Corporation. All rights reserved.
//
// Author: Janusz Jankowski <janusz.jankowski@linux.intel.com>
#include <sof/drivers/interrupt.h>
#if CONFIG_WAKEUP_HOOK
void arch_interrupt_on_wakeup(void)
{
platform_interrupt_on_wakeup();
}
#endif

View File

@ -14,6 +14,7 @@
#include <xtensa/xtruntime.h>
#include <stddef.h>
#include <stdint.h>
#include <config.h>
static inline int arch_interrupt_register(int irq,
void (*handler)(void *arg), void *arg)
@ -83,6 +84,10 @@ static inline void arch_interrupt_global_enable(uint32_t flags)
:: "a" (flags) : "memory");
}
#if CONFIG_WAKEUP_HOOK
void arch_interrupt_on_wakeup(void);
#endif
#endif /* __ARCH_DRIVERS_INTERRUPT_H__ */
#else

View File

@ -10,6 +10,7 @@
#include <sof/debug/panic.h>
#include <sof/drivers/interrupt.h>
#include <sof/lib/clk.h>
#include <ipc/trace.h>
#include <config.h>
#include <xtensa/xtruntime.h>

View File

@ -169,6 +169,8 @@ no_context:
* number and exception stack frame), then call the interrupt handler.
* Note: The callx12 preserves the original user task's a4..a15.*/
xtos_on_wakeup
#if CONFIG_SMP
xtos_addr_percore_add a12, xtos_interrupt_table, MAPINT(SINGLE_INT_NUM)*XIE_SIZE
#else
@ -228,6 +230,8 @@ no_context:
/* set interrupt task context */
xtos_task_ctx_store_percore a11, a14
xtos_on_wakeup
/* Loop to handle all pending interrupts. */
LABEL(.L1,_loop0):

View File

@ -159,6 +159,8 @@ no_context:
/* set interrupt task context */
xtos_task_ctx_store_percore a11, a14
xtos_on_wakeup
/* Loop to handle all pending interrupts. */
LABEL(.L1,_loop0):

View File

@ -159,6 +159,8 @@ no_context:
/* set interrupt task context */
xtos_task_ctx_store_percore a11, a14
xtos_on_wakeup
/* Loop to handle all pending interrupts. */
LABEL(.L1,_loop0):

View File

@ -494,6 +494,13 @@ exit:
s32i \ax, \ay, XTOS_TASK_CONTEXT_OFFSET
.endm
// Executes optional callback on wake up
.macro xtos_on_wakeup
#if CONFIG_WAKEUP_HOOK
call12 arch_interrupt_on_wakeup
#endif
.endm
#else /* !_ASMLANGUAGE && !__ASSEMBLER__ */
/*