Skip to content

Commit c774de2

Browse files
AlexGhitipalmer-dabbelt
authored andcommitted
riscv: Explicit comment about user virtual address space size
Define precisely the size of the user accessible virtual space size for sv32/39/48 mmu types and explain why the whole virtual address space is split into 2 equal chunks between kernel and user space. Signed-off-by: Alexandre Ghiti <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 73c7c8f commit c774de2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,15 @@ static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
685685
/*
686686
* Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32.
687687
* Note that PGDIR_SIZE must evenly divide TASK_SIZE.
688+
* Task size is:
689+
* - 0x9fc00000 (~2.5GB) for RV32.
690+
* - 0x4000000000 ( 256GB) for RV64 using SV39 mmu
691+
* - 0x800000000000 ( 128TB) for RV64 using SV48 mmu
692+
*
693+
* Note that PGDIR_SIZE must evenly divide TASK_SIZE since "RISC-V
694+
* Instruction Set Manual Volume II: Privileged Architecture" states that
695+
* "load and store effective addresses, which are 64bits, must have bits
696+
* 63–48 all equal to bit 47, or else a page-fault exception will occur."
688697
*/
689698
#ifdef CONFIG_64BIT
690699
#define TASK_SIZE (PGDIR_SIZE * PTRS_PER_PGD / 2)

0 commit comments

Comments
 (0)