Skip to content

Commit 5c8405d

Browse files
Stuart Menefypalmer-dabbelt
authored andcommitted
riscv: Extend sv39 linear mapping max size to 128G
This harmonizes all virtual addressing modes which can now all map (PGDIR_SIZE * PTRS_PER_PGD) / 4 of physical memory. The RISCV implementation of KASAN requires that the boundary between shallow mappings are aligned on an 8G boundary. In this case we need VMALLOC_START to be 8G aligned. So although we only need to move the start of the linear mapping down by 4GiB to allow 128GiB to be mapped, we actually move it down by 8GiB (creating a 4GiB hole between the linear mapping and KASAN shadow space) to maintain the alignment requirement. Signed-off-by: Stuart Menefy <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 3aa1a7d commit 5c8405d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Documentation/arch/riscv/vm-layout.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ RISC-V Linux Kernel SV39
4747
| Kernel-space virtual memory, shared between all processes:
4848
____________________________________________________________|___________________________________________________________
4949
| | | |
50-
ffffffc6fea00000 | -228 GB | ffffffc6feffffff | 6 MB | fixmap
51-
ffffffc6ff000000 | -228 GB | ffffffc6ffffffff | 16 MB | PCI io
52-
ffffffc700000000 | -228 GB | ffffffc7ffffffff | 4 GB | vmemmap
53-
ffffffc800000000 | -224 GB | ffffffd7ffffffff | 64 GB | vmalloc/ioremap space
54-
ffffffd800000000 | -160 GB | fffffff6ffffffff | 124 GB | direct mapping of all physical memory
50+
ffffffc4fea00000 | -236 GB | ffffffc4feffffff | 6 MB | fixmap
51+
ffffffc4ff000000 | -236 GB | ffffffc4ffffffff | 16 MB | PCI io
52+
ffffffc500000000 | -236 GB | ffffffc5ffffffff | 4 GB | vmemmap
53+
ffffffc600000000 | -232 GB | ffffffd5ffffffff | 64 GB | vmalloc/ioremap space
54+
ffffffd600000000 | -168 GB | fffffff5ffffffff | 128 GB | direct mapping of all physical memory
55+
| | | |
5556
fffffff700000000 | -36 GB | fffffffeffffffff | 32 GB | kasan
5657
__________________|____________|__________________|_________|____________________________________________________________
5758
|

arch/riscv/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* define the PAGE_OFFSET value for SV48 and SV39.
3838
*/
3939
#define PAGE_OFFSET_L4 _AC(0xffffaf8000000000, UL)
40-
#define PAGE_OFFSET_L3 _AC(0xffffffd800000000, UL)
40+
#define PAGE_OFFSET_L3 _AC(0xffffffd600000000, UL)
4141
#else
4242
#define PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
4343
#endif /* CONFIG_64BIT */

0 commit comments

Comments
 (0)