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
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Copyright (c) 2018-2021 by the author(s)
//
// Author(s):
// - Andre Richter <andre.o.richter@gmail.com>
//! Translation Control Register - EL1
//!
//! The control register for stage 1 of the EL1&0 translation regime.
use tock_registers::{
interfaces::{Readable, Writeable},
register_bitfields,
};
register_bitfields! {u64,
pub TCR_EL1 [
/// When ARMv8.3-PAuth is implemented:
/// Controls the use of the top byte of instruction addresses for address matching.
/// 0 TCR_EL1.TBI1 applies to Instruction and Data accesses.
/// 1 TCR_EL1.TBI1 applies to Data accesses only.
/// This affects addresses where the address would be translated by tables pointed
/// to by TTBR1_EL1. This field resets to an architecturally UNKNOWN value.
/// Otherwise:
/// Reserved, RES0.
TBID1 OFFSET(52) NUMBITS(1) [],
/// When ARMv8.3-PAuth is implemented:
/// Controls the use of the top byte of instruction addresses for address matching.
/// 0 TCR_EL1.TBI0 applies to Instruction and Data accesses.
/// 1 TCR_EL1.TBI0 applies to Data accesses only.
/// This affects addresses where the address would be translated by tables pointed
/// to by TTBR0_EL1. This field resets to an architecturally UNKNOWN value.
/// Otherwise:
/// Reserved, RES0.
TBID0 OFFSET(51) NUMBITS(1) [],
/// Top Byte ignored - indicates whether the top byte of an address is used for address
/// match for the TTBR1_EL1 region, or ignored and used for tagged addresses. Defined values
/// are:
///
/// 0 Top Byte used in the address calculation.
///
/// 1 Top Byte ignored in the address calculation.
///
/// This affects addresses generated in EL0 and EL1 using AArch64 where the address would be
/// translated by tables pointed to by TTBR1_EL1. It has an effect whether the EL1&0
/// translation regime is enabled or not.
///
/// If ARMv8.3-PAuth is implemented and TCR_EL1.TBID1 is 1, then this field only applies to
/// Data accesses.
/// Otherwise, if the value of TBI1 is 1 and bit [55] of the target address to be stored to
/// the PC is 0, then bits[63:56] of that target address are also set to 0 before the
/// address is stored in the PC, in the following cases:
///
/// • A branch or procedure return within EL0 or EL1.
/// • An exception taken to EL1.
/// • An exception return to EL0 or EL1.
TBI1 OFFSET(38) NUMBITS(1) [
Used = 0,
Ignored = 1
],
/// Top Byte ignored - indicates whether the top byte of an address is used for address
/// match for the TTBR0_EL1 region, or ignored and used for tagged addresses. Defined values
/// are:
///
/// 0 Top Byte used in the address calculation.
///
/// 1 Top Byte ignored in the address calculation.
///
/// This affects addresses generated in EL0 and EL1 using AArch64 where the address would be
/// translated by tables pointed to by TTBR0_EL1. It has an effect whether the EL1&0
/// translation regime is enabled or not.
///
/// If ARMv8.3-PAuth is implemented and TCR_EL1.TBID0 is 1, then this field only applies to
/// Data accesses.
/// Otherwise, if the value of TBI0 is 1 and bit [55] of the target address to be stored to
/// the PC is 0, then bits[63:56] of that target address are also set to 0 before the
/// address is stored in the PC, in the following cases:
///
/// • A branch or procedure return within EL0 or EL1.
/// • An exception taken to EL1.
/// • An exception return to EL0 or EL1.
TBI0 OFFSET(37) NUMBITS(1) [
Used = 0,
Ignored = 1
],
/// ASID Size. Defined values are:
///
/// 0 8 bit - the upper 8 bits of TTBR0_EL1 and TTBR1_EL1 are ignored by hardware for every
/// purpose except reading back the register, and are treated as if they are all
/// zeros for when used for allocation and matching entries in the TLB.
///
/// 1 16 bit - the upper 16 bits of TTBR0_EL1 and TTBR1_EL1 are used for allocation and
/// matching in the TLB.
///
/// If the implementation has only 8 bits of ASID, this field is RES0.
AS OFFSET(36) NUMBITS(1) [
ASID8Bits = 0,
ASID16Bits = 1
],
/// Intermediate Physical Address Size.
///
/// 000 32 bits, 4GiB.
/// 001 36 bits, 64GiB.
/// 010 40 bits, 1TiB.
/// 011 42 bits, 4TiB.
/// 100 44 bits, 16TiB.
/// 101 48 bits, 256TiB.
/// 110 52 bits, 4PiB
///
/// Other values are reserved.
///
/// The reserved values behave in the same way as the 101 or 110 encoding, but software must
/// not rely on this property as the behavior of the reserved values might change in a
/// future revision of the architecture.
///
/// The value 110 is permitted only if ARMv8.2-LPA is implemented and the translation
/// granule size is 64KiB.
///
/// In an implementation that supports 52-bit PAs, if the value of this field is not 110 ,
/// then bits[51:48] of every translation table base address for the stage of translation
/// controlled by TCR_EL1 are 0000.
IPS OFFSET(32) NUMBITS(3) [
Bits_32 = 0b000,
Bits_36 = 0b001,
Bits_40 = 0b010,
Bits_42 = 0b011,
Bits_44 = 0b100,
Bits_48 = 0b101,
Bits_52 = 0b110
],
/// Granule size for the TTBR1_EL1.
///
/// 10 4KiB
/// 01 16KiB
/// 11 64KiB
///
/// Other values are reserved.
///
/// If the value is programmed to either a reserved value, or a size that has not been
/// implemented, then the hardware will treat the field as if it has been programmed to an
/// IMPLEMENTATION DEFINED choice of the sizes that has been implemented for all purposes
/// other than the value read back from this register.
///
/// It is IMPLEMENTATION DEFINED whether the value read back is the value programmed or the
/// value that corresponds to the size chosen.
TG1 OFFSET(30) NUMBITS(2) [
KiB_4 = 0b10,
KiB_16 = 0b01,
KiB_64 = 0b11
],
/// Shareability attribute for memory associated with translation table walks using
/// TTBR1_EL1.
///
/// 00 Non-shareable
/// 10 Outer Shareable
/// 11 Inner Shareable
///
/// Other values are reserved.
SH1 OFFSET(28) NUMBITS(2) [
None = 0b00,
Outer = 0b10,
Inner = 0b11
],
/// Outer cacheability attribute for memory associated with translation table walks using
/// TTBR1_EL1.
///
/// 00 Normal memory, Outer Non-cacheable
///
/// 01 Normal memory, Outer Write-Back Read-Allocate Write-Allocate Cacheable
///
/// 10 Normal memory, Outer Write-Through Read-Allocate No Write-Allocate Cacheable
///
/// 11 Normal memory, Outer Write-Back Read-Allocate No Write-Allocate Cacheable
ORGN1 OFFSET(26) NUMBITS(2) [
NonCacheable = 0b00,
WriteBack_ReadAlloc_WriteAlloc_Cacheable = 0b01,
WriteThrough_ReadAlloc_NoWriteAlloc_Cacheable = 0b10,
WriteBack_ReadAlloc_NoWriteAlloc_Cacheable = 0b11
],
/// Inner cacheability attribute for memory associated with translation
/// table walks using TTBR1_EL1.
///
/// 00 Normal memory, Inner Non-cacheable
///
/// 01 Normal memory, Inner Write-Back Read-Allocate Write-Allocate Cacheable
///
/// 10 Normal memory, Inner Write-Through Read-Allocate No Write-Allocate Cacheable
///
/// 11 Normal memory, Inner Write-Back Read-Allocate No Write-Allocate Cacheable
IRGN1 OFFSET(24) NUMBITS(2) [
NonCacheable = 0b00,
WriteBack_ReadAlloc_WriteAlloc_Cacheable = 0b01,
WriteThrough_ReadAlloc_NoWriteAlloc_Cacheable = 0b10,
WriteBack_ReadAlloc_NoWriteAlloc_Cacheable = 0b11
],
/// Translation table walk disable for translations using TTBR1_EL1. This bit controls
/// whether a translation table walk is performed on a TLB miss, for an address that is
/// translated using TTBR1_EL1. The encoding of this bit is:
///
/// 0 Perform translation table walks using TTBR1_EL1.
///
/// 1 A TLB miss on an address that is translated using TTBR1_EL1 generates a Translation
/// fault. No translation table walk is performed.
EPD1 OFFSET(23) NUMBITS(1) [
EnableTTBR1Walks = 0,
DisableTTBR1Walks = 1
],
/// Selects whether TTBR0_EL1 or TTBR1_EL1 defines the ASID. The encoding of this bit is:
///
/// 0 TTBR0_EL1.ASID defines the ASID.
/// 1 TTBR1_EL1.ASID defines the ASID.
A1 OFFSET(22) NUMBITS(1) [
TTBR0 = 0,
TTBR1 = 1
],
/// The size offset of the memory region addressed by TTBR1_EL1. The region size is
/// 2^(64-T1SZ) bytes.
///
/// The maximum and minimum possible values for T1SZ depend on the level of translation
/// table and the memory translation granule size, as described in the AArch64 Virtual
/// Memory System Architecture chapter.
///
/// This field resets to an architecturally UNKNOWN value.
T1SZ OFFSET(16) NUMBITS(6) [],
/// Granule size for the TTBR0_EL1.
///
/// 00 4KiB
/// 01 64KiB
/// 10 16KiB
///
/// Other values are reserved.
///
/// If the value is programmed to either a reserved value, or a size that has not been
/// implemented, then the hardware will treat the field as if it has been programmed to an
/// IMPLEMENTATION DEFINED choice of the sizes that has been implemented for all purposes
/// other than the value read back from this register.
///
/// It is IMPLEMENTATION DEFINED whether the value read back is the value programmed or the
/// value that corresponds to the size chosen.
TG0 OFFSET(14) NUMBITS(2) [
KiB_4 = 0b00,
KiB_16 = 0b10,
KiB_64 = 0b01
],
/// Shareability attribute for memory associated with translation table walks using
/// TTBR0_EL1.
///
/// 00 Non-shareable
/// 10 Outer Shareable
/// 11 Inner Shareable
///
/// Other values are reserved.
SH0 OFFSET(12) NUMBITS(2) [
None = 0b00,
Outer = 0b10,
Inner = 0b11
],
/// Outer cacheability attribute for memory associated with translation table walks using
/// TTBR0_EL1.
///
/// 00 Normal memory, Outer Non-cacheable
///
/// 01 Normal memory, Outer Write-Back Read-Allocate Write-Allocate Cacheable
///
/// 10 Normal memory, Outer Write-Through Read-Allocate No Write-Allocate Cacheable
///
/// 11 Normal memory, Outer Write-Back Read-Allocate No Write-Allocate Cacheable
ORGN0 OFFSET(10) NUMBITS(2) [
NonCacheable = 0b00,
WriteBack_ReadAlloc_WriteAlloc_Cacheable = 0b01,
WriteThrough_ReadAlloc_NoWriteAlloc_Cacheable = 0b10,
WriteBack_ReadAlloc_NoWriteAlloc_Cacheable = 0b11
],
/// Inner cacheability attribute for memory associated with translation table walks using
/// TTBR0_EL1.
///
/// 00 Normal memory, Inner Non-cacheable
///
/// 01 Normal memory, Inner Write-Back Read-Allocate Write-Allocate Cacheable
///
/// 10 Normal memory, Inner Write-Through Read-Allocate No Write-Allocate Cacheable
///
/// 11 Normal memory, Inner Write-Back Read-Allocate No Write-Allocate Cacheable
IRGN0 OFFSET(8) NUMBITS(2) [
NonCacheable = 0b00,
WriteBack_ReadAlloc_WriteAlloc_Cacheable = 0b01,
WriteThrough_ReadAlloc_NoWriteAlloc_Cacheable = 0b10,
WriteBack_ReadAlloc_NoWriteAlloc_Cacheable = 0b11
],
/// Translation table walk disable for translations using TTBR0_EL1. This bit controls
/// whether a translation table walk is performed on a TLB miss, for an address that is
/// translated using TTBR0_EL1. The encoding of this bit is:
///
/// 0 Perform translation table walks using TTBR0_EL1.
///
/// 1 A TLB miss on an address that is translated using TTBR0_EL1 generates a Translation
/// fault. No translation table walk is performed.
EPD0 OFFSET(7) NUMBITS(1) [
EnableTTBR0Walks = 0,
DisableTTBR0Walks = 1
],
/// The size offset of the memory region addressed by TTBR0_EL1. The region size is
/// 2^(64-T0SZ) bytes.
///
/// The maximum and minimum possible values for T0SZ depend on the level of translation
/// table and the memory translation granule size, as described in the AArch64 Virtual
/// Memory System Architecture chapter.
T0SZ OFFSET(0) NUMBITS(6) []
]
}
pub struct Reg;
impl Readable for Reg {
type T = u64;
type R = TCR_EL1::Register;
sys_coproc_read_raw!(u64, "TCR_EL1", "x");
}
impl Writeable for Reg {
type T = u64;
type R = TCR_EL1::Register;
sys_coproc_write_raw!(u64, "TCR_EL1", "x");
}
pub const TCR_EL1: Reg = Reg {};