arch: xtensa: Add hifi_owner for lazy switching

Adds a customized _cpu_arch structure for Xtensa so that it contains
a pointer to the thread that 'owns' the hifi register set for use
with lazy save/restore.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
Peter Mitsis 2025-05-28 15:46:24 -07:00 committed by Chris Friedt
parent 6505cf2e54
commit decedcabf6
2 changed files with 25 additions and 0 deletions

View File

@ -31,6 +31,8 @@
#include <zephyr/arch/arm/structs.h>
#elif defined(CONFIG_X86) && !defined(CONFIG_X86_64)
#include <zephyr/arch/x86/ia32/structs.h>
#elif defined(CONFIG_XTENSA)
#include <zephyr/arch/xtensa/structs.h>
#else
/* Default definitions when no architecture specific definitions exist. */

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_
#define ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_
/* Per CPU architecture specifics */
struct _cpu_arch {
#if defined(CONFIG_XTENSA_LAZY_HIFI_SHARING)
atomic_ptr_val_t hifi_owner; /* Owner of HiFi */
#if CONFIG_MP_MAX_NUM_CPUS > 1
atomic_ptr_val_t save_hifi; /* Save HiFi on IPI if match hifi_owner */
#endif
#elif defined(__cplusplus)
/* Ensure this struct does not have a size of 0 which is not allowed in C++. */
uint8_t dummy;
#endif
};
#endif /* ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_ */