xref: /linux/Documentation/arch/s390/mm.rst (revision 621cde16e49b3ecf7d59a8106a20aaebfb4a59a9)
1*c98d2ecaSAlexander Gordeev.. SPDX-License-Identifier: GPL-2.0
2*c98d2ecaSAlexander Gordeev
3*c98d2ecaSAlexander Gordeev=================
4*c98d2ecaSAlexander GordeevMemory Management
5*c98d2ecaSAlexander Gordeev=================
6*c98d2ecaSAlexander Gordeev
7*c98d2ecaSAlexander GordeevVirtual memory layout
8*c98d2ecaSAlexander Gordeev=====================
9*c98d2ecaSAlexander Gordeev
10*c98d2ecaSAlexander Gordeev.. note::
11*c98d2ecaSAlexander Gordeev
12*c98d2ecaSAlexander Gordeev - Some aspects of the virtual memory layout setup are not
13*c98d2ecaSAlexander Gordeev   clarified (number of page levels, alignment, DMA memory).
14*c98d2ecaSAlexander Gordeev
15*c98d2ecaSAlexander Gordeev - Unused gaps in the virtual memory layout could be present
16*c98d2ecaSAlexander Gordeev   or not - depending on how partucular system is configured.
17*c98d2ecaSAlexander Gordeev   No page tables are created for the unused gaps.
18*c98d2ecaSAlexander Gordeev
19*c98d2ecaSAlexander Gordeev - The virtual memory regions are tracked or untracked by KASAN
20*c98d2ecaSAlexander Gordeev   instrumentation, as well as the KASAN shadow memory itself is
21*c98d2ecaSAlexander Gordeev   created only when CONFIG_KASAN configuration option is enabled.
22*c98d2ecaSAlexander Gordeev
23*c98d2ecaSAlexander Gordeev::
24*c98d2ecaSAlexander Gordeev
25*c98d2ecaSAlexander Gordeev  =============================================================================
26*c98d2ecaSAlexander Gordeev  |    Physical      |	  Virtual	| VM area description
27*c98d2ecaSAlexander Gordeev  =============================================================================
28*c98d2ecaSAlexander Gordeev  +- 0 --------------+- 0 --------------+
29*c98d2ecaSAlexander Gordeev  |		     | S390_lowcore	| Low-address memory
30*c98d2ecaSAlexander Gordeev  |		     +- 8 KB -----------+
31*c98d2ecaSAlexander Gordeev  |		     |			|
32*c98d2ecaSAlexander Gordeev  |		     |			|
33*c98d2ecaSAlexander Gordeev  |		     | ... unused gap	| KASAN untracked
34*c98d2ecaSAlexander Gordeev  |		     |			|
35*c98d2ecaSAlexander Gordeev  +- AMODE31_START --+- AMODE31_START --+ .amode31 rand. phys/virt start
36*c98d2ecaSAlexander Gordeev  |.amode31 text/data|.amode31 text/data| KASAN untracked
37*c98d2ecaSAlexander Gordeev  +- AMODE31_END ----+- AMODE31_END ----+ .amode31 rand. phys/virt end (<2GB)
38*c98d2ecaSAlexander Gordeev  |		     |			|
39*c98d2ecaSAlexander Gordeev  |		     |			|
40*c98d2ecaSAlexander Gordeev  +- __kaslr_offset_phys		| kernel rand. phys start
41*c98d2ecaSAlexander Gordeev  |		     |			|
42*c98d2ecaSAlexander Gordeev  | kernel text/data |			|
43*c98d2ecaSAlexander Gordeev  |		     |			|
44*c98d2ecaSAlexander Gordeev  +------------------+			| kernel phys end
45*c98d2ecaSAlexander Gordeev  |		     |			|
46*c98d2ecaSAlexander Gordeev  |		     |			|
47*c98d2ecaSAlexander Gordeev  |		     |			|
48*c98d2ecaSAlexander Gordeev  |		     |			|
49*c98d2ecaSAlexander Gordeev  +- ident_map_size -+			|
50*c98d2ecaSAlexander Gordeev		     |			|
51*c98d2ecaSAlexander Gordeev		     |	... unused gap	| KASAN untracked
52*c98d2ecaSAlexander Gordeev		     |			|
53*c98d2ecaSAlexander Gordeev		     +- __identity_base + identity mapping start (>= 2GB)
54*c98d2ecaSAlexander Gordeev		     |			|
55*c98d2ecaSAlexander Gordeev		     | identity		| phys == virt - __identity_base
56*c98d2ecaSAlexander Gordeev		     | mapping		| virt == phys + __identity_base
57*c98d2ecaSAlexander Gordeev		     |			|
58*c98d2ecaSAlexander Gordeev		     |			| KASAN tracked
59*c98d2ecaSAlexander Gordeev		     |			|
60*c98d2ecaSAlexander Gordeev		     |			|
61*c98d2ecaSAlexander Gordeev		     |			|
62*c98d2ecaSAlexander Gordeev		     |			|
63*c98d2ecaSAlexander Gordeev		     |			|
64*c98d2ecaSAlexander Gordeev		     |			|
65*c98d2ecaSAlexander Gordeev		     |			|
66*c98d2ecaSAlexander Gordeev		     |			|
67*c98d2ecaSAlexander Gordeev		     |			|
68*c98d2ecaSAlexander Gordeev		     |			|
69*c98d2ecaSAlexander Gordeev		     |			|
70*c98d2ecaSAlexander Gordeev		     |			|
71*c98d2ecaSAlexander Gordeev		     |			|
72*c98d2ecaSAlexander Gordeev		     |			|
73*c98d2ecaSAlexander Gordeev		     |			|
74*c98d2ecaSAlexander Gordeev		     +---- vmemmap -----+ 'struct page' array start
75*c98d2ecaSAlexander Gordeev		     |			|
76*c98d2ecaSAlexander Gordeev		     | virtually mapped |
77*c98d2ecaSAlexander Gordeev		     | memory map	| KASAN untracked
78*c98d2ecaSAlexander Gordeev		     |			|
79*c98d2ecaSAlexander Gordeev		     +- __abs_lowcore --+
80*c98d2ecaSAlexander Gordeev		     |			|
81*c98d2ecaSAlexander Gordeev		     | Absolute Lowcore | KASAN untracked
82*c98d2ecaSAlexander Gordeev		     |			|
83*c98d2ecaSAlexander Gordeev		     +- __memcpy_real_area
84*c98d2ecaSAlexander Gordeev		     |			|
85*c98d2ecaSAlexander Gordeev		     |	Real Memory Copy| KASAN untracked
86*c98d2ecaSAlexander Gordeev		     |			|
87*c98d2ecaSAlexander Gordeev		     +- VMALLOC_START --+ vmalloc area start
88*c98d2ecaSAlexander Gordeev		     |			| KASAN untracked or
89*c98d2ecaSAlexander Gordeev		     |	vmalloc area	| KASAN shallowly populated in case
90*c98d2ecaSAlexander Gordeev		     |			|	CONFIG_KASAN_VMALLOC=y
91*c98d2ecaSAlexander Gordeev		     +- MODULES_VADDR --+ modules area start
92*c98d2ecaSAlexander Gordeev		     |			| KASAN allocated per module or
93*c98d2ecaSAlexander Gordeev		     |	modules area	| KASAN shallowly populated in case
94*c98d2ecaSAlexander Gordeev		     |			|	CONFIG_KASAN_VMALLOC=y
95*c98d2ecaSAlexander Gordeev		     +- __kaslr_offset -+ kernel rand. virt start
96*c98d2ecaSAlexander Gordeev		     |			| KASAN tracked
97*c98d2ecaSAlexander Gordeev		     | kernel text/data | phys == (kvirt - __kaslr_offset) +
98*c98d2ecaSAlexander Gordeev		     |			|	  __kaslr_offset_phys
99*c98d2ecaSAlexander Gordeev		     +- kernel .bss end + kernel rand. virt end
100*c98d2ecaSAlexander Gordeev		     |			|
101*c98d2ecaSAlexander Gordeev		     |	... unused gap	| KASAN untracked
102*c98d2ecaSAlexander Gordeev		     |			|
103*c98d2ecaSAlexander Gordeev		     +------------------+ UltraVisor Secure Storage limit
104*c98d2ecaSAlexander Gordeev		     |			|
105*c98d2ecaSAlexander Gordeev		     |	... unused gap	| KASAN untracked
106*c98d2ecaSAlexander Gordeev		     |			|
107*c98d2ecaSAlexander Gordeev		     +KASAN_SHADOW_START+ KASAN shadow memory start
108*c98d2ecaSAlexander Gordeev		     |			|
109*c98d2ecaSAlexander Gordeev		     |	 KASAN shadow	| KASAN untracked
110*c98d2ecaSAlexander Gordeev		     |			|
111*c98d2ecaSAlexander Gordeev		     +------------------+ ASCE limit
112