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 1106d0433f0SJayanth Dodderi Chidanand typedef struct el1_the_regs { 1116d0433f0SJayanth Dodderi Chidanand uint64_t rcwmask_el1; 1126d0433f0SJayanth Dodderi Chidanand uint64_t rcwsmask_el1; 1136d0433f0SJayanth Dodderi Chidanand } el1_the_regs_t; 1146d0433f0SJayanth Dodderi Chidanand 115*4ec4e545SJayanth Dodderi Chidanand typedef struct el1_sctlr2_regs { 116*4ec4e545SJayanth Dodderi Chidanand uint64_t sctlr2_el1; 117*4ec4e545SJayanth Dodderi Chidanand } el1_sctlr2_regs_t; 118*4ec4e545SJayanth Dodderi Chidanand 11942e35d2fSJayanth Dodderi Chidanand typedef struct el1_sysregs { 12042e35d2fSJayanth Dodderi Chidanand 12142e35d2fSJayanth Dodderi Chidanand el1_common_regs_t common; 12242e35d2fSJayanth Dodderi Chidanand 12342e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 12442e35d2fSJayanth Dodderi Chidanand el1_aarch32_regs_t el1_aarch32; 12542e35d2fSJayanth Dodderi Chidanand #endif 12642e35d2fSJayanth Dodderi Chidanand 12742e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 12842e35d2fSJayanth Dodderi Chidanand el1_arch_timer_regs_t arch_timer; 12942e35d2fSJayanth Dodderi Chidanand #endif 13042e35d2fSJayanth Dodderi Chidanand 13142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 13242e35d2fSJayanth Dodderi Chidanand el1_mte2_regs_t mte2; 13342e35d2fSJayanth Dodderi Chidanand #endif 13442e35d2fSJayanth Dodderi Chidanand 13542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 13642e35d2fSJayanth Dodderi Chidanand el1_ras_regs_t ras; 13742e35d2fSJayanth Dodderi Chidanand #endif 13842e35d2fSJayanth Dodderi Chidanand 13942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 14042e35d2fSJayanth Dodderi Chidanand el1_s1pie_regs_t s1pie; 14142e35d2fSJayanth Dodderi Chidanand #endif 14242e35d2fSJayanth Dodderi Chidanand 14342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 14442e35d2fSJayanth Dodderi Chidanand el1_s1poe_regs_t s1poe; 14542e35d2fSJayanth Dodderi Chidanand #endif 14642e35d2fSJayanth Dodderi Chidanand 14742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 14842e35d2fSJayanth Dodderi Chidanand el1_s2poe_regs_t s2poe; 14942e35d2fSJayanth Dodderi Chidanand #endif 15042e35d2fSJayanth Dodderi Chidanand 15142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 15242e35d2fSJayanth Dodderi Chidanand el1_tcr2_regs_t tcr2; 15342e35d2fSJayanth Dodderi Chidanand #endif 15442e35d2fSJayanth Dodderi Chidanand 15542e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 15642e35d2fSJayanth Dodderi Chidanand el1_trf_regs_t trf; 15742e35d2fSJayanth Dodderi Chidanand #endif 15842e35d2fSJayanth Dodderi Chidanand 15942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 16042e35d2fSJayanth Dodderi Chidanand el1_csv2_2_regs_t csv2_2; 16142e35d2fSJayanth Dodderi Chidanand #endif 16242e35d2fSJayanth Dodderi Chidanand 16342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 16442e35d2fSJayanth Dodderi Chidanand el1_gcs_regs_t gcs; 16542e35d2fSJayanth Dodderi Chidanand #endif 16642e35d2fSJayanth Dodderi Chidanand 1676d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 1686d0433f0SJayanth Dodderi Chidanand el1_the_regs_t the; 1696d0433f0SJayanth Dodderi Chidanand #endif 1706d0433f0SJayanth Dodderi Chidanand 171*4ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 172*4ec4e545SJayanth Dodderi Chidanand el1_sctlr2_regs_t sctlr2; 173*4ec4e545SJayanth Dodderi Chidanand #endif 174*4ec4e545SJayanth Dodderi Chidanand 17542e35d2fSJayanth Dodderi Chidanand } el1_sysregs_t; 17642e35d2fSJayanth Dodderi Chidanand 17742e35d2fSJayanth Dodderi Chidanand 17842e35d2fSJayanth Dodderi Chidanand /* 17942e35d2fSJayanth Dodderi Chidanand * Macros to access members related to individual features of the el1_sysregs_t 18042e35d2fSJayanth Dodderi Chidanand * structures. 18142e35d2fSJayanth Dodderi Chidanand */ 18242e35d2fSJayanth Dodderi Chidanand 18342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_common(ctx, reg) (((ctx)->common).reg) 18442e35d2fSJayanth Dodderi Chidanand 18542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_common(ctx, reg, val) ((((ctx)->common).reg) \ 18642e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 18742e35d2fSJayanth Dodderi Chidanand 18842e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 18942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) (((ctx)->arch_timer).reg) 19042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) ((((ctx)->arch_timer).reg) \ 19142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 19242e35d2fSJayanth Dodderi Chidanand #else 19342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) ULL(0) 19442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) 19542e35d2fSJayanth Dodderi Chidanand #endif /* NS_TIMER_SWITCH */ 19642e35d2fSJayanth Dodderi Chidanand 19742e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 19842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) (((ctx)->el1_aarch32).reg) 19942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) ((((ctx)->el1_aarch32).reg) \ 20042e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 20142e35d2fSJayanth Dodderi Chidanand #else 20242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) ULL(0) 20342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) 20442e35d2fSJayanth Dodderi Chidanand #endif /* CTX_INCLUDE_AARCH32_REGS */ 20542e35d2fSJayanth Dodderi Chidanand 20642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 20742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) (((ctx)->mte2).reg) 20842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) ((((ctx)->mte2).reg) \ 20942e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 21042e35d2fSJayanth Dodderi Chidanand #else 21142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) ULL(0) 21242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) 21342e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_MTE2 */ 21442e35d2fSJayanth Dodderi Chidanand 21542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 21642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) (((ctx)->ras).reg) 21742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) ((((ctx)->ras).reg) \ 21842e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 21942e35d2fSJayanth Dodderi Chidanand #else 22042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) ULL(0) 22142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) 22242e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_RAS */ 22342e35d2fSJayanth Dodderi Chidanand 22442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 22542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) (((ctx)->s1pie).reg) 22642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) ((((ctx)->s1pie).reg) \ 22742e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 22842e35d2fSJayanth Dodderi Chidanand #else 22942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) ULL(0) 23042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) 23142e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1PIE */ 23242e35d2fSJayanth Dodderi Chidanand 23342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 23442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) (((ctx)->s1poe).reg) 23542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) ((((ctx)->s1poe).reg) \ 23642e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 23742e35d2fSJayanth Dodderi Chidanand #else 23842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) ULL(0) 23942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) 24042e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1POE */ 24142e35d2fSJayanth Dodderi Chidanand 24242e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 24342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) (((ctx)->s2poe).reg) 24442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) ((((ctx)->s2poe).reg) \ 24542e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 24642e35d2fSJayanth Dodderi Chidanand #else 24742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) ULL(0) 24842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) 24942e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S2POE */ 25042e35d2fSJayanth Dodderi Chidanand 25142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 25242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) (((ctx)->tcr2).reg) 25342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) ((((ctx)->tcr2).reg) \ 25442e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 25542e35d2fSJayanth Dodderi Chidanand #else 25642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) ULL(0) 25742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) 25842e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_TCR2 */ 25942e35d2fSJayanth Dodderi Chidanand 26042e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 26142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) (((ctx)->trf).reg) 26242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) ((((ctx)->trf).reg) \ 26342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 26442e35d2fSJayanth Dodderi Chidanand #else 26542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) ULL(0) 26642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) 26742e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_TRF_FOR_NS */ 26842e35d2fSJayanth Dodderi Chidanand 26942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 27042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) (((ctx)->csv2_2).reg) 27142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) ((((ctx)->csv2_2).reg) \ 27242e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 27342e35d2fSJayanth Dodderi Chidanand #else 27442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) ULL(0) 27542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) 27642e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_CSV2_2 */ 27742e35d2fSJayanth Dodderi Chidanand 27842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 27942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) (((ctx)->gcs).reg) 28042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) ((((ctx)->gcs).reg) \ 28142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 28242e35d2fSJayanth Dodderi Chidanand #else 28342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) ULL(0) 28442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) 28542e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_GCS */ 2866d0433f0SJayanth Dodderi Chidanand 2876d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 2886d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) (((ctx)->the).reg) 2896d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val) ((((ctx)->the).reg) \ 2906d0433f0SJayanth Dodderi Chidanand = (uint64_t) (val)) 2916d0433f0SJayanth Dodderi Chidanand #else 2926d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) ULL(0) 2936d0433f0SJayanth Dodderi Chidanand #define write_el1_ctx_the(ctx, reg, val) 2946d0433f0SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_THE */ 2956d0433f0SJayanth Dodderi Chidanand 296*4ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 297*4ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) (((ctx)->sctlr2).reg) 298*4ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) ((((ctx)->sctlr2).reg) \ 299*4ec4e545SJayanth Dodderi Chidanand = (uint64_t) (val)) 300*4ec4e545SJayanth Dodderi Chidanand #else 301*4ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) ULL(0) 302*4ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) 303*4ec4e545SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_SCTLR2 */ 304*4ec4e545SJayanth Dodderi Chidanand 30542e35d2fSJayanth Dodderi Chidanand /******************************************************************************/ 30642e35d2fSJayanth Dodderi Chidanand #endif /* __ASSEMBLER__ */ 30742e35d2fSJayanth Dodderi Chidanand 30842e35d2fSJayanth Dodderi Chidanand #endif /* CONTEXT_EL1_H */ 309