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 10*30655136SGovindraj Raja #include <lib/extensions/sysreg128.h> 11*30655136SGovindraj Raja 1242e35d2fSJayanth Dodderi Chidanand #ifndef __ASSEMBLER__ 1342e35d2fSJayanth Dodderi Chidanand 1442e35d2fSJayanth Dodderi Chidanand /******************************************************************************* 1542e35d2fSJayanth Dodderi Chidanand * EL1 Registers: 1642e35d2fSJayanth Dodderi Chidanand * AArch64 EL1 system register context structure for preserving the 1742e35d2fSJayanth Dodderi Chidanand * architectural state during world switches. 1842e35d2fSJayanth Dodderi Chidanand ******************************************************************************/ 1942e35d2fSJayanth Dodderi Chidanand 2042e35d2fSJayanth Dodderi Chidanand typedef struct el1_common_regs { 2142e35d2fSJayanth Dodderi Chidanand uint64_t spsr_el1; 2242e35d2fSJayanth Dodderi Chidanand uint64_t elr_el1; 2342e35d2fSJayanth Dodderi Chidanand 2442e35d2fSJayanth Dodderi Chidanand #if (!ERRATA_SPECULATIVE_AT) 2542e35d2fSJayanth Dodderi Chidanand uint64_t sctlr_el1; 2642e35d2fSJayanth Dodderi Chidanand uint64_t tcr_el1; 2742e35d2fSJayanth Dodderi Chidanand #endif /* ERRATA_SPECULATIVE_AT=0 */ 2842e35d2fSJayanth Dodderi Chidanand 2942e35d2fSJayanth Dodderi Chidanand uint64_t cpacr_el1; 3042e35d2fSJayanth Dodderi Chidanand uint64_t csselr_el1; 3142e35d2fSJayanth Dodderi Chidanand uint64_t sp_el1; 3242e35d2fSJayanth Dodderi Chidanand uint64_t esr_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 far_el1; 4042e35d2fSJayanth Dodderi Chidanand uint64_t afsr0_el1; 4142e35d2fSJayanth Dodderi Chidanand uint64_t afsr1_el1; 4242e35d2fSJayanth Dodderi Chidanand uint64_t contextidr_el1; 4342e35d2fSJayanth Dodderi Chidanand uint64_t vbar_el1; 4442e35d2fSJayanth Dodderi Chidanand uint64_t mdccint_el1; 4542e35d2fSJayanth Dodderi Chidanand uint64_t mdscr_el1; 46*30655136SGovindraj Raja sysreg_t par_el1; 47*30655136SGovindraj Raja sysreg_t ttbr0_el1; 48*30655136SGovindraj Raja sysreg_t ttbr1_el1; 4942e35d2fSJayanth Dodderi Chidanand } el1_common_regs_t; 5042e35d2fSJayanth Dodderi Chidanand 5142e35d2fSJayanth Dodderi Chidanand typedef struct el1_aarch32_regs { 5242e35d2fSJayanth Dodderi Chidanand uint64_t spsr_abt; 5342e35d2fSJayanth Dodderi Chidanand uint64_t spsr_und; 5442e35d2fSJayanth Dodderi Chidanand uint64_t spsr_irq; 5542e35d2fSJayanth Dodderi Chidanand uint64_t spsr_fiq; 5642e35d2fSJayanth Dodderi Chidanand uint64_t dacr32_el2; 5742e35d2fSJayanth Dodderi Chidanand uint64_t ifsr32_el2; 5842e35d2fSJayanth Dodderi Chidanand } el1_aarch32_regs_t; 5942e35d2fSJayanth Dodderi Chidanand 6042e35d2fSJayanth Dodderi Chidanand typedef struct el1_arch_timer_regs { 6142e35d2fSJayanth Dodderi Chidanand uint64_t cntp_ctl_el0; 6242e35d2fSJayanth Dodderi Chidanand uint64_t cntp_cval_el0; 6342e35d2fSJayanth Dodderi Chidanand uint64_t cntv_ctl_el0; 6442e35d2fSJayanth Dodderi Chidanand uint64_t cntv_cval_el0; 6542e35d2fSJayanth Dodderi Chidanand uint64_t cntkctl_el1; 6642e35d2fSJayanth Dodderi Chidanand } el1_arch_timer_regs_t; 6742e35d2fSJayanth Dodderi Chidanand 6842e35d2fSJayanth Dodderi Chidanand typedef struct el1_mte2_regs { 6942e35d2fSJayanth Dodderi Chidanand uint64_t tfsre0_el1; 7042e35d2fSJayanth Dodderi Chidanand uint64_t tfsr_el1; 7142e35d2fSJayanth Dodderi Chidanand uint64_t rgsr_el1; 7242e35d2fSJayanth Dodderi Chidanand uint64_t gcr_el1; 7342e35d2fSJayanth Dodderi Chidanand } el1_mte2_regs_t; 7442e35d2fSJayanth Dodderi Chidanand 7542e35d2fSJayanth Dodderi Chidanand typedef struct el1_ras_regs { 7642e35d2fSJayanth Dodderi Chidanand uint64_t disr_el1; 7742e35d2fSJayanth Dodderi Chidanand } el1_ras_regs_t; 7842e35d2fSJayanth Dodderi Chidanand 7942e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1pie_regs { 8042e35d2fSJayanth Dodderi Chidanand uint64_t pire0_el1; 8142e35d2fSJayanth Dodderi Chidanand uint64_t pir_el1; 8242e35d2fSJayanth Dodderi Chidanand } el1_s1pie_regs_t; 8342e35d2fSJayanth Dodderi Chidanand 8442e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1poe_regs { 8542e35d2fSJayanth Dodderi Chidanand uint64_t por_el1; 8642e35d2fSJayanth Dodderi Chidanand } el1_s1poe_regs_t; 8742e35d2fSJayanth Dodderi Chidanand 8842e35d2fSJayanth Dodderi Chidanand typedef struct el1_s2poe_regs { 8942e35d2fSJayanth Dodderi Chidanand uint64_t s2por_el1; 9042e35d2fSJayanth Dodderi Chidanand } el1_s2poe_regs_t; 9142e35d2fSJayanth Dodderi Chidanand 9242e35d2fSJayanth Dodderi Chidanand typedef struct el1_tcr2_regs { 9342e35d2fSJayanth Dodderi Chidanand uint64_t tcr2_el1; 9442e35d2fSJayanth Dodderi Chidanand } el1_tcr2_regs_t; 9542e35d2fSJayanth Dodderi Chidanand 9642e35d2fSJayanth Dodderi Chidanand typedef struct el1_trf_regs { 9742e35d2fSJayanth Dodderi Chidanand uint64_t trfcr_el1; 9842e35d2fSJayanth Dodderi Chidanand } el1_trf_regs_t; 9942e35d2fSJayanth Dodderi Chidanand 10042e35d2fSJayanth Dodderi Chidanand typedef struct el1_csv2_2_regs { 10142e35d2fSJayanth Dodderi Chidanand uint64_t scxtnum_el0; 10242e35d2fSJayanth Dodderi Chidanand uint64_t scxtnum_el1; 10342e35d2fSJayanth Dodderi Chidanand } el1_csv2_2_regs_t; 10442e35d2fSJayanth Dodderi Chidanand 10542e35d2fSJayanth Dodderi Chidanand typedef struct el1_gcs_regs { 10642e35d2fSJayanth Dodderi Chidanand uint64_t gcscr_el1; 10742e35d2fSJayanth Dodderi Chidanand uint64_t gcscre0_el1; 10842e35d2fSJayanth Dodderi Chidanand uint64_t gcspr_el1; 10942e35d2fSJayanth Dodderi Chidanand uint64_t gcspr_el0; 11042e35d2fSJayanth Dodderi Chidanand } el1_gcs_regs_t; 11142e35d2fSJayanth Dodderi Chidanand 1126d0433f0SJayanth Dodderi Chidanand typedef struct el1_the_regs { 113*30655136SGovindraj Raja sysreg_t rcwmask_el1; 114*30655136SGovindraj Raja sysreg_t rcwsmask_el1; 1156d0433f0SJayanth Dodderi Chidanand } el1_the_regs_t; 1166d0433f0SJayanth Dodderi Chidanand 1174ec4e545SJayanth Dodderi Chidanand typedef struct el1_sctlr2_regs { 1184ec4e545SJayanth Dodderi Chidanand uint64_t sctlr2_el1; 1194ec4e545SJayanth Dodderi Chidanand } el1_sctlr2_regs_t; 1204ec4e545SJayanth Dodderi Chidanand 12142e35d2fSJayanth Dodderi Chidanand typedef struct el1_sysregs { 12242e35d2fSJayanth Dodderi Chidanand 12342e35d2fSJayanth Dodderi Chidanand el1_common_regs_t common; 12442e35d2fSJayanth Dodderi Chidanand 12542e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 12642e35d2fSJayanth Dodderi Chidanand el1_aarch32_regs_t el1_aarch32; 12742e35d2fSJayanth Dodderi Chidanand #endif 12842e35d2fSJayanth Dodderi Chidanand 12942e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 13042e35d2fSJayanth Dodderi Chidanand el1_arch_timer_regs_t arch_timer; 13142e35d2fSJayanth Dodderi Chidanand #endif 13242e35d2fSJayanth Dodderi Chidanand 13342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 13442e35d2fSJayanth Dodderi Chidanand el1_mte2_regs_t mte2; 13542e35d2fSJayanth Dodderi Chidanand #endif 13642e35d2fSJayanth Dodderi Chidanand 13742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 13842e35d2fSJayanth Dodderi Chidanand el1_ras_regs_t ras; 13942e35d2fSJayanth Dodderi Chidanand #endif 14042e35d2fSJayanth Dodderi Chidanand 14142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 14242e35d2fSJayanth Dodderi Chidanand el1_s1pie_regs_t s1pie; 14342e35d2fSJayanth Dodderi Chidanand #endif 14442e35d2fSJayanth Dodderi Chidanand 14542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 14642e35d2fSJayanth Dodderi Chidanand el1_s1poe_regs_t s1poe; 14742e35d2fSJayanth Dodderi Chidanand #endif 14842e35d2fSJayanth Dodderi Chidanand 14942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 15042e35d2fSJayanth Dodderi Chidanand el1_s2poe_regs_t s2poe; 15142e35d2fSJayanth Dodderi Chidanand #endif 15242e35d2fSJayanth Dodderi Chidanand 15342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 15442e35d2fSJayanth Dodderi Chidanand el1_tcr2_regs_t tcr2; 15542e35d2fSJayanth Dodderi Chidanand #endif 15642e35d2fSJayanth Dodderi Chidanand 15742e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 15842e35d2fSJayanth Dodderi Chidanand el1_trf_regs_t trf; 15942e35d2fSJayanth Dodderi Chidanand #endif 16042e35d2fSJayanth Dodderi Chidanand 16142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 16242e35d2fSJayanth Dodderi Chidanand el1_csv2_2_regs_t csv2_2; 16342e35d2fSJayanth Dodderi Chidanand #endif 16442e35d2fSJayanth Dodderi Chidanand 16542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 16642e35d2fSJayanth Dodderi Chidanand el1_gcs_regs_t gcs; 16742e35d2fSJayanth Dodderi Chidanand #endif 16842e35d2fSJayanth Dodderi Chidanand 1696d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 1706d0433f0SJayanth Dodderi Chidanand el1_the_regs_t the; 1716d0433f0SJayanth Dodderi Chidanand #endif 1726d0433f0SJayanth Dodderi Chidanand 1734ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 1744ec4e545SJayanth Dodderi Chidanand el1_sctlr2_regs_t sctlr2; 1754ec4e545SJayanth Dodderi Chidanand #endif 1764ec4e545SJayanth Dodderi Chidanand 17742e35d2fSJayanth Dodderi Chidanand } el1_sysregs_t; 17842e35d2fSJayanth Dodderi Chidanand 17942e35d2fSJayanth Dodderi Chidanand 18042e35d2fSJayanth Dodderi Chidanand /* 18142e35d2fSJayanth Dodderi Chidanand * Macros to access members related to individual features of the el1_sysregs_t 18242e35d2fSJayanth Dodderi Chidanand * structures. 18342e35d2fSJayanth Dodderi Chidanand */ 18442e35d2fSJayanth Dodderi Chidanand 18542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_common(ctx, reg) (((ctx)->common).reg) 18642e35d2fSJayanth Dodderi Chidanand 18742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_common(ctx, reg, val) ((((ctx)->common).reg) \ 18842e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 18942e35d2fSJayanth Dodderi Chidanand 19042e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 19142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) (((ctx)->arch_timer).reg) 19242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) ((((ctx)->arch_timer).reg) \ 19342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 19442e35d2fSJayanth Dodderi Chidanand #else 19542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) ULL(0) 19642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) 19742e35d2fSJayanth Dodderi Chidanand #endif /* NS_TIMER_SWITCH */ 19842e35d2fSJayanth Dodderi Chidanand 19942e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 20042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) (((ctx)->el1_aarch32).reg) 20142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) ((((ctx)->el1_aarch32).reg) \ 20242e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 20342e35d2fSJayanth Dodderi Chidanand #else 20442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) ULL(0) 20542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) 20642e35d2fSJayanth Dodderi Chidanand #endif /* CTX_INCLUDE_AARCH32_REGS */ 20742e35d2fSJayanth Dodderi Chidanand 20842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 20942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) (((ctx)->mte2).reg) 21042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) ((((ctx)->mte2).reg) \ 21142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 21242e35d2fSJayanth Dodderi Chidanand #else 21342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) ULL(0) 21442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) 21542e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_MTE2 */ 21642e35d2fSJayanth Dodderi Chidanand 21742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 21842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) (((ctx)->ras).reg) 21942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) ((((ctx)->ras).reg) \ 22042e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 22142e35d2fSJayanth Dodderi Chidanand #else 22242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) ULL(0) 22342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) 22442e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_RAS */ 22542e35d2fSJayanth Dodderi Chidanand 22642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 22742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) (((ctx)->s1pie).reg) 22842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) ((((ctx)->s1pie).reg) \ 22942e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 23042e35d2fSJayanth Dodderi Chidanand #else 23142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) ULL(0) 23242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) 23342e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1PIE */ 23442e35d2fSJayanth Dodderi Chidanand 23542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 23642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) (((ctx)->s1poe).reg) 23742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) ((((ctx)->s1poe).reg) \ 23842e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 23942e35d2fSJayanth Dodderi Chidanand #else 24042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) ULL(0) 24142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) 24242e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1POE */ 24342e35d2fSJayanth Dodderi Chidanand 24442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 24542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) (((ctx)->s2poe).reg) 24642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) ((((ctx)->s2poe).reg) \ 24742e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 24842e35d2fSJayanth Dodderi Chidanand #else 24942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) ULL(0) 25042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) 25142e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S2POE */ 25242e35d2fSJayanth Dodderi Chidanand 25342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 25442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) (((ctx)->tcr2).reg) 25542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) ((((ctx)->tcr2).reg) \ 25642e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 25742e35d2fSJayanth Dodderi Chidanand #else 25842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) ULL(0) 25942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) 26042e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_TCR2 */ 26142e35d2fSJayanth Dodderi Chidanand 26242e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 26342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) (((ctx)->trf).reg) 26442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) ((((ctx)->trf).reg) \ 26542e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 26642e35d2fSJayanth Dodderi Chidanand #else 26742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) ULL(0) 26842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) 26942e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_TRF_FOR_NS */ 27042e35d2fSJayanth Dodderi Chidanand 27142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 27242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) (((ctx)->csv2_2).reg) 27342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) ((((ctx)->csv2_2).reg) \ 27442e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 27542e35d2fSJayanth Dodderi Chidanand #else 27642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) ULL(0) 27742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) 27842e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_CSV2_2 */ 27942e35d2fSJayanth Dodderi Chidanand 28042e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 28142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) (((ctx)->gcs).reg) 28242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) ((((ctx)->gcs).reg) \ 28342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 28442e35d2fSJayanth Dodderi Chidanand #else 28542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) ULL(0) 28642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) 28742e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_GCS */ 2886d0433f0SJayanth Dodderi Chidanand 2896d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 2906d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) (((ctx)->the).reg) 2916d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val) ((((ctx)->the).reg) \ 2926d0433f0SJayanth Dodderi Chidanand = (uint64_t) (val)) 2936d0433f0SJayanth Dodderi Chidanand #else 2946d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) ULL(0) 2956d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val) 2966d0433f0SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_THE */ 2976d0433f0SJayanth Dodderi Chidanand 2984ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 2994ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) (((ctx)->sctlr2).reg) 3004ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) ((((ctx)->sctlr2).reg) \ 3014ec4e545SJayanth Dodderi Chidanand = (uint64_t) (val)) 3024ec4e545SJayanth Dodderi Chidanand #else 3034ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) ULL(0) 3044ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) 3054ec4e545SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_SCTLR2 */ 3064ec4e545SJayanth Dodderi Chidanand 30742e35d2fSJayanth Dodderi Chidanand /******************************************************************************/ 30842e35d2fSJayanth Dodderi Chidanand #endif /* __ASSEMBLER__ */ 30942e35d2fSJayanth Dodderi Chidanand 31042e35d2fSJayanth Dodderi Chidanand #endif /* CONTEXT_EL1_H */ 311