Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit fec135a

Browse files
Javier-varezandre-richter
authored andcommitted
Add some more fields to HCR_EL2
To manage hypervisor state.
1 parent f1688b7 commit fec135a

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

src/registers/hcr_el2.rs

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Author(s):
66
// - Andre Richter <andre.o.richter@gmail.com>
77
// - Bradley Landherr <landhb@users.noreply.github.com>
8+
// - Javier Alvarez <javier.alvarez@allthingsembedded.com>
89

910
//! Hypervisor Configuration Register - EL2
1011
//!
@@ -18,6 +19,53 @@ use tock_registers::{
1819

1920
register_bitfields! {u64,
2021
pub HCR_EL2 [
22+
///
23+
/// Controls the use of instructions related to Pointer Authentication:
24+
///
25+
/// - In EL0, when HCR_EL2.TGE==0 or HCR_EL2.E2H==0, and the associated SCTLR_EL1.En<N><M>==1.
26+
/// - In EL1, the associated SCTLR_EL1.En<N><M>==1.
27+
///
28+
/// Traps are reported using EC syndrome value 0x09. The Pointer Authentication instructions
29+
/// trapped are:
30+
///
31+
/// AUTDA, AUTDB, AUTDZA, AUTDZB, AUTIA, AUTIA1716, AUTIASP, AUTIAZ, AUTIB, AUTIB1716,
32+
/// AUTIBSP, AUTIBZ, AUTIZA, AUTIZB, PACGA, PACDA, PACDB, PACDZA, PACDZB, PACIA,
33+
/// PACIA1716, PACIASP, PACIAZ, PACIB, PACIB1716, PACIBSP, PACIBZ, PACIZA, PACIZB.
34+
/// RETAA, RETAB, BRAA, BRAB, BLRAA, BLRAB, BRAAZ, BRABZ, BLRAAZ, BLRABZ.
35+
/// ERETAA, ERETAB, LDRAA, and LDRAB.
36+
API OFFSET(41) NUMBITS(1) [
37+
EnableTrapPointerAuthInstToEl2 = 0,
38+
DisableTrapPointerAuthInstToEl2 = 1
39+
],
40+
///
41+
/// Trap registers holding "key" values for Pointer Authentication. Traps accesses to the
42+
/// following registers from EL1 to EL2, when EL2 is enabled in the current Security state,
43+
/// reported using EC syndrome value 0x18:
44+
///
45+
/// APIAKeyLo_EL1, APIAKeyHi_EL1, APIBKeyLo_EL1, APIBKeyHi_EL1, APDAKeyLo_EL1,
46+
/// APDAKeyHi_EL1, APDBKeyLo_EL1, APDBKeyHi_EL1, APGAKeyLo_EL1, and APGAKeyHi_EL1.
47+
///
48+
APK OFFSET(40) NUMBITS(1) [
49+
EnableTrapPointerAuthKeyRegsToEl2 = 0,
50+
DisableTrapPointerAuthKeyRegsToEl2 = 1,
51+
],
52+
53+
/// Route synchronous External abort exceptions to EL2.
54+
/// if 0: This control does not cause exceptions to be routed from EL0 and EL1 to EL2.
55+
/// if 1: Route synchronous External abort exceptions from EL0 and EL1 to EL2, when EL2 is
56+
/// enabled in the current Security state, if not routed to EL3.
57+
TEA OFFSET(37) NUMBITS(1) [
58+
DisableTrapSyncExtAborts = 0,
59+
EnableTrapSyncExtAborts = 1,
60+
],
61+
62+
/// EL2 Host. Enables a configuration where a Host Operating System is running in EL2, and
63+
/// the Host Operating System's applications are running in EL0.
64+
E2H OFFSET(34) NUMBITS(1) [
65+
DisableOsAtEl2 = 0,
66+
EnableOsAtEl2 = 1
67+
],
68+
2169
/// Execution state control for lower Exception levels:
2270
///
2371
/// 0 Lower levels are all AArch32.
@@ -39,6 +87,40 @@ register_bitfields! {u64,
3987
EL1IsAarch64 = 1
4088
],
4189

90+
/// Trap General Exceptions, from EL0.
91+
///
92+
/// If enabled:
93+
/// - When EL2 is not enabled in the current Security state, this control has no effect on
94+
/// execution at EL0.
95+
///
96+
/// - When EL2 is enabled in the current Security state, in all cases:
97+
///
98+
/// - All exceptions that would be routed to EL1 are routed to EL2.
99+
/// - If EL1 is using AArch64, the SCTLR_EL1.M field is treated as being 0 for all
100+
/// purposes other than returning the result of a direct read of SCTLR_EL1.
101+
/// - If EL1 is using AArch32, the SCTLR.M field is treated as being 0 for all
102+
/// purposes other than returning the result of a direct read of SCTLR.
103+
/// - All virtual interrupts are disabled.
104+
/// - Any IMPLEMENTATION DEFINED mechanisms for signaling virtual interrupts are
105+
/// disabled.
106+
/// - An exception return to EL1 is treated as an illegal exception return.
107+
/// - The MDCR_EL2.{TDRA, TDOSA, TDA, TDE} fields are treated as being 1 for all
108+
/// purposes other than returning the result of a direct read of MDCR_EL2.
109+
///
110+
/// - In addition, when EL2 is enabled in the current Security state, if:
111+
///
112+
/// - HCR_EL2.E2H is 0, the Effective values of the HCR_EL2.{FMO, IMO, AMO} fields
113+
/// are 1.
114+
/// - HCR_EL2.E2H is 1, the Effective values of the HCR_EL2.{FMO, IMO, AMO} fields
115+
/// are 0.
116+
///
117+
/// - For further information on the behavior of this bit when E2H is 1, see 'Behavior of
118+
/// HCR_EL2.E2H'.
119+
TGE OFFSET(27) NUMBITS(1) [
120+
DisableTrapGeneralExceptions = 0,
121+
EnableTrapGeneralExceptions = 1,
122+
],
123+
42124
/// Default Cacheability.
43125
///
44126
/// 0 This control has no effect on the Non-secure EL1&0 translation regime.
@@ -69,6 +151,72 @@ register_bitfields! {u64,
69151
/// field behaves as 0 for all purposes other than a direct read of the value of this field.
70152
DC OFFSET(12) NUMBITS(1) [],
71153

154+
/// Physical SError interrupt routing.
155+
/// - If bit is 1 when executing at any Exception level, and EL2 is enabled in the current
156+
/// Security state:
157+
/// - Physical SError interrupts are taken to EL2, unless they are routed to EL3.
158+
/// - When the value of HCR_EL2.TGE is 0, then virtual SError interrupts are enabled.
159+
AMO OFFSET(5) NUMBITS(1) [],
160+
161+
/// Physical IRQ Routing.
162+
///
163+
/// If this bit is 0:
164+
/// - When executing at Exception levels below EL2, and EL2 is enabled in the current
165+
/// Security state:
166+
/// - When the value of HCR_EL2.TGE is 0, Physical IRQ interrupts are not taken to EL2.
167+
/// - When the value of HCR_EL2.TGE is 1, Physical IRQ interrupts are taken to EL2
168+
/// unless they are routed to EL3.
169+
/// - Virtual IRQ interrupts are disabled.
170+
///
171+
/// If this bit is 1:
172+
/// - When executing at any Exception level, and EL2 is enabled in the current Security
173+
/// state:
174+
/// - Physical IRQ interrupts are taken to EL2, unless they are routed to EL3.
175+
/// - When the value of HCR_EL2.TGE is 0, then Virtual IRQ interrupts are enabled.
176+
///
177+
/// If EL2 is enabled in the current Security state, and the value of HCR_EL2.TGE is 1:
178+
/// - Regardless of the value of the IMO bit, physical IRQ Interrupts target EL2 unless
179+
/// they are routed to EL3.
180+
/// - When FEAT_VHE is not implemented, or if HCR_EL2.E2H is 0, this field behaves as 1
181+
/// for all purposes other than a direct read of the value of this bit.
182+
/// - When FEAT_VHE is implemented and HCR_EL2.E2H is 1, this field behaves as 0 for all
183+
/// purposes other than a direct read of the value of this bit.
184+
///
185+
/// For more information, see 'Asynchronous exception routing'.
186+
IMO OFFSET(4) NUMBITS(1) [
187+
DisableVirtualIRQ = 0,
188+
EnableVirtualIRQ = 1,
189+
],
190+
191+
/// Physical FIQ Routing.
192+
/// If this bit is 0:
193+
/// - When executing at Exception levels below EL2, and EL2 is enabled in the current
194+
/// Security state:
195+
/// - When the value of HCR_EL2.TGE is 0, Physical FIQ interrupts are not taken to EL2.
196+
/// - When the value of HCR_EL2.TGE is 1, Physical FIQ interrupts are taken to EL2
197+
/// unless they are routed to EL3.
198+
/// - Virtual FIQ interrupts are disabled.
199+
///
200+
/// If this bit is 1:
201+
/// - When executing at any Exception level, and EL2 is enabled in the current Security
202+
/// state:
203+
/// - Physical FIQ interrupts are taken to EL2, unless they are routed to EL3.
204+
/// - When HCR_EL2.TGE is 0, then Virtual FIQ interrupts are enabled.
205+
///
206+
/// If EL2 is enabled in the current Security state and the value of HCR_EL2.TGE is 1:
207+
/// - Regardless of the value of the FMO bit, physical FIQ Interrupts target EL2 unless
208+
/// they are routed to EL3.
209+
/// - When FEAT_VHE is not implemented, or if HCR_EL2.E2H is 0, this field behaves as 1
210+
/// for all purposes other than a direct read of the value of this bit.
211+
/// - When FEAT_VHE is implemented and HCR_EL2.E2H is 1, this field behaves as 0 for all
212+
/// purposes other than a direct read of the value of this bit.
213+
///
214+
/// For more information, see 'Asynchronous exception routing'.
215+
FMO OFFSET(3) NUMBITS(1) [
216+
DisableVirtualFIQ = 0,
217+
EnableVirtualFIQ = 1,
218+
],
219+
72220
/// Set/Way Invalidation Override. Causes Non-secure EL1 execution of the data cache
73221
/// invalidate by set/way instructions to perform a data cache clean and invalidate by
74222
/// set/way:

0 commit comments

Comments
 (0)