Skip to content

Commit 71723e8

Browse files
authored
Merge pull request #54 from CUB3D/hcr_el2_missing_fields
Add missing HCR_EL2 fields
2 parents d36b76f + 0495e19 commit 71723e8

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed

src/registers/hcr_el2.rs

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// - Bradley Landherr <[email protected]>
88
// - Javier Alvarez <[email protected]>
99
// - Yan Tan <[email protected]>
10+
// - Callum Thomson <[email protected]>
1011

1112
//! Hypervisor Configuration Register - EL2
1213
//!
@@ -20,6 +21,76 @@ use tock_registers::{
2021

2122
register_bitfields! {u64,
2223
pub HCR_EL2 [
24+
/// TWE Delay.
25+
///
26+
/// Requires FEAT_TWED
27+
TWEDEL OFFSET(60) NUMBITS(4) [],
28+
29+
/// TWE Delay Enable.
30+
///
31+
/// Requires FEAT_TWED
32+
TWEDEn OFFSET(59) NUMBITS(1) [],
33+
34+
/// Trap ID group 5.
35+
///
36+
/// Requires FEAT_MTE2
37+
TID5 OFFSET(58) NUMBITS(1) [],
38+
39+
/// Default Cacheability Tagging.
40+
///
41+
/// Requires FEAT_MTE2
42+
DCT OFFSET(57) NUMBITS(1) [],
43+
44+
/// Allocation Tag Access
45+
///
46+
/// Requires FEAT_MTE2
47+
ATA OFFSET(56) NUMBITS(1) [],
48+
49+
/// Trap TLB Maintenance (Outer Shareable)
50+
///
51+
/// Requires FEAT_EVT
52+
TTLBOS OFFSET(55) NUMBITS(1) [],
53+
54+
/// Trap TBL Maintenance (Inner Shareable).
55+
///
56+
/// Requires FEAT_EVT
57+
TTLBIS OFFSET(54) NUMBITS(1) [],
58+
59+
/// Enable `SCXTNUM_EL1` and `SCXTNUM_EL0` registers.
60+
///
61+
/// Requires FEAT_CSV2_2 or FEAT_CSV2_1p2
62+
EnSCXT OFFSET(53) NUMBITS(1) [],
63+
64+
/// Trap Cache Maintenance to Unification
65+
///
66+
/// Requires FEAT_EVT
67+
TOCU OFFSET(52) NUMBITS(1) [],
68+
69+
/// Activity Monitors Virtual Offset Enable.
70+
///
71+
/// Requires FEAT_AMUv1p1
72+
AMVOFFEN OFFSET(51) NUMBITS(1) [],
73+
74+
/// Trap `ICIALLUIS` and `IC IALLUIS`
75+
///
76+
/// Requires FEAT_EVT
77+
TICAB OFFSET(50) NUMBITS(1) [],
78+
79+
/// Trap ID group 4
80+
///
81+
/// Requires FEAT_EVT
82+
TID4 OFFSET(49) NUMBITS(1) [],
83+
84+
/// Granule Protection Fault routing control.
85+
///
86+
/// Requires FEAT_RME
87+
GPF OFFSET(48) NUMBITS(1) [],
88+
89+
/// Fault Injection Enable.
90+
///
91+
/// Requires FEAT_RASv1p1
92+
FIEN OFFSET(47) NUMBITS(1) [],
93+
2394
/// When FEAT_S2FWB is implemented Forced Write-back changes the combined cachability of stage1
2495
/// and stage2 attributes.
2596
FWB OFFSET(46) NUMBITS(1) [
@@ -29,6 +100,29 @@ register_bitfields! {u64,
29100
Enabled = 1,
30101
],
31102

103+
/// Nested Virtualization.
104+
///
105+
/// Requires FEAT_NV2
106+
NV2 OFFSET(45) NUMBITS(1) [],
107+
108+
/// Address Translation.
109+
///
110+
/// Requires FEAT_NV
111+
///
112+
/// Traps use of `AT S1E0R`, `AT S1E0W`, `AT S1E1R`, `AT S1E1W`, `AT S1E1RP` and `AT S1E1WP`
113+
/// Traps use of `AT S1E1A` if FEAT_ATS1A is present
114+
AT OFFSET(44) NUMBITS(1) [],
115+
116+
/// Nested Virtualization.
117+
///
118+
/// Changes meaning depending on if FEAT_NV2 or FEAT_NV is implemented.
119+
NV1 OFFSET(43) NUMBITS(1) [],
120+
121+
/// Nested Virtualization.
122+
///
123+
/// Changes meaning depending on if FEAT_NV2 or FEAT_NV is implemented.
124+
NV OFFSET(42) NUMBITS(1) [],
125+
32126
/// Controls the use of instructions related to Pointer Authentication.
33127
///
34128
/// - In EL0, when HCR_EL2.TGE==0 or HCR_EL2.E2H==0, and the associated SCTLR_EL1.En<N><M>==1.
@@ -59,6 +153,13 @@ register_bitfields! {u64,
59153
DisableTrapPointerAuthKeyRegsToEl2 = 1,
60154
],
61155

156+
/// TME.
157+
///
158+
/// Requires FEAT_TME.
159+
///
160+
/// Enables access to the TSTART, TCOMMIT, TTEST, and TCANCEL instructions at EL0 and EL1.
161+
TME OFFSET(39) NUMBITS(1) [],
162+
62163
/// Route synchronous External abort exceptions to EL2.
63164
///
64165
/// - if 0: This control does not cause exceptions to be routed from EL0 and EL1 to EL2.
@@ -91,6 +192,12 @@ register_bitfields! {u64,
91192
EnableOsAtEl2 = 1
92193
],
93194

195+
/// Instruction Cache Disable (Stage 2).
196+
ID OFFSET(33) NUMBITS(1) [],
197+
198+
/// Data Cache Disable (Stage 2).
199+
CD OFFSET(32) NUMBITS(1) [],
200+
94201
/// Execution state control for lower Exception levels.
95202
///
96203
/// - 0 Lower levels are all AArch32.
@@ -112,6 +219,17 @@ register_bitfields! {u64,
112219
EL1IsAarch64 = 1
113220
],
114221

222+
/// Trap Read of Virtual Memory control registers.
223+
TRVM OFFSET(30) NUMBITS(1) [],
224+
225+
/// HVC instruction Disable.
226+
///
227+
/// Requires EL3 _not_ implemented
228+
HCD OFFSET(29) NUMBITS(1) [],
229+
230+
/// Trap DC ZVA.
231+
TDZ OFFSET(28) NUMBITS(1) [],
232+
115233
/// Trap General Exceptions, from EL0.
116234
///
117235
/// If enabled:
@@ -188,6 +306,15 @@ register_bitfields! {u64,
188306
EnableTrapTVM = 1,
189307
],
190308

309+
/// Trap TLB Maintenance instructions.
310+
TTLB OFFSET(25) NUMBITS(1) [],
311+
312+
/// Trap Cache Maintenance to Unification.
313+
TPU OFFSET(24) NUMBITS(1) [],
314+
315+
/// Trap Cache Maintenance to Coherency.
316+
TPCP OFFSET(23) NUMBITS(1) [],
317+
191318
/// Trap data or unified cache maintenance instructions that operate by Set/Way.
192319
///
193320
/// Traps execution of those cache maintenance instructions at EL1 to EL2, when
@@ -270,6 +397,27 @@ register_bitfields! {u64,
270397
/// is enabled in the current Security state.
271398
TID3 OFFSET(18) NUMBITS(1) [],
272399

400+
/// Trap ID group 2.
401+
TID2 OFFSET(17) NUMBITS(1) [],
402+
403+
/// Trap ID group 1.
404+
TID1 OFFSET(16) NUMBITS(1) [],
405+
406+
/// Trap ID group 0.
407+
///
408+
/// Requires FEAT_AA32
409+
TID0 OFFSET(15) NUMBITS(1) [],
410+
411+
/// Trap WFE Instructions.
412+
///
413+
/// Additionally applies to WFET when FEAT_WFxT is implemented.
414+
TWE OFFSET(14) NUMBITS(1) [],
415+
416+
/// Trap WFI Instructions.
417+
///
418+
/// Additionally applies to WFIT when FEAT_WFxT is implemented.
419+
TWI OFFSET(13) NUMBITS(1) [],
420+
273421
/// Default Cacheability.
274422
///
275423
/// - 0 This control has no effect on the Non-secure EL1&0 translation regime.
@@ -337,6 +485,12 @@ register_bitfields! {u64,
337485
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
338486
VSE OFFSET(8) NUMBITS(1) [],
339487

488+
/// Virtual IRQ Interrupt.
489+
VI OFFSET(7) NUMBITS(1) [],
490+
491+
/// Virtual FIQ Interrupt.
492+
VF OFFSET(6) NUMBITS(1) [],
493+
340494
/// Physical SError interrupt routing.
341495
/// - If bit is 1 when executing at any Exception level, and EL2 is enabled in the current
342496
/// Security state:
@@ -404,6 +558,9 @@ register_bitfields! {u64,
404558
EnableVirtualFIQ = 1,
405559
],
406560

561+
/// Protected Table Walk.
562+
PTW OFFSET(2) NUMBITS(1) [],
563+
407564
/// Set/Way Invalidation Override.
408565
///
409566
/// Causes Non-secure EL1 execution of the data cache

0 commit comments

Comments
 (0)