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 { 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 { 11330655136SGovindraj Raja sysreg_t rcwmask_el1; 11430655136SGovindraj 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 12119d52a83SAndre Przywara typedef struct el1_ls64_regs { 12219d52a83SAndre Przywara uint64_t accdata_el1; 12319d52a83SAndre Przywara } el1_ls64_regs_t; 12419d52a83SAndre Przywara 12542e35d2fSJayanth Dodderi Chidanand typedef struct el1_sysregs { 12642e35d2fSJayanth Dodderi Chidanand 12742e35d2fSJayanth Dodderi Chidanand el1_common_regs_t common; 12842e35d2fSJayanth Dodderi Chidanand 12942e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 13042e35d2fSJayanth Dodderi Chidanand el1_aarch32_regs_t el1_aarch32; 13142e35d2fSJayanth Dodderi Chidanand #endif 13242e35d2fSJayanth Dodderi Chidanand 13342e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 13442e35d2fSJayanth Dodderi Chidanand el1_arch_timer_regs_t arch_timer; 13542e35d2fSJayanth Dodderi Chidanand #endif 13642e35d2fSJayanth Dodderi Chidanand 13742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 13842e35d2fSJayanth Dodderi Chidanand el1_mte2_regs_t mte2; 13942e35d2fSJayanth Dodderi Chidanand #endif 14042e35d2fSJayanth Dodderi Chidanand 14142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 14242e35d2fSJayanth Dodderi Chidanand el1_ras_regs_t ras; 14342e35d2fSJayanth Dodderi Chidanand #endif 14442e35d2fSJayanth Dodderi Chidanand 14542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 14642e35d2fSJayanth Dodderi Chidanand el1_s1pie_regs_t s1pie; 14742e35d2fSJayanth Dodderi Chidanand #endif 14842e35d2fSJayanth Dodderi Chidanand 14942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 15042e35d2fSJayanth Dodderi Chidanand el1_s1poe_regs_t s1poe; 15142e35d2fSJayanth Dodderi Chidanand #endif 15242e35d2fSJayanth Dodderi Chidanand 15342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 15442e35d2fSJayanth Dodderi Chidanand el1_s2poe_regs_t s2poe; 15542e35d2fSJayanth Dodderi Chidanand #endif 15642e35d2fSJayanth Dodderi Chidanand 15742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 15842e35d2fSJayanth Dodderi Chidanand el1_tcr2_regs_t tcr2; 15942e35d2fSJayanth Dodderi Chidanand #endif 16042e35d2fSJayanth Dodderi Chidanand 16142e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 16242e35d2fSJayanth Dodderi Chidanand el1_trf_regs_t trf; 16342e35d2fSJayanth Dodderi Chidanand #endif 16442e35d2fSJayanth Dodderi Chidanand 16542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 16642e35d2fSJayanth Dodderi Chidanand el1_csv2_2_regs_t csv2_2; 16742e35d2fSJayanth Dodderi Chidanand #endif 16842e35d2fSJayanth Dodderi Chidanand 16942e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 17042e35d2fSJayanth Dodderi Chidanand el1_gcs_regs_t gcs; 17142e35d2fSJayanth Dodderi Chidanand #endif 17242e35d2fSJayanth Dodderi Chidanand 1736d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 1746d0433f0SJayanth Dodderi Chidanand el1_the_regs_t the; 1756d0433f0SJayanth Dodderi Chidanand #endif 1766d0433f0SJayanth Dodderi Chidanand 1774ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 1784ec4e545SJayanth Dodderi Chidanand el1_sctlr2_regs_t sctlr2; 1794ec4e545SJayanth Dodderi Chidanand #endif 1804ec4e545SJayanth Dodderi Chidanand 18119d52a83SAndre Przywara #if ENABLE_FEAT_LS64_ACCDATA 18219d52a83SAndre Przywara el1_ls64_regs_t ls64; 18319d52a83SAndre Przywara #endif 18442e35d2fSJayanth Dodderi Chidanand } el1_sysregs_t; 18542e35d2fSJayanth Dodderi Chidanand 18642e35d2fSJayanth Dodderi Chidanand 18742e35d2fSJayanth Dodderi Chidanand /* 18842e35d2fSJayanth Dodderi Chidanand * Macros to access members related to individual features of the el1_sysregs_t 18942e35d2fSJayanth Dodderi Chidanand * structures. 19042e35d2fSJayanth Dodderi Chidanand */ 19142e35d2fSJayanth Dodderi Chidanand 19242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_common(ctx, reg) (((ctx)->common).reg) 19342e35d2fSJayanth Dodderi Chidanand 19442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_common(ctx, reg, val) ((((ctx)->common).reg) \ 19542e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 19642e35d2fSJayanth Dodderi Chidanand 197*6595f4cbSIgor Podgainõi #define write_el1_ctx_common_sysreg128(ctx, reg, val) ((((ctx)->common).reg) \ 198*6595f4cbSIgor Podgainõi = (sysreg_t) (val)) 199*6595f4cbSIgor Podgainõi 20042e35d2fSJayanth Dodderi Chidanand #if NS_TIMER_SWITCH 20142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) (((ctx)->arch_timer).reg) 20242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) ((((ctx)->arch_timer).reg) \ 20342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 20442e35d2fSJayanth Dodderi Chidanand #else 20542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_arch_timer(ctx, reg) ULL(0) 20642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_arch_timer(ctx, reg, val) 20742e35d2fSJayanth Dodderi Chidanand #endif /* NS_TIMER_SWITCH */ 20842e35d2fSJayanth Dodderi Chidanand 20942e35d2fSJayanth Dodderi Chidanand #if CTX_INCLUDE_AARCH32_REGS 21042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) (((ctx)->el1_aarch32).reg) 21142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) ((((ctx)->el1_aarch32).reg) \ 21242e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 21342e35d2fSJayanth Dodderi Chidanand #else 21442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_aarch32(ctx, reg) ULL(0) 21542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_aarch32(ctx, reg, val) 21642e35d2fSJayanth Dodderi Chidanand #endif /* CTX_INCLUDE_AARCH32_REGS */ 21742e35d2fSJayanth Dodderi Chidanand 21842e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_MTE2 21942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) (((ctx)->mte2).reg) 22042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) ((((ctx)->mte2).reg) \ 22142e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 22242e35d2fSJayanth Dodderi Chidanand #else 22342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_mte2(ctx, reg) ULL(0) 22442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_mte2(ctx, reg, val) 22542e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_MTE2 */ 22642e35d2fSJayanth Dodderi Chidanand 22742e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_RAS 22842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) (((ctx)->ras).reg) 22942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) ((((ctx)->ras).reg) \ 23042e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 23142e35d2fSJayanth Dodderi Chidanand #else 23242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_ras(ctx, reg) ULL(0) 23342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_ras(ctx, reg, val) 23442e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_RAS */ 23542e35d2fSJayanth Dodderi Chidanand 23642e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1PIE 23742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) (((ctx)->s1pie).reg) 23842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) ((((ctx)->s1pie).reg) \ 23942e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 24042e35d2fSJayanth Dodderi Chidanand #else 24142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1pie(ctx, reg) ULL(0) 24242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1pie(ctx, reg, val) 24342e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1PIE */ 24442e35d2fSJayanth Dodderi Chidanand 24542e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S1POE 24642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) (((ctx)->s1poe).reg) 24742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) ((((ctx)->s1poe).reg) \ 24842e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 24942e35d2fSJayanth Dodderi Chidanand #else 25042e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s1poe(ctx, reg) ULL(0) 25142e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s1poe(ctx, reg, val) 25242e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S1POE */ 25342e35d2fSJayanth Dodderi Chidanand 25442e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_S2POE 25542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) (((ctx)->s2poe).reg) 25642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) ((((ctx)->s2poe).reg) \ 25742e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 25842e35d2fSJayanth Dodderi Chidanand #else 25942e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_s2poe(ctx, reg) ULL(0) 26042e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_s2poe(ctx, reg, val) 26142e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_S2POE */ 26242e35d2fSJayanth Dodderi Chidanand 26342e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_TCR2 26442e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) (((ctx)->tcr2).reg) 26542e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) ((((ctx)->tcr2).reg) \ 26642e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 26742e35d2fSJayanth Dodderi Chidanand #else 26842e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_tcr2(ctx, reg) ULL(0) 26942e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_tcr2(ctx, reg, val) 27042e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_TCR2 */ 27142e35d2fSJayanth Dodderi Chidanand 27242e35d2fSJayanth Dodderi Chidanand #if ENABLE_TRF_FOR_NS 27342e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) (((ctx)->trf).reg) 27442e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) ((((ctx)->trf).reg) \ 27542e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 27642e35d2fSJayanth Dodderi Chidanand #else 27742e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_trf(ctx, reg) ULL(0) 27842e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_trf(ctx, reg, val) 27942e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_TRF_FOR_NS */ 28042e35d2fSJayanth Dodderi Chidanand 28142e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_CSV2_2 28242e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) (((ctx)->csv2_2).reg) 28342e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) ((((ctx)->csv2_2).reg) \ 28442e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 28542e35d2fSJayanth Dodderi Chidanand #else 28642e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_csv2_2(ctx, reg) ULL(0) 28742e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_csv2_2(ctx, reg, val) 28842e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_CSV2_2 */ 28942e35d2fSJayanth Dodderi Chidanand 29042e35d2fSJayanth Dodderi Chidanand #if ENABLE_FEAT_GCS 29142e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) (((ctx)->gcs).reg) 29242e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) ((((ctx)->gcs).reg) \ 29342e35d2fSJayanth Dodderi Chidanand = (uint64_t) (val)) 29442e35d2fSJayanth Dodderi Chidanand #else 29542e35d2fSJayanth Dodderi Chidanand #define read_el1_ctx_gcs(ctx, reg) ULL(0) 29642e35d2fSJayanth Dodderi Chidanand #define write_el1_ctx_gcs(ctx, reg, val) 29742e35d2fSJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_GCS */ 2986d0433f0SJayanth Dodderi Chidanand 2996d0433f0SJayanth Dodderi Chidanand #if ENABLE_FEAT_THE 3006d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) (((ctx)->the).reg) 301*6595f4cbSIgor Podgainõi #define write_el1_ctx_the_sysreg128(ctx, reg, val) ((((ctx)->the).reg) \ 302*6595f4cbSIgor Podgainõi = (sysreg_t) (val)) 3036d0433f0SJayanth Dodderi Chidanand #else 3046d0433f0SJayanth Dodderi Chidanand #define read_el1_ctx_the(ctx, reg) ULL(0) 305*6595f4cbSIgor Podgainõi #define write_el1_ctx_the_sysreg128(ctx, reg, val) 3066d0433f0SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_THE */ 3076d0433f0SJayanth Dodderi Chidanand 3084ec4e545SJayanth Dodderi Chidanand #if ENABLE_FEAT_SCTLR2 3094ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) (((ctx)->sctlr2).reg) 3104ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) ((((ctx)->sctlr2).reg) \ 3114ec4e545SJayanth Dodderi Chidanand = (uint64_t) (val)) 3124ec4e545SJayanth Dodderi Chidanand #else 3134ec4e545SJayanth Dodderi Chidanand #define read_el1_ctx_sctlr2(ctx, reg) ULL(0) 3144ec4e545SJayanth Dodderi Chidanand #define write_el1_ctx_sctlr2(ctx, reg, val) 3154ec4e545SJayanth Dodderi Chidanand #endif /* ENABLE_FEAT_SCTLR2 */ 3164ec4e545SJayanth Dodderi Chidanand 31719d52a83SAndre Przywara #if ENABLE_FEAT_LS64_ACCDATA 31819d52a83SAndre Przywara #define read_el1_ctx_ls64(ctx, reg) (((ctx)->ls64).reg) 31919d52a83SAndre Przywara #define write_el1_ctx_ls64(ctx, reg, val) ((((ctx)->ls64).reg) \ 32019d52a83SAndre Przywara = (uint64_t) (val)) 32119d52a83SAndre Przywara #else 32219d52a83SAndre Przywara #define read_el1_ctx_ls64(ctx, reg) ULL(0) 32319d52a83SAndre Przywara #define write_el1_ctx_ls64(ctx, reg, val) 32419d52a83SAndre Przywara #endif /* ENABLE_FEAT_LS64_ACCDATA */ 32542e35d2fSJayanth Dodderi Chidanand /******************************************************************************/ 32642e35d2fSJayanth Dodderi Chidanand #endif /* __ASSEMBLER__ */ 32742e35d2fSJayanth Dodderi Chidanand 32842e35d2fSJayanth Dodderi Chidanand #endif /* CONTEXT_EL1_H */ 329