Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

5.7 Large addresses

The baseline VMSAv8-64 format gives 48-bit VAs and 48-bit PAs. Four extensions raise those limits, each by finding spare descriptor bits or by adding a level: FEAT_LVA and FEAT_LPA (52 bits, 64K granule only), FEAT_LPA2 (52 bits for 4K and 16K), and FEAT_D128 with FEAT_LVA3 (128-bit descriptors, 56-bit PA and VA). The walk mechanics they modify are in 5.3, and the TxSZ/IPS fields in 5.2.

Version summary

DDI0487 A2 lists each feature under the extension that introduced it and states an earlier “OPTIONAL from” version. Arm’s Feature names in A-profile architecture (109697) reproduces those statements:

FeatureIntroduced byPermitted (OPTIONAL) fromDiscovery
FEAT_LVA (52-bit VA)Armv8.2Armv8.1ID_AA64MMFR2_EL1.VARange == 0b0001
FEAT_LPA (52-bit PA/IPA, 64K)Armv8.2Armv8.1ID_AA64MMFR0_EL1.PARange == 0b0110
FEAT_LPA2 (52-bit, 4K/16K)Armv8.7Armv8.6TGran4 == 0b0001, TGran16 == 0b0010, TGran4_2/TGran16_2 == 0b0011
FEAT_D128 (VMSAv9-128, 56-bit PA)Armv9.4Armv9.3ID_AA64MMFR3_EL1.D128 (and D128_2 for stage 2)
FEAT_SYSREG128Armv9.4Armv9.3ID_AA64ISAR2_EL1.SYSREG_128
FEAT_LVA3 (56-bit VA)Armv9.4Armv9.3ID_AA64MMFR2_EL1.VARange

None of them is mandatory. Secondary sources disagree on whether D128 is “v9.3” or “v9.4”. Both are right in their own sense: the feature is part of the Armv9.4 extension, and an Armv9.3 implementation is permitted to include it. FEAT_LPA2 requires FEAT_LVA. FEAT_LVA3 requires FEAT_D128 and FEAT_LVA. Note that PARange == 0b0110 alone does not tell you that 4K/16K can use 52 bits. That needs the LPA2 values of TGran4/TGran16.

FEAT_LVA and FEAT_LPA: 52 bits with the 64K granule

The 64K granule resolves 13 bits per level, so a 48-bit VA uses a level 1 table with only 64 entries (bits [47:42]). FEAT_LVA lets TxSZ go down to 12. The level 1 table then indexes bits [51:42] and grows to 1024 entries (8KB, still a single walk start at level 1). No descriptor format changes.

FEAT_LPA needs four more output-address bits. The 64K page and block descriptors have spare bits because the OA field starts at bit 16, so:

64K granule, 52-bit OA (FEAT_LPA), block/page/table descriptor:
  bits [47:16]  OA[47:16]        (block: only the bits above the block size)
  bits [15:12]  OA[51:48]        (were RES0)
TTBRn_ELx with a 52-bit table address:
  bits [47:6]   BADDR[47:6]
  bits [5:2]    BADDR[51:48]

Two consequences matter for bring-up. First, a table pointed to by a TTBR with a 52-bit base must be at least 64-byte aligned, because TTBR bits [5:2] are no longer address bits [5:2]. Second, a 64K level 1 block now covers 4TB if PARange is 52 bits. IPS/PS (or VTCR_EL2.PS) must be 0b110 to emit these addresses. An output address with bits above the configured size set gives an Address size fault.

FEAT_LPA2: 52 bits with 4K and 16K

With 4K and 16K pages the descriptor OA field starts at bit 12 or 14, so there is no room below it. FEAT_LPA2 is enabled per regime by TCR_ELx.DS (TCR_EL1[59], TCR_EL2[32]/TCR_EL3[32] in the single-range layout, VTCR_EL2[32]). It takes the room from the shareability field:

4K/16K granule with DS == 1, block/page/table descriptor:
  bits [49:12]  OA[49:12]   (4K)      bits [49:14] OA[49:14] (16K)
  bits [9:8]    OA[51:50]   (were SH[1:0])
Shareability of every mapping in the range:
  stage 1: TCR_ELx.SH0 / SH1      stage 2: VTCR_EL2.SH0

So with DS == 1 you lose per-page shareability. Every mapping through a given TTBR uses the walk’s SH value. For most OSes that is Inner Shareable anyway. Firmware that maps some regions Non-shareable or Outer Shareable through descriptor SH must reconsider. Non-cacheable and Device mappings are treated as Outer Shareable regardless, see 6.4.

DS == 1 also:

  • allows TxSZ down to 12 (52-bit VA) for 4K and 16K;
  • adds block sizes: a level 0 block of 512GB with 4K, and a level 1 block of 64GB with 16K, when 52-bit PA is implemented;
  • changes the address operand format of the TLBI range operations, whose base address is then expressed in 64KB units. See 9.1.

