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 1030655136SGovindraj Raja #include <lib/extensions/sysreg128.h> 1130655136SGovindraj 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; 4630655136SGovindraj Raja sysreg_t par_el1; 4730655136SGovindraj Raja sysreg_t ttbr0_el1; 4830655136SGovindraj 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 { 61*ccf67965SSumit Garg #if NS_TIMER_SWITCH 6242e35d2fSJayanth Dodderi Chidanand uint64_t cntp_ctl_el0; 6342e35d2fSJayanth Dodderi Chidanand uint64_t cntp_cval_el0; 6442e35d2fSJayanth Dodderi Chidanand uint64_t cntv_ctl_el0; 6542e35d2fSJayanth Dodderi Chidanand uint64_t cntv_cval_el0; 66*ccf67965SSumit Garg #endif 6742e35d2fSJayanth Dodderi Chidanand uint64_t cntkctl_el1; 6842e35d2fSJayanth Dodderi Chidanand } el1_arch_timer_regs_t; 6942e35d2fSJayanth Dodderi Chidanand 7042e35d2fSJayanth Dodderi Chidanand typedef struct el1_mte2_regs { 7142e35d2fSJayanth Dodderi Chidanand uint64_t tfsre0_el1; 7242e35d2fSJayanth Dodderi Chidanand uint64_t tfsr_el1; 7342e35d2fSJayanth Dodderi Chidanand uint64_t rgsr_el1; 7442e35d2fSJayanth Dodderi Chidanand uint64_t gcr_el1; 7542e35d2fSJayanth Dodderi Chidanand } el1_mte2_regs_t; 7642e35d2fSJayanth Dodderi Chidanand 7742e35d2fSJayanth Dodderi Chidanand typedef struct el1_ras_regs { 7842e35d2fSJayanth Dodderi Chidanand uint64_t disr_el1; 7942e35d2fSJayanth Dodderi Chidanand } el1_ras_regs_t; 8042e35d2fSJayanth Dodderi Chidanand 8142e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1pie_regs { 8242e35d2fSJayanth Dodderi Chidanand uint64_t pire0_el1; 8342e35d2fSJayanth Dodderi Chidanand uint64_t pir_el1; 8442e35d2fSJayanth Dodderi Chidanand } el1_s1pie_regs_t; 8542e35d2fSJayanth Dodderi Chidanand 8642e35d2fSJayanth Dodderi Chidanand typedef struct el1_s1poe_regs { 8742e35d2fSJayanth Dodderi Chidanand uint64_t por_el1; 8842e35d2fSJayanth Dodderi Chidanand } el1_s1poe_regs_t; 8942e35d2fSJayanth Dodderi Chidanand 9042e35d2fSJayanth Dodderi Chidanand typedef struct el1_s2poe_regs { 9142e35d2fSJayanth Dodderi Chidanand uint64_t s2por_el1; 9242e35d2fSJayanth Dodderi Chidanand } el1_s2poe_regs_t; 9342e35d2fSJayanth Dodderi Chidanand 9442e35d2fSJayanth Dodderi Chidanand typedef struct el1_tcr2_regs { 9542e35d2fSJayanth Dodderi Chidanand uint64_t tcr2_el1; 9642e35d2fSJayanth Dodderi Chidanand } el1_tcr2_regs_t; 9742e35d2fSJayanth Dodderi Chidanand 9842e35d2fSJayanth Dodderi Chidanand typedef struct el1_trf_regs { 9942e35d2fSJayanth Dodderi Chidanand uint64_t trfcr_el1; 10042e35d2fSJayanth Dodderi Chidanand } el1_trf_regs_t; 10142e35d2fSJayanth Dodderi Chidanand 10242e35d2fSJayanth Dodderi Chidanand typedef struct el1_csv2_2_regs { 10342e35d2fSJayanth Dodderi Chidanand uint64_t scxtnum_el0; 10442e35d2fSJayanth Dodderi Chidanand uint64_t scxtnum_el1; 10542e35d2fSJayanth Dodderi Chidanand } el1_csv2_2_regs_t; 10642e35d2fSJayanth Dodderi Chidanand 10742e35d2fSJayanth Dodderi Chidanand typedef struct el1_gcs_regs { 10842e35d2fSJayanth Dodderi Chidanand uint64_t gcscr_el1; 10942e35d2fSJayanth Dodderi Chidanand uint64_t gcscre0_el1; 11042e35d2fSJayanth Dodderi Chidanand uint64_t gcspr_el1; 11142e35d2fSJayanth Dodderi Chidanand uint64_t gcspr_el0; 11242e35d2fSJayanth Dodderi Chidanand } el1_gcs_regs_t; 11342e35d2fSJayanth Dodderi Chidanand 1146d0433f0SJayanth Dodderi Chidanand typedef struct el1_the_regs { 11530655136SGovindraj Raja sysreg_t rcwmask_el1; 11630655136SGovindraj Raja sysreg_t rcwsmask_el1; 1176d0433f0SJayanth Dodderi Chidanand } el1_the_regs_t; 1186d0433f0SJayanth Dodderi Chidanand 1194ec4e545SJayanth Dodderi Chidanand typedef struct el1_sctlr2_regs { 1204ec4e545SJayanth Dodderi Chidanand uint64_t sctlr2_el1; 1214ec4e545SJayanth Dodderi Chidanand } el1_sctlr2_regs_t; 1224ec4e545SJayanth Dodderi Chidanand 12319d52a83SAndre Przywara typedef struct el1_ls64_regs { 12419d52a83SAndre Przywara uint64_t accdata_el1; 12519d52a83SAndre Przywara } el1_ls64_regs_t; 12619d52a83SAndre Przywara 12742e35d2fSJayanth Dodderi Chidanand typedef struct el1_sysregs { 12842e35d2fSJayanth Dodderi Chidanand 12942e35d2fSJayanth Dodderi Chidanand el1_common_regs_t common; 130*ccf67965SSumit Garg el1_arch_timer_regs_t arch_timer; 13142e35d2fSJayanth Dodderi Chidanand 13242e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 13342e35d2fSJayanth Dodderi Chidanand el1_aarch32_regs_t el1_aarch32; 13442e35d2fSJayanth Dodderi Chidanand #endif 13542e35d2fSJayanth Dodderi Chidanand 13642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 13742e35d2fSJayanth Dodderi Chidanand el1_mte2_regs_t mte2; 13842e35d2fSJayanth Dodderi Chidanand #endif 13942e35d2fSJayanth Dodderi Chidanand 14042e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 14142e35d2fSJayanth Dodderi Chidanand el1_ras_regs_t ras; 14242e35d2fSJayanth Dodderi Chidanand #endif 14342e35d2fSJayanth Dodderi Chidanand 14442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 14542e35d2fSJayanth Dodderi Chidanand el1_s1pie_regs_t s1pie; 14642e35d2fSJayanth Dodderi Chidanand #endif 14742e35d2fSJayanth Dodderi Chidanand 14842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 14942e35d2fSJayanth Dodderi Chidanand el1_s1poe_regs_t s1poe; 15042e35d2fSJayanth Dodderi Chidanand #endif 15142e35d2fSJayanth Dodderi Chidanand 15242e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 15342e35d2fSJayanth Dodderi Chidanand el1_s2poe_regs_t s2poe; 15442e35d2fSJayanth Dodderi Chidanand #endif 15542e35d2fSJayanth Dodderi Chidanand 15642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 15742e35d2fSJayanth Dodderi Chidanand el1_tcr2_regs_t tcr2; 15842e35d2fSJayanth Dodderi Chidanand #endif 15942e35d2fSJayanth Dodderi Chidanand 16042e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 16142e35d2fSJayanth Dodderi Chidanand el1_trf_regs_t trf; 16242e35d2fSJayanth Dodderi Chidanand #endif 16342e35d2fSJayanth Dodderi Chidanand 16442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 16542e35d2fSJayanth Dodderi Chidanand el1_csv2_2_regs_t csv2_2; 16642e35d2fSJayanth Dodderi Chidanand #endif 16742e35d2fSJayanth Dodderi Chidanand 16842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 16942e35d2fSJayanth Dodderi Chidanand el1_gcs_regs_t gcs; 17042e35d2fSJayanth Dodderi Chidanand #endif 17142e35d2fSJayanth Dodderi Chidanand 1726d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 1736d0433f0SJayanth Dodderi Chidanand el1_the_regs_t the; 1746d0433f0SJayanth Dodderi Chidanand #endif 1756d0433f0SJayanth Dodderi Chidanand 1764ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 1774ec4e545SJayanth Dodderi Chidanand el1_sctlr2_regs_t sctlr2; 1784ec4e545SJayanth Dodderi Chidanand #endif 1794ec4e545SJayanth Dodderi Chidanand 18019d52a83SAndre Przywara #if ENABLE_FEAT_LS64_ACCDATA 18119d52a83SAndre Przywara el1_ls64_regs_t ls64; 18219d52a83SAndre Przywara #endif 18342e35d2fSJayanth Dodderi Chidanand } el1_sysregs_t; 18442e35d2fSJayanth Dodderi Chidanand 18542e35d2fSJayanth Dodderi Chidanand 18642e35d2fSJayanth Dodderi Chidanand /* 18742e35d2fSJayanth Dodderi Chidanand * Macros to access members related to individual features of the el1_sysregs_t 18842e35d2fSJayanth Dodderi Chidanand * structures. 18942e35d2fSJayanth Dodderi Chidanand */ 19042e35d2fSJayanth Dodderi Chidanand 19142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_common(ctx, reg) (((ctx)->common).reg) 19242e35d2fSJayanth Dodderi Chidanand 19342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_common(ctx, reg, val) ((((ctx)->common).reg) \ 19442e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 19542e35d2fSJayanth Dodderi Chidanand 1966595f4cbSIgor Podgainõi #define write_el1_ctx_common_sysreg128(ctx, reg, val) ((((ctx)->common).reg) \ 1976595f4cbSIgor Podgainõi = (sysreg_t) (val)) 1986595f4cbSIgor Podgainõi 19942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) (((ctx)->arch_timer).reg) 20042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) ((((ctx)->arch_timer).reg) \ 20142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 20242e35d2fSJayanth Dodderi Chidanand 20342e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 20442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) (((ctx)->el1_aarch32).reg) 20542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) ((((ctx)->el1_aarch32).reg) \ 20642e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 20742e35d2fSJayanth Dodderi Chidanand #else 20842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) ULL(0) 20942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) 21042e35d2fSJayanth Dodderi Chidanand #endif /* CTX_INCLUDE_AARCH32_REGS */ 21142e35d2fSJayanth Dodderi Chidanand 21242e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 21342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) (((ctx)->mte2).reg) 21442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) ((((ctx)->mte2).reg) \ 21542e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 21642e35d2fSJayanth Dodderi Chidanand #else 21742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) ULL(0) 21842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) 21942e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_MTE2 */ 22042e35d2fSJayanth Dodderi Chidanand 22142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 22242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) (((ctx)->ras).reg) 22342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) ((((ctx)->ras).reg) \ 22442e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 22542e35d2fSJayanth Dodderi Chidanand #else 22642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) ULL(0) 22742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) 22842e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_RAS */ 22942e35d2fSJayanth Dodderi Chidanand 23042e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 23142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) (((ctx)->s1pie).reg) 23242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) ((((ctx)->s1pie).reg) \ 23342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 23442e35d2fSJayanth Dodderi Chidanand #else 23542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) ULL(0) 23642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) 23742e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1PIE */ 23842e35d2fSJayanth Dodderi Chidanand 23942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 24042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) (((ctx)->s1poe).reg) 24142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) ((((ctx)->s1poe).reg) \ 24242e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 24342e35d2fSJayanth Dodderi Chidanand #else 24442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) ULL(0) 24542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) 24642e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1POE */ 24742e35d2fSJayanth Dodderi Chidanand 24842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 24942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) (((ctx)->s2poe).reg) 25042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) ((((ctx)->s2poe).reg) \ 25142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 25242e35d2fSJayanth Dodderi Chidanand #else 25342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) ULL(0) 25442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) 25542e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S2POE */ 25642e35d2fSJayanth Dodderi Chidanand 25742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 25842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) (((ctx)->tcr2).reg) 25942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) ((((ctx)->tcr2).reg) \ 26042e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 26142e35d2fSJayanth Dodderi Chidanand #else 26242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) ULL(0) 26342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) 26442e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_TCR2 */ 26542e35d2fSJayanth Dodderi Chidanand 26642e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 26742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) (((ctx)->trf).reg) 26842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) ((((ctx)->trf).reg) \ 26942e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 27042e35d2fSJayanth Dodderi Chidanand #else 27142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) ULL(0) 27242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) 27342e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_TRF_FOR_NS */ 27442e35d2fSJayanth Dodderi Chidanand 27542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 27642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) (((ctx)->csv2_2).reg) 27742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) ((((ctx)->csv2_2).reg) \ 27842e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 27942e35d2fSJayanth Dodderi Chidanand #else 28042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) ULL(0) 28142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) 28242e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_CSV2_2 */ 28342e35d2fSJayanth Dodderi Chidanand 28442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 28542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) (((ctx)->gcs).reg) 28642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) ((((ctx)->gcs).reg) \ 28742e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 28842e35d2fSJayanth Dodderi Chidanand #else 28942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) ULL(0) 29042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) 29142e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_GCS */ 2926d0433f0SJayanth Dodderi Chidanand 2936d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 2946d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) (((ctx)->the).reg) 2956595f4cbSIgor Podgainõi #define write_el1_ctx_the_sysreg128(ctx, reg, val) ((((ctx)->the).reg) \ 2966595f4cbSIgor Podgainõi = (sysreg_t) (val)) 2976d0433f0SJayanth Dodderi Chidanand #else 2986d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) ULL(0) 2996595f4cbSIgor Podgainõi #define write_el1_ctx_the_sysreg128(ctx, reg, val) 3006d0433f0SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_THE */ 3016d0433f0SJayanth Dodderi Chidanand 3024ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 3034ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) (((ctx)->sctlr2).reg) 3044ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) ((((ctx)->sctlr2).reg) \ 3054ec4e545SJayanth Dodderi Chidanand = (uint64_t) (val)) 3064ec4e545SJayanth Dodderi Chidanand #else 3074ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) ULL(0) 3084ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) 3094ec4e545SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_SCTLR2 */ 3104ec4e545SJayanth Dodderi Chidanand 31119d52a83SAndre Przywara #if ENABLE_FEAT_LS64_ACCDATA 31219d52a83SAndre Przywara #define read_el1_ctx_ls64(ctx, reg) (((ctx)->ls64).reg) 31319d52a83SAndre Przywara #define write_el1_ctx_ls64(ctx, reg, val) ((((ctx)->ls64).reg) \ 31419d52a83SAndre Przywara = (uint64_t) (val)) 31519d52a83SAndre Przywara #else 31619d52a83SAndre Przywara #define read_el1_ctx_ls64(ctx, reg) ULL(0) 31719d52a83SAndre Przywara #define write_el1_ctx_ls64(ctx, reg, val) 31819d52a83SAndre Przywara #endif /* ENABLE_FEAT_LS64_ACCDATA */ 31942e35d2fSJayanth Dodderi Chidanand /******************************************************************************/ 32042e35d2fSJayanth Dodderi Chidanand #endif /* __ASSEMBLER__ */ 32142e35d2fSJayanth Dodderi Chidanand 32242e35d2fSJayanth Dodderi Chidanand #endif /* CONTEXT_EL1_H */ 323