CSR Bit Fields

RISC-V hgatp CSR Register

Address 0x680Privilege HypervisorAccess HRW / HSXLENHypervisor and virtualization CSRs

hgatp is the G-stage translation root CSR holding mode, VMID, and the guest-physical root page-table PPN.

Bit Overview
bit 3 = only bit 3; bits 12..11 = bits 12 down to 11
MSBLSB
Field Map

Understand hgatp By Bit Fields

4 key fields
63:60

MODE

WARL

G-stage translation-mode encoding (WARL). For Bare, software must write zero to the remaining fields; selecting Bare with nonzero remaining fields has UNSPECIFIED field values and translation/protection behavior.

MODE (bits 63:60) — G-stage translation-mode encoding (WARL). For Bare, software must write zero to the remaining fields; selecting Bare with nonzero remaining fields has UNSPECIFIED field values and translation/protection behavior.

What This Field Controls

  • - G-stage translation-mode encoding (WARL). For Bare, software must write zero to the remaining fields; selecting Bare with nonzero remaining fields has UNSPECIFIED field values and translation/protection behavior.

Common Values

RV64 hgatp.MODE
0Bare

No translation or protection; software must write zero to the remaining fields when selecting Bare.

1-7Reserved

Reserved encodings for RV64 hgatp.MODE; portable software must not write or depend on them.

8Sv39x4

Enables Sv39x4 G-stage paged address translation.

9Sv48x4

Enables Sv48x4 G-stage paged address translation.

10Sv57x4

Enables Sv57x4 G-stage paged address translation.

11-15Reserved

Reserved encodings for RV64 hgatp.MODE; portable software must not write or depend on them.

Open Official Manual
57:44

VMID

WARL

Virtual-machine identifier (WARL) for tagging address-translation caches per VM; the implemented low-order VMIDLEN bits may be zero.

VMID (bits 57:44) — Virtual-machine identifier (WARL) for tagging address-translation caches per VM; the implemented low-order VMIDLEN bits may be zero.

What This Field Controls

  • - Virtual-machine identifier (WARL) for tagging address-translation caches per VM; the implemented low-order VMIDLEN bits may be zero.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Open Official Manual
43:0

PPN

WARL

Physical page number of the guest-physical root page table (WARL). In defined paged modes the root table is 16 KiB and must be 16-KiB aligned, so PPN[1:0] reads as zero.

PPN (bits 43:0) — Physical page number of the guest-physical root page table (WARL). In defined paged modes the root table is 16 KiB and must be 16-KiB aligned, so PPN[1:0] reads as zero.

What This Field Controls

  • - Physical page number of the guest-physical root page table (WARL). In defined paged modes the root table is 16 KiB and must be 16-KiB aligned, so PPN[1:0] reads as zero.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Open Official Manual
59:58

RESERVED_ZERO

WARL

Reserved WARL bits formatted as 0 in Figure 65. Software must not rely on the value read after writing a nonzero value.

RESERVED_ZERO (bits 59:58) — Reserved WARL bits formatted as 0 in Figure 65. Software must not rely on the value read after writing a nonzero value.

What This Field Controls

  • - Reserved WARL bits formatted as 0 in Figure 65. Software must not rely on the value read after writing a nonzero value.

Common Values

This field is better understood together with surrounding context than as a fixed memorized enumeration.

Open Official Manual
Official Basis & Search Notes

hgatp is a G-stage address-translation CSR. It is HS/M-side hypervisor state, not a VS supervisor CSR copy.

hgatp address, access class, and width are checked against the official CSR tables: 0x680, HRW, HSXLEN.
MODE selects the G-stage address-translation mode; when Bare, the remaining fields must be zero.
VMID tags address-translation caches by virtual machine; PPN holds the physical page number of the guest-physical root page table.
When writing, modify only officially defined fields; handle WARL, WLRL, WPRI, and reserved fields according to the official specification and implementation behavior.

What To Check First When Reading This CSR

  • - hgatp is a Hypervisor-level CSR; its separate address is in the official HRW access class.
  • - When mstatus.TVM=1, HS-mode reads and writes of hgatp raise an illegal-instruction exception.

Risk Checks Before Writing

  • - Writing hgatp does not itself order page-table updates and subsequent G-stage translations; VMID reuse or page-table changes may require HFENCE.GVMA.

Put It Back Into A Real Flow

1

Confirm the current software is in an M/HS context that may access Hypervisor CSRs.

2

Confirm the H extension and the TVM restriction for the current HS-mode context.

3

Write according to the MODE, VMID, and PPN WARL rules, and execute HFENCE.GVMA when required.

FAQ

Can hgatp be accessed through a supervisor CSR alias?

Do not treat hgatp as a VS CSR copy. It is an H-level CSR.

What matters when hgatp is Bare?

The official rule requires the remaining fields to be zero when the mode is Bare.