Now that we support RISC-V CPUs that have MMUs with memory cachability
authorkettenis <kettenis@openbsd.org>
Sat, 6 Apr 2024 18:33:54 +0000 (18:33 +0000)
committerkettenis <kettenis@openbsd.org>
Sat, 6 Apr 2024 18:33:54 +0000 (18:33 +0000)
commit03901979a96bf5402447dc48ba3b9e630d77ed27
treea2377c014170c890fa4b78b4d5c884c460182a6b
parent85fbf21ae5ae715c1219116d9e0049b963b7b3c6
Now that we support RISC-V CPUs that have MMUs with memory cachability
attributes, the "direct map" becomes problematic as it results in
mappings for the same physical memory pages with different cachability
addresses.  The RISC-V specification of the "Svpbmt" extension doesn't
outright state that this is "verboten" like on some other
architectures that we support.  But it does say that it may result in
access with the wrong attributes.  So restrict the use of the direct
map to just mapping the 64MB block that the bootloader loaded us into.
To make this possible map the device tree later like we do on arm64.
This allows us to get rid of some assembly code in locore.S as a bonus!

ok miod@, jca@
sys/arch/riscv64/include/bootconfig.h
sys/arch/riscv64/include/pmap.h
sys/arch/riscv64/riscv64/genassym.cf
sys/arch/riscv64/riscv64/locore.S
sys/arch/riscv64/riscv64/machdep.c
sys/arch/riscv64/riscv64/pmap.c