arch: xtensa: Carve space for saved HiFi regs
As the BSA can not be used when lazy HiFi context switching is
used, a more permanent and predictable location in which to store
the registers is required. To this end ...
1. reserve some space in the arch-specific portion of the k_thread
structure for those registers.
2. clear that region when the thread is created.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
cd351208d5
commit
6505cf2e54
@ -120,6 +120,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
||||
{
|
||||
thread->switch_handle = init_stack(thread, (int *)stack_ptr, entry,
|
||||
p1, p2, p3);
|
||||
#ifdef CONFIG_XTENSA_LAZY_HIFI_SHARING
|
||||
memset(thread->arch.hifi_regs, 0, sizeof(thread->arch.hifi_regs));
|
||||
#endif /* CONFIG_XTENSA_LAZY_HIFI_SHARING */
|
||||
|
||||
#ifdef CONFIG_KERNEL_COHERENCE
|
||||
__ASSERT((((size_t)stack) % XCHAL_DCACHE_LINESIZE) == 0, "");
|
||||
__ASSERT((((size_t)stack_ptr) % XCHAL_DCACHE_LINESIZE) == 0, "");
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
#include <zephyr/arch/xtensa/mpu.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_XTENSA_LAZY_HIFI_SHARING
|
||||
#include <xtensa/config/tie.h>
|
||||
#endif
|
||||
|
||||
/* Xtensa doesn't use these structs, but Zephyr core requires they be
|
||||
* defined so they can be included in struct _thread_base. Dummy
|
||||
* field exists for sizeof compatibility with C++.
|
||||
@ -48,6 +52,11 @@ struct _thread_arch {
|
||||
*/
|
||||
uint32_t return_ps;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_XTENSA_LAZY_HIFI_SHARING
|
||||
/* A non-BSA region is required for lazy save/restore */
|
||||
uint8_t hifi_regs[XCHAL_CP1_SA_SIZE] __aligned(XCHAL_CP1_SA_ALIGN);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _thread_arch _thread_arch_t;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user