DS is only meaningful for 4K and 16K. For 64K, 52-bit support is FEAT_LVA/LPA as above.

The level −1 walk

With 4K and DS == 1, a VA larger than 48 bits needs a lookup above level 0:

GranuleVA bitsLevelsTop table
4K48 (T0SZ = 16)0, 1, 2, 3L0: 512 entries, VA[47:39]
4K, DS=152 (T0SZ = 12)−1, 0, 1, 2, 3L−1: 16 entries, VA[51:48]
16K, DS=1520, 1, 2, 3L0: 32 entries, VA[51:47]
64K, LVA521, 2, 3L1: 1024 entries, VA[51:42]

Level −1 exists only for the 4K granule (the other granules fit 52 bits in their existing levels). For T0SZ 12–15, the walk starts at level −1. Faults at that level have their own encodings because LL cannot express −1: Translation fault level −1 is DFSC 0x2B, Address size fault level −1 is 0x29, and synchronous External abort on the walk at level −1 is 0x13 (5.8). For stage 2, VTCR_EL2.SL2 (bit 33) together with SL0 selects a level −1 start.

Bring-up note: Linux supports 52-bit VA kernels that fall back to 48 bits at boot when the CPU lacks the feature. With LPA2 that is not just a T1SZ change: an extra level appears or disappears, so the early page-table builder has to handle a variable number of levels. If you bring up a 52-bit-capable core on a 48-bit model (or the reverse), check ID_AA64MMFR0_EL1.TGran4 on every core before blaming the kernel. A mixed system where one cluster lacks LPA2 cannot run a DS == 1 kernel at all.

FEAT_D128: the 128-bit descriptor format (VMSAv9-128)

FEAT_D128 introduces a second translation table format, VMSAv9-128, with 128-bit descriptors. It is enabled per regime: TCR2_EL1.D128 / TCR2_EL2.D128 (bit 5) for stage 1, and VTCR_EL2.D128 (bit 38) for stage 2. The format provides:

  • 56-bit output addresses (PARange == 0b0111, IPS/PS == 0b111);
  • 52-bit VA at every granule with FEAT_LVA, and 56-bit VA with FEAT_LVA3;
  • room for a 4-bit AttrIndx (FEAT_AIE, MAIR2_ELx), a 4-bit permission overlay index, and the permission-indirection index;
  • mandatory permission indirection: there is no AP[2:1] encoding in a VMSAv9-128 leaf. FEAT_D128 requires FEAT_S1PIE (and FEAT_S2PIE when EL2 is implemented), and enabling D128 makes the PIE enable RES1, so PIR_ELx/PIRE0_ELx must be programmed before the first walk (5.5);
  • TLBIP forms of the VA- and IPA-based TLB invalidations (TLBIP VA*, RVA*, IPA*, RIPA*), which take 128-bit operands. They are part of FEAT_D128 and are encoded in the SYSP space that FEAT_SYSINSTR128 provides (FEAT_D128 requires FEAT_SYSINSTR128, FEAT_SYSREG128, FEAT_LSE128, FEAT_AIE and FEAT_TCR2).

Table geometry

A 16-byte descriptor halves the entries in a granule-sized table: 256 for 4K, 1024 for 16K and 4096 for 64K. Each level therefore resolves one bit fewer (8, 10 and 12 bits). With 4K pages a 48-bit VA now needs five lookups (starting at level −1), and a 56-bit VA needs six (starting at level −2, which has its own DFSC codes). To win those lookups back, VMSAv9-128 adds skip-level fields (SKL) in the TTBRs and in table descriptors. They let a walk skip initial levels, using a correspondingly larger table. The exact starting-level rules, the block sizes per level and the descriptor bit layout are long and have changed between DDI0487 issues. Take them from the current issue’s “VMSAv9-128” chapters, not from memory.

128-bit registers (FEAT_SYSREG128)

The base registers grow too: TTBR0_EL1, TTBR1_EL1, TTBR0_EL2, TTBR1_EL2 and VTTBR_EL2, together with PAR_EL1 and the FEAT_THE RCWMASK_EL1/RCWSMASK_EL1, have 128-bit forms. They are accessed with MRRS/MSRR (a pair of X registers) and gated by SCR_EL3.D128En (2.5, 17.3):

    // Install a 128-bit TTBR0_EL1 value held in x0 (low) / x1 (high).
    // MSRR requires an even/odd consecutive register pair.
    msrr    ttbr0_el1, x0, x1
    isb
    // Read back a 128-bit PAR after AT (see 5.9)
    mrrs    x2, x3, par_el1         // x3 bit 0 = PAR_EL1[64] = D128 format indicator

