xref: /rk3399_ARM-atf/include/lib/el3_runtime/context_el1.h (revision 6d0433f04045f52856ecb837efc873a5504d9fa2)
142e35d2fSJayanth Dodderi Chidanand /*
242e35d2fSJayanth Dodderi Chidanand  * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
342e35d2fSJayanth Dodderi Chidanand  *
442e35d2fSJayanth Dodderi Chidanand  * SPDX-License-Identifier: BSD-3-Clause
542e35d2fSJayanth Dodderi Chidanand  */
642e35d2fSJayanth Dodderi Chidanand 
742e35d2fSJayanth Dodderi Chidanand #ifndef CONTEXT_EL1_H
842e35d2fSJayanth Dodderi Chidanand #define CONTEXT_EL1_H
942e35d2fSJayanth Dodderi Chidanand 
1042e35d2fSJayanth Dodderi Chidanand #ifndef __ASSEMBLER__
1142e35d2fSJayanth Dodderi Chidanand 
1242e35d2fSJayanth Dodderi Chidanand /*******************************************************************************
1342e35d2fSJayanth Dodderi Chidanand  * EL1 Registers:
1442e35d2fSJayanth Dodderi Chidanand  * AArch64 EL1 system register context structure for preserving the
1542e35d2fSJayanth Dodderi Chidanand  * architectural state during world switches.
1642e35d2fSJayanth Dodderi Chidanand  ******************************************************************************/
1742e35d2fSJayanth Dodderi Chidanand 
1842e35d2fSJayanth Dodderi Chidanand typedef struct el1_common_regs {
1942e35d2fSJayanth Dodderi Chidanand 	uint64_t spsr_el1;
2042e35d2fSJayanth Dodderi Chidanand 	uint64_t elr_el1;
2142e35d2fSJayanth Dodderi Chidanand 
2242e35d2fSJayanth Dodderi Chidanand #if (!ERRATA_SPECULATIVE_AT)
2342e35d2fSJayanth Dodderi Chidanand 	uint64_t sctlr_el1;
2442e35d2fSJayanth Dodderi Chidanand 	uint64_t tcr_el1;
2542e35d2fSJayanth Dodderi Chidanand #endif /* ERRATA_SPECULATIVE_AT=0 */
2642e35d2fSJayanth Dodderi Chidanand 
2742e35d2fSJayanth Dodderi Chidanand 	uint64_t cpacr_el1;
2842e35d2fSJayanth Dodderi Chidanand 	uint64_t csselr_el1;
2942e35d2fSJayanth Dodderi Chidanand 	uint64_t sp_el1;
3042e35d2fSJayanth Dodderi Chidanand 	uint64_t esr_el1;
3142e35d2fSJayanth Dodderi Chidanand 	uint64_t ttbr0_el1;
3242e35d2fSJayanth Dodderi Chidanand 	uint64_t ttbr1_el1;
3342e35d2fSJayanth Dodderi Chidanand 	uint64_t mair_el1;
3442e35d2fSJayanth Dodderi Chidanand 	uint64_t amair_el1;
3542e35d2fSJayanth Dodderi Chidanand 	uint64_t actlr_el1;
3642e35d2fSJayanth Dodderi Chidanand 	uint64_t tpidr_el1;
3742e35d2fSJayanth Dodderi Chidanand 	uint64_t tpidr_el0;
3842e35d2fSJayanth Dodderi Chidanand 	uint64_t tpidrro_el0;
3942e35d2fSJayanth Dodderi Chidanand 	uint64_t par_el1;
4042e35d2fSJayanth Dodderi Chidanand 	uint64_t far_el1;
4142e35d2fSJayanth Dodderi Chidanand 	uint64_t afsr0_el1;
4242e35d2fSJayanth Dodderi Chidanand 	uint64_t afsr1_el1;
4342e35d2fSJayanth Dodderi Chidanand 	uint64_t contextidr_el1;
4442e35d2fSJayanth Dodderi Chidanand 	uint64_t vbar_el1;
4542e35d2fSJayanth Dodderi Chidanand 	uint64_t mdccint_el1;
4642e35d2fSJayanth Dodderi Chidanand 	uint64_t mdscr_el1;
4742e35d2fSJayanth Dodderi Chidanand } el1_common_regs_t;
4842e35d2fSJayanth Dodderi Chidanand 
4942e35d2fSJayanth Dodderi Chidanand typedef struct el1_aarch32_regs {
5042e35d2fSJayanth Dodderi Chidanand 	uint64_t spsr_abt;
5142e35d2fSJayanth Dodderi Chidanand 	uint64_t spsr_und;
5242e35d2fSJayanth Dodderi Chidanand 	uint64_t spsr_irq;
5342e35d2fSJayanth Dodderi Chidanand 	uint64_t spsr_fiq;
5442e35d2fSJayanth Dodderi Chidanand 	uint64_t dacr32_el2;
5542e35d2fSJayanth Dodderi Chidanand 	uint64_t ifsr32_el2;
5642e35d2fSJayanth Dodderi Chidanand } el1_aarch32_regs_t;
5742e35d2fSJayanth Dodderi Chidanand 
5842e35d2fSJayanth Dodderi Chidanand typedef struct el1_arch_timer_regs {
5942e35d2fSJayanth Dodderi Chidanand 	uint64_t cntp_ctl_el0;
6042e35d2fSJayanth Dodderi Chidanand 	uint64_t cntp_cval_el0;
6142e35d2fSJayanth Dodderi Chidanand 	uint64_t cntv_ctl_el0;
6242e35d2fSJayanth Dodderi Chidanand 	uint64_t cntv_cval_el0;
6342e35d2fSJayanth Dodderi Chidanand 	uint64_t cntkctl_el1;
6442e35d2fSJayanth Dodderi Chidanand } el1_arch_timer_regs_t;
6542e35d2fSJayanth Dodderi Chidanand 
6642e35d2fSJayanth Dodderi Chidanand typedef struct el1_mte2_regs {
6742e35d2fSJayanth Dodderi Chidanand 	uint64_t tfsre0_el1;
6842e35d2fSJayanth Dodderi Chidanand 	uint64_t tfsr_el1;
6942e35d2fSJayanth Dodderi Chidanand 	uint64_t rgsr_el1;
7042e35d2fSJayanth Dodderi Chidanand 	uint64_t gcr_el1;
7142e35d2fSJayanth Dodderi Chidanand } el1_mte2_regs_t;
7242e35d2fSJayanth Dodderi Chidanand 
7342e35d2fSJayanth Dodderi Chidanand typedef struct el1_ras_regs {
7442e35d2fSJayanth Dodderi Chidanand 	uint64_t disr_el1;
7542e35d2fSJayanth Dodderi Chidanand } el1_ras_regs_t;
7642e35d2fSJayanth Dodderi Chidanand 
7742e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1pie_regs {
7842e35d2fSJayanth Dodderi Chidanand 	uint64_t pire0_el1;
7942e35d2fSJayanth Dodderi Chidanand 	uint64_t pir_el1;
8042e35d2fSJayanth Dodderi Chidanand } el1_s1pie_regs_t;
8142e35d2fSJayanth Dodderi Chidanand 
8242e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1poe_regs {
8342e35d2fSJayanth Dodderi Chidanand 	uint64_t por_el1;
8442e35d2fSJayanth Dodderi Chidanand } el1_s1poe_regs_t;
8542e35d2fSJayanth Dodderi Chidanand 
8642e35d2fSJayanth Dodderi Chidanand typedef struct el1_s2poe_regs {
8742e35d2fSJayanth Dodderi Chidanand 	uint64_t s2por_el1;
8842e35d2fSJayanth Dodderi Chidanand } el1_s2poe_regs_t;
8942e35d2fSJayanth Dodderi Chidanand 
9042e35d2fSJayanth Dodderi Chidanand typedef struct el1_tcr2_regs {
9142e35d2fSJayanth Dodderi Chidanand 	uint64_t tcr2_el1;
9242e35d2fSJayanth Dodderi Chidanand } el1_tcr2_regs_t;
9342e35d2fSJayanth Dodderi Chidanand 
9442e35d2fSJayanth Dodderi Chidanand typedef struct el1_trf_regs {
9542e35d2fSJayanth Dodderi Chidanand 	uint64_t trfcr_el1;
9642e35d2fSJayanth Dodderi Chidanand } el1_trf_regs_t;
9742e35d2fSJayanth Dodderi Chidanand 
9842e35d2fSJayanth Dodderi Chidanand typedef struct el1_csv2_2_regs {
9942e35d2fSJayanth Dodderi Chidanand 	uint64_t scxtnum_el0;
10042e35d2fSJayanth Dodderi Chidanand 	uint64_t scxtnum_el1;
10142e35d2fSJayanth Dodderi Chidanand } el1_csv2_2_regs_t;
10242e35d2fSJayanth Dodderi Chidanand 
10342e35d2fSJayanth Dodderi Chidanand typedef struct el1_gcs_regs {
10442e35d2fSJayanth Dodderi Chidanand 	uint64_t gcscr_el1;
10542e35d2fSJayanth Dodderi Chidanand 	uint64_t gcscre0_el1;
10642e35d2fSJayanth Dodderi Chidanand 	uint64_t gcspr_el1;
10742e35d2fSJayanth Dodderi Chidanand 	uint64_t gcspr_el0;
10842e35d2fSJayanth Dodderi Chidanand } el1_gcs_regs_t;
10942e35d2fSJayanth Dodderi Chidanand 
110*6d0433f0SJayanth Dodderi Chidanand typedef struct el1_the_regs {
111*6d0433f0SJayanth Dodderi Chidanand 	uint64_t rcwmask_el1;
112*6d0433f0SJayanth Dodderi Chidanand 	uint64_t rcwsmask_el1;
113*6d0433f0SJayanth Dodderi Chidanand } el1_the_regs_t;
114*6d0433f0SJayanth Dodderi Chidanand 
11542e35d2fSJayanth Dodderi Chidanand typedef struct el1_sysregs {
11642e35d2fSJayanth Dodderi Chidanand 
11742e35d2fSJayanth Dodderi Chidanand 	el1_common_regs_t common;
11842e35d2fSJayanth Dodderi Chidanand 
11942e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS
12042e35d2fSJayanth Dodderi Chidanand 	el1_aarch32_regs_t el1_aarch32;
12142e35d2fSJayanth Dodderi Chidanand #endif
12242e35d2fSJayanth Dodderi Chidanand 
12342e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH
12442e35d2fSJayanth Dodderi Chidanand 	el1_arch_timer_regs_t arch_timer;
12542e35d2fSJayanth Dodderi Chidanand #endif
12642e35d2fSJayanth Dodderi Chidanand 
12742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2
12842e35d2fSJayanth Dodderi Chidanand 	el1_mte2_regs_t mte2;
12942e35d2fSJayanth Dodderi Chidanand #endif
13042e35d2fSJayanth Dodderi Chidanand 
13142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS
13242e35d2fSJayanth Dodderi Chidanand 	el1_ras_regs_t ras;
13342e35d2fSJayanth Dodderi Chidanand #endif
13442e35d2fSJayanth Dodderi Chidanand 
13542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE
13642e35d2fSJayanth Dodderi Chidanand 	el1_s1pie_regs_t s1pie;
13742e35d2fSJayanth Dodderi Chidanand #endif
13842e35d2fSJayanth Dodderi Chidanand 
13942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE
14042e35d2fSJayanth Dodderi Chidanand 	el1_s1poe_regs_t s1poe;
14142e35d2fSJayanth Dodderi Chidanand #endif
14242e35d2fSJayanth Dodderi Chidanand 
14342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE
14442e35d2fSJayanth Dodderi Chidanand 	el1_s2poe_regs_t s2poe;
14542e35d2fSJayanth Dodderi Chidanand #endif
14642e35d2fSJayanth Dodderi Chidanand 
14742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2
14842e35d2fSJayanth Dodderi Chidanand 	el1_tcr2_regs_t tcr2;
14942e35d2fSJayanth Dodderi Chidanand #endif
15042e35d2fSJayanth Dodderi Chidanand 
15142e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS
15242e35d2fSJayanth Dodderi Chidanand 	el1_trf_regs_t trf;
15342e35d2fSJayanth Dodderi Chidanand #endif
15442e35d2fSJayanth Dodderi Chidanand 
15542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2
15642e35d2fSJayanth Dodderi Chidanand 	el1_csv2_2_regs_t csv2_2;
15742e35d2fSJayanth Dodderi Chidanand #endif
15842e35d2fSJayanth Dodderi Chidanand 
15942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS
16042e35d2fSJayanth Dodderi Chidanand 	el1_gcs_regs_t gcs;
16142e35d2fSJayanth Dodderi Chidanand #endif
16242e35d2fSJayanth Dodderi Chidanand 
163*6d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE
164*6d0433f0SJayanth Dodderi Chidanand 	el1_the_regs_t the;
165*6d0433f0SJayanth Dodderi Chidanand #endif
166*6d0433f0SJayanth Dodderi Chidanand 
16742e35d2fSJayanth Dodderi Chidanand } el1_sysregs_t;
16842e35d2fSJayanth Dodderi Chidanand 
16942e35d2fSJayanth Dodderi Chidanand 
17042e35d2fSJayanth Dodderi Chidanand /*
17142e35d2fSJayanth Dodderi Chidanand  * Macros to access members related to individual features of the el1_sysregs_t
17242e35d2fSJayanth Dodderi Chidanand  * structures.
17342e35d2fSJayanth Dodderi Chidanand  */
17442e35d2fSJayanth Dodderi Chidanand 
17542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_common(ctx, reg)		(((ctx)->common).reg)
17642e35d2fSJayanth Dodderi Chidanand 
17742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_common(ctx, reg, val)	((((ctx)->common).reg)	\
17842e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
17942e35d2fSJayanth Dodderi Chidanand 
18042e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH
18142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg)		(((ctx)->arch_timer).reg)
18242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val)	((((ctx)->arch_timer).reg)	\
18342e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
18442e35d2fSJayanth Dodderi Chidanand #else
18542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg)		ULL(0)
18642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val)
18742e35d2fSJayanth Dodderi Chidanand #endif /* NS_TIMER_SWITCH */
18842e35d2fSJayanth Dodderi Chidanand 
18942e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS
19042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg)		(((ctx)->el1_aarch32).reg)
19142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val)	((((ctx)->el1_aarch32).reg)	\
19242e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
19342e35d2fSJayanth Dodderi Chidanand #else
19442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg)		ULL(0)
19542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val)
19642e35d2fSJayanth Dodderi Chidanand #endif /* CTX_INCLUDE_AARCH32_REGS */
19742e35d2fSJayanth Dodderi Chidanand 
19842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2
19942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg)		(((ctx)->mte2).reg)
20042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val)	((((ctx)->mte2).reg)	\
20142e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
20242e35d2fSJayanth Dodderi Chidanand #else
20342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg)		ULL(0)
20442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val)
20542e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_MTE2 */
20642e35d2fSJayanth Dodderi Chidanand 
20742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS
20842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg)		(((ctx)->ras).reg)
20942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val)	((((ctx)->ras).reg)	\
21042e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
21142e35d2fSJayanth Dodderi Chidanand #else
21242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg)		ULL(0)
21342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val)
21442e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_RAS */
21542e35d2fSJayanth Dodderi Chidanand 
21642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE
21742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg)		(((ctx)->s1pie).reg)
21842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val)	((((ctx)->s1pie).reg)	\
21942e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
22042e35d2fSJayanth Dodderi Chidanand #else
22142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg)		ULL(0)
22242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val)
22342e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1PIE */
22442e35d2fSJayanth Dodderi Chidanand 
22542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE
22642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg)		(((ctx)->s1poe).reg)
22742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val)	((((ctx)->s1poe).reg)	\
22842e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
22942e35d2fSJayanth Dodderi Chidanand #else
23042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg)		ULL(0)
23142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val)
23242e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1POE */
23342e35d2fSJayanth Dodderi Chidanand 
23442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE
23542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg)		(((ctx)->s2poe).reg)
23642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val)	((((ctx)->s2poe).reg)	\
23742e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
23842e35d2fSJayanth Dodderi Chidanand #else
23942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg)		ULL(0)
24042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val)
24142e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S2POE */
24242e35d2fSJayanth Dodderi Chidanand 
24342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2
24442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg)		(((ctx)->tcr2).reg)
24542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val)	((((ctx)->tcr2).reg)	\
24642e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
24742e35d2fSJayanth Dodderi Chidanand #else
24842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg)		ULL(0)
24942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val)
25042e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_TCR2 */
25142e35d2fSJayanth Dodderi Chidanand 
25242e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS
25342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg)		(((ctx)->trf).reg)
25442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val)	((((ctx)->trf).reg)	\
25542e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
25642e35d2fSJayanth Dodderi Chidanand #else
25742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg)		ULL(0)
25842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val)
25942e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_TRF_FOR_NS */
26042e35d2fSJayanth Dodderi Chidanand 
26142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2
26242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg)		(((ctx)->csv2_2).reg)
26342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val)	((((ctx)->csv2_2).reg)	\
26442e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
26542e35d2fSJayanth Dodderi Chidanand #else
26642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg)		ULL(0)
26742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val)
26842e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_CSV2_2 */
26942e35d2fSJayanth Dodderi Chidanand 
27042e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS
27142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg)		(((ctx)->gcs).reg)
27242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val)	((((ctx)->gcs).reg)	\
27342e35d2fSJayanth Dodderi Chidanand 							= (uint64_t) (val))
27442e35d2fSJayanth Dodderi Chidanand #else
27542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg)		ULL(0)
27642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val)
27742e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_GCS */
278*6d0433f0SJayanth Dodderi Chidanand 
279*6d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE
280*6d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg)		(((ctx)->the).reg)
281*6d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val)	((((ctx)->the).reg)	\
282*6d0433f0SJayanth Dodderi Chidanand 							= (uint64_t) (val))
283*6d0433f0SJayanth Dodderi Chidanand #else
284*6d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg)		ULL(0)
285*6d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val)
286*6d0433f0SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_THE */
287*6d0433f0SJayanth Dodderi Chidanand 
28842e35d2fSJayanth Dodderi Chidanand /******************************************************************************/
28942e35d2fSJayanth Dodderi Chidanand #endif /* __ASSEMBLER__ */
29042e35d2fSJayanth Dodderi Chidanand 
29142e35d2fSJayanth Dodderi Chidanand #endif /* CONTEXT_EL1_H */
292