Skip to content

Commit decedca

Browse files
peter-mitsiscfriedt
authored andcommitted
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 <[email protected]>
1 parent 6505cf2 commit decedca

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

include/zephyr/arch/structs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <zephyr/arch/arm/structs.h>
3232
#elif defined(CONFIG_X86) && !defined(CONFIG_X86_64)
3333
#include <zephyr/arch/x86/ia32/structs.h>
34+
#elif defined(CONFIG_XTENSA)
35+
#include <zephyr/arch/xtensa/structs.h>
3436
#else
3537

3638
/* Default definitions when no architecture specific definitions exist. */

include/zephyr/arch/xtensa/structs.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) Intel Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_
8+
#define ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_
9+
10+
/* Per CPU architecture specifics */
11+
struct _cpu_arch {
12+
#if defined(CONFIG_XTENSA_LAZY_HIFI_SHARING)
13+
atomic_ptr_val_t hifi_owner; /* Owner of HiFi */
14+
#if CONFIG_MP_MAX_NUM_CPUS > 1
15+
atomic_ptr_val_t save_hifi; /* Save HiFi on IPI if match hifi_owner */
16+
#endif
17+
#elif defined(__cplusplus)
18+
/* Ensure this struct does not have a size of 0 which is not allowed in C++. */
19+
uint8_t dummy;
20+
#endif
21+
};
22+
23+
#endif /* ZEPHYR_INCLUDE_XTENSA_STRUCTS_H_ */

0 commit comments

Comments
 (0)