PAR_EL1 uses the 128-bit layout when PAR_EL1.D128 (bit [64]) is 1. In that layout a successful result carries PA (OA[55:12]) in bits [119:76], with ATTR, SH, NS and NSE where the 64-bit format has them. Software that only executes MRS x0, PAR_EL1 cannot see bit 64. In a D128 regime it must use MRRS. The decoding is in 5.9.

What D128 costs

  • Twice the memory per table entry, and one or two extra lookups unless SKL is used.
  • The whole translation stack needs a second implementation: descriptor builders, the walkers in your debugger scripts, TLBI wrappers (TLBIP), AT decoding, and context switching of 128-bit registers in EL3/EL2.
  • 56-bit VA reshapes the upper address bits that TBI, PAC and MTE share (13.3).

D128 is aimed at very large memory systems (CXL-attached or multi-chiplet servers). A bring-up engineer is most likely to meet it as an ID-register field that must be passed through correctly and an SCR_EL3 bit that must be set when an OS wants it.

Validation note: For each large-address feature, a directed test should drive the boundary values. Map a page whose OA has bit 51 (LPA/LPA2) or bit 55 (D128) set, and confirm the access reaches the expected PA, either through a debug memory read of the target or with AT plus PAR_EL1.PA. Then set the address one bit above the configured IPS and confirm an Address size fault at the right level. For LPA2, also check that changing descriptor bits [9:8] moves the PA and does not change shareability: a model that still decodes them as SH passes ordinary 48-bit tests and fails only here. Use the level −1 fault codes (0x29, 0x2B) as the oracle for T0SZ 12–15.

Checkpoint

Q5.7.1 A 4K-granule kernel sets TCR_EL1.DS = 1 and T1SZ = 12. Its old page-table code wrote descriptor SH = 0b11 (Inner Shareable) in bits [9:8] of every leaf. What happens to the mappings?

  • A. Nothing changes, because DS only affects TLBI operand formats
  • B. Bits [9:8] are now OA[51:50], so every mapping points 3 × 2^50 bytes above the intended PA (an Address size fault if IPS is below 52 bits), and shareability comes from TCR_EL1.SH1
  • C. The walk ignores bits [9:8] and the mappings are Non-shareable
  • D. T1SZ = 12 is invalid with 4K, so DS is ignored
Answer

B. With DS == 1, descriptor bits [9:8] are output-address bits [51:50], and shareability for the range is taken from TCR_EL1.SH0/SH1. Writing the old SH value turns into setting OA bits. If IPS is 52 bits that silently aliases a wrong PA. Otherwise it gives an Address size fault. D is wrong because LPA2 is precisely what makes TxSZ = 12 valid for 4K.

Read more: Arm ARM (DDI0487), “Translation table descriptor formats” with TCR_ELx.DS; FEAT_LPA2

Q5.7.2 A crash log shows DFSC 0x2B on a kernel that uses 4K pages. Which configuration does this point to?

  • A. A 64K-granule kernel with 52-bit VA, because only 64K has more than four levels
  • B. An Address size fault on the TTBR base address
  • C. A Translation fault at level 3 in a D128 regime
  • D. A Translation fault at level −1, which is only possible with TCR_ELx.DS == 1 and TxSZ below 16 (or in a VMSAv9-128 regime)
Answer

D. 0x2B is “Translation fault, level −1”. With VMSAv8-64 that level exists only for 4K with LPA2 and a 52-bit VA. With 64K, 52-bit VAs start at level 1 (A is backwards). An Address size fault on the TTBR is the level 0 encoding 0x00, or 0x29 for level −1.

Read more: Arm ARM (DDI0487), ESR_ELx.DFSC encodings

Q5.7.3 An OS enables TCR2_EL1.D128 but leaves PIR_EL1 at its reset value, since it “only wanted 56-bit PA”. What is the right expectation?

  • A. VMSAv9-128 leaf descriptors have no AP[2:1] encoding and permission indirection is in force, so permissions come from PIR_EL1/PIRE0_EL1 and an unprogrammed PIR gives wrong permissions or faults on the first access
  • B. Permissions fall back to the VMSAv8-64 AP bits until TCR2_EL1.PIE is set
  • C. D128 is ignored unless IPS == 0b111
  • D. The MSR to TCR2_EL1 is UNDEFINED unless PIR_EL1 is non-zero
Answer

A. FEAT_D128 depends on FEAT_S1PIE. In the 128-bit format the leaf carries a permission index, not AP bits, and enabling D128 makes PIE RES1. B describes a fallback that does not exist. C confuses the output size with the format selection.

Read more: Arm ARM (DDI0487), VMSAv9-128 descriptor formats; TCR2_EL1.D128, PIR_EL1