| 26685a91 | 15-Mar-2025 |
Yu-Chien Peter Lin <peter.lin@sifive.com> |
core: mm: factor out virtual address range validation to arch code
Move virtual address range validation into architecture-specific code since different architectures have different constraints on v
core: mm: factor out virtual address range validation to arch code
Move virtual address range validation into architecture-specific code since different architectures have different constraints on valid VA ranges:
- For ARM, addresses must be within the VA width supported by the MMU - For RISC-V, additional checks are needed on RV64 to ensure addresses are canonically valid
Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 71214c12 | 11-Apr-2025 |
Alvin Chang <alvinga@andestech.com> |
riscv: mm: support Sv48 and Sv57 address translation for core and TA
Add the macros for Sv57 address translation mode. Add CFG_RISCV_MMU_MODE into riscv.mk and set it as 39 by default to enable Sv39
riscv: mm: support Sv48 and Sv57 address translation for core and TA
Add the macros for Sv57 address translation mode. Add CFG_RISCV_MMU_MODE into riscv.mk and set it as 39 by default to enable Sv39 virtual address translation scheme.
Currently, TA virtual memory occupies 1GB space, and TAs page table should be an entry inside a level 2 (VPN[2]) page table, which is decided by user_va_idx variable. For Sv39 translation scheme, it starts from VPN[2], so nothing to do. For Sv48 translation scheme, we need to allocate entry 0 of level 3 (VPN[3]) page table, and let it point to the level 2 page table used by TA. For Sv57 translation scheme, we need to further allocate entry 0 of level 4 (VPN[4]) page table, and let it point to the level 3 page table.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1da54125 | 11-Apr-2025 |
Alvin Chang <alvinga@andestech.com> |
riscv: mm: Explicitly set user VA range inside L2(RV64) and L1(RV32) VPN
Add macros for level and bit shift of virtual page number (VPN) encoded in RISC-V virtual address. Explicitly set range of us
riscv: mm: Explicitly set user VA range inside L2(RV64) and L1(RV32) VPN
Add macros for level and bit shift of virtual page number (VPN) encoded in RISC-V virtual address. Explicitly set range of user virtual address inside level 2 VPN by giving CORE_MMU_VPN2_SHIFT since the CORE_MMU_BASE_TABLE_SHIFT is not always based on level 2 VPN if the MMU scheme is not Sv39.
For RV32, there is only two-level VPN. The user VA range would be inside level 1 VPN.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|