1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Copyright (c) 2025 by the author(s)
//
// Author(s):
// - Yan Tan <tanyan@kylinos.cn>
//! Extended Translation Control Register - EL1
//!
//! Provides control over the translation table walks for stage 1 of the EL1&0 translation regime.
//! This register is present only when FEAT_TCR2 is implemented and FEAT_AA64 is implemented.
//! Otherwise, direct accesses to TCR2_EL1 are UNDEFINED.
use tock_registers::{
interfaces::{Readable, Writeable},
register_bitfields,
};
register_bitfields! {u64,
pub TCR2_EL1 [
// Reserved, RES0,[63:22]
/// Force non-global for unassured translations using TTBR1_EL1.
///
/// **When FEAT_THE is implemented:**
///
/// This bit is permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
FNGNA1 OFFSET(21) NUMBITS(1) [],
/// Force non-global for unassured translations using TTBR0_EL1
///
/// **When FEAT_THE is implemented:**
///
/// This bit is permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
FNGNA0 OFFSET(20) NUMBITS(1) [],
// Reserved, RES0,[19]
/// Force non-global translations for TTBR1_EL1.
///
/// **When FEAT_ASID2 is implemented:**
///
/// This bit is permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
FNG1 OFFSET(18) NUMBITS(1) [],
/// Force non-global translations for TTBR0_EL1.
///
/// **When FEAT_ASID2 is implemented:**
///
/// This bit is permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
FNG0 OFFSET(17) NUMBITS(1) [],
/// Enable use of two ASIDs.
///
/// **When FEAT_ASID2 is implemented:**
///
/// - 0 : Use of two ASIDs is disabled
/// - 1 : Use of two ASIDs is enabled
///
/// This bit is permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
A2 OFFSET(16) NUMBITS(1) [],
/// Disable the Contiguous bit for the Start Table for TTBR1_EL1.
///
/// **When FEAT_D128 is implemented and TCR2_EL1.D128 == 1:**
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
DisCH1 OFFSET(15) NUMBITS(1) [],
/// Disable the Contiguous bit for the Start Table for TTBR0_EL1.
///
/// **When FEAT_D128 is implemented and TCR2_EL1.D128 == 1:**
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
DisCH0 OFFSET(14) NUMBITS(1) [],
// Reserved, RES0,[13:12]
/// Hardware managed Access Flag for Table descriptors.
///
/// **When FEAT_HAFT is implemented:**
///
/// Controls whether hardware manages the Access Flag for Table descriptors.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
HAFT OFFSET(11) NUMBITS(1) [
/// Hardware managed Access Flag for Table descriptors is disabled
Disabled = 0,
/// Hardware managed Access Flag for Table descriptors is enabled
Enabled = 1
],
/// Permit Translation table walk Incoherence.
///
/// **When FEAT_THE is implemented:**
///
/// Permits RCWS instructions to generate writes that have the Reduced Coherence property.
///
/// This bit is permitted to be implemented as a read-only bit with a fixed value of 0.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
PTTWI OFFSET(10) NUMBITS(1) [],
// Reserved, RES0,[9:6]
/// Enables VMSAv9-128 translation system.
///
/// **When FEAT_D128 is implemented:**
///
/// - 0 : Translation system follows VMSAv8-64 translation process
/// - 1 : Translation system follows VMSAv9-128 translation process
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
D128 OFFSET(5) NUMBITS(1) [],
/// Enable Attribute Indexing Extension.
///
/// **When FEAT_AIE is implemented:**
///
/// This field is RES1 when TCR2_EL1.D128 is 1.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
AIE OFFSET(4) NUMBITS(1) [
/// Attribute Indexing Extension Disabled
Disabled = 0,
/// Attribute Indexing Extension Enabled
Enabled = 1
],
/// Enables Permission Overlays for privileged accesses.
///
/// **When FEAT_S1POE is implemented:**
///
/// - 0 : Permission overlay disabled for EL1 access in stage 1 of EL1&0 translation regime.
/// - 1 : Permission overlay enabled for EL1 access in stage 1 of EL1&0 translation regime.
///
/// This bit is not permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
POE OFFSET(3) NUMBITS(1) [
/// Permission overlay disabled for EL1 access
Disabled = 0,
/// Permission overlay enabled for EL1 access
Enabled = 1
],
/// Enables Permission Overlays for unprivileged accesses from EL1&0 translation regime.
///
/// **When FEAT_S1POE is implemented:**
///
/// - 0 : Permission overlay disabled for EL0 access in stage 1 of EL1&0 translation regime.
/// - 1 : Permission overlay enabled for EL0 access in stage 1 of EL1&0 translation regime.
///
/// This bit is not permitted to be cached in a TLB.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
E0POE OFFSET(2) NUMBITS(1) [
/// Permission overlay disabled for EL0 access
Disabled = 0,
/// Permission overlay enabled for EL0 access
Enabled = 1
],
/// Enables usage of Indirect Permission Scheme.
///
/// **When FEAT_S1PIE is implemented:**
///
/// - 0 : Direct permission model
/// - 1 : Indirect permission model
///
/// This field is RES1 when TCR2_EL1.D128 is 1.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
PIE OFFSET(1) NUMBITS(1) [
/// Direct permission model
Direct = 0,
/// Indirect permission model
Indirect = 1
],
/// Protected attribute enable.
///
/// **When FEAT_THE is implemented:**
///
/// Enables use of bit[52] of the stage 1 translation table entries as the Protected bit,
/// for translations using TTBRn_EL1
///
/// - 0 : For translations using TTBRn_EL1, bit[52] of each stage 1 translation table entry is not the Protected bit.
/// - 1 : For translations using TTBRn_EL1, bit[52] of each stage 1 translation table entry is the Protected bit.
///
/// If bit[52] is used as the Protected bit, it is not used as the Contiguous bit.
///
/// This field is RES0 when TCR2_EL1.D128 is 1.
///
/// This field is ignored by the PE and treated as zero when any of the following are true:
/// - All of the following are true:
/// - EL2 is implemented and enabled in the current Security state.
/// - The Effective value of HCRX_EL2.TCR2En is 0.
/// - EL3 is implemented and SCR_EL3.TCR2En == 0.
///
/// The reset behavior of this field is:
/// - On a Warm reset:
/// - When the highest implemented Exception level is EL1, this field resets to '0'.
/// - Otherwise, this field resets to an architecturally UNKNOWN value.
///
/// **Otherwise:**
///
/// Reserved.
PnCH OFFSET(0) NUMBITS(1) [
/// bit[52] is not the Protected bit
NotProtected = 0,
/// bit[52] is the Protected bit
Protected = 1
]
]
}
pub struct Reg;
impl Readable for Reg {
type T = u64;
type R = TCR2_EL1::Register;
sys_coproc_read_raw!(u64, "S3_0_C2_C0_3", "x");
}
impl Writeable for Reg {
type T = u64;
type R = TCR2_EL1::Register;
sys_coproc_write_raw!(u64, "S3_0_C2_C0_3", "x");
}
pub const TCR2_EL1: Reg = Reg {};