freebsd-src/sys/riscv/include
Ruslan Bukin 03b330e191 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
2024-06-05 14:36:57 +01:00
..
_align.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
_bus.h _bus.h: Use standard licnese text 2023-11-13 12:25:30 -07:00
_inttypes.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
_limits.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
_stdint.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
_types.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
asm.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
atomic.h riscv: Implement atomic operations 2024-05-22 16:45:11 +01:00
bus.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bus_dma.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
bus_dma_impl.h busdma: tidy bus_dma_run_filter() functions 2023-12-06 19:11:39 -04:00
clock.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
counter.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
cpu.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
cpufunc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
db_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
dump.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
efi.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
elf.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
encoding.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
endian.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
exec.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
float.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
floatingpoint.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
fpe.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
frame.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
gdb_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ieeefp.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
in_cksum.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
intr.h riscv: Convert local interrupt controller to a newbus PIC 2024-01-24 23:49:54 +00:00
kdb.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
md_var.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
memdev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
metadata.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
minidump.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
ofw_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
param.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
pcb.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
pcpu.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
pcpu_aux.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
pmap.h riscv: add stage 2 translation to pmap. 2024-06-05 14:36:57 +01:00
pmc_mdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
proc.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
procctl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
profile.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
psl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pte.h riscv: Port improvements from arm64/amd64 pmaps, part 1 2023-11-02 14:33:37 -04:00
ptrace.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
reg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
reloc.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
resource.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
riscvreg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
runq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sbi.h riscv: Create a newbus device for the SBI driver 2024-01-24 23:49:54 +00:00
setjmp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sf_buf.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sigframe.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
signal.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
smp.h riscv: Convert local interrupt controller to a newbus PIC 2024-01-24 23:49:54 +00:00
stack.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
stdarg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sysarch.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
tls.h Add <machine/tls.h> header to hold MD constants and helpers for TLS. 2021-12-09 13:17:13 -08:00
trap.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ucontext.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vdso.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vm.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vmparam.h vm: Simplify startup page dumping conditional 2024-05-25 19:24:55 +02:00