HomeFreeBSD

riscv: add stage 2 translation to pmap.

Description

riscv: add stage 2 translation to pmap.

Add basic stage 2 translation support (guest-physical to host-physical).

RISC-V hypervisor spec[1] introduces new translation schemes: Sv32x4,
Sv39x4, Sv48x4 and Sv57x4.
In each case, the size of the incoming address is widened by 2 bits (e.g.
Sv39 becomes 41-bit system).
To accommodate the 2 extra bits, the root page table (only) is expanded
by a factor of four to be 16 KiB instead of the usual 4 KiB. The rest of
page table system (including PTE format) is similar.
This gives us 4x of memory space in each scheme, but it does not make sense
to support all that memory for now.
Allocate required amount of pages for the top directory in case of stage 2,
but leave it unused.

  1. https://github.com/riscv/riscv-isa-manual/blob/main/src/hypervisor.adoc

Reviewed by: mhorne
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D45481

Details

Provenance
brAuthored on Jun 5 2024, 1:08 PM
Reviewer
mhorne
Differential Revision
D45481: riscv stage2 pmap support
Parents
rGbec000c9c1ef: amd64: add a func pointer to tlb shootdown function
Branches
Unknown
Tags
Unknown