mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 18:41:23 +00:00
bb1520d581
The setup of the kernel virtual address space is spread throughout the sources, boot stages and config options like this: 1. The available physical memory regions are queried and stored as mem_detect information for later use in the decompressor. 2. Based on the physical memory availability the virtual memory layout is established in the decompressor; 3. If CONFIG_KASAN is disabled the kernel paging setup code populates kernel pgtables and turns DAT mode on. It uses the information stored at step [1]. 4. If CONFIG_KASAN is enabled the kernel early boot kasan setup populates kernel pgtables and turns DAT mode on. It uses the information stored at step [1]. The kasan setup creates early_pg_dir directory and directly overwrites swapper_pg_dir entries to make shadow memory pages available. Move the kernel virtual memory setup to the decompressor and start the kernel with DAT turned on right from the very first istruction. That completely eliminates the boot phase when the kernel runs in DAT-off mode, simplies the overall design and consolidates pgtables setup. The identity mapping is created in the decompressor, while kasan shadow mappings are still created by the early boot kernel code. Share with decompressor the existing kasan memory allocator. It decreases the size of a newly requested memory block from pgalloc_pos and ensures that kernel image is not overwritten. pgalloc_low and pgalloc_pos pointers are made preserved boot variables for that. Use the bootdata infrastructure to setup swapper_pg_dir and invalid_pg_dir directories used by the kernel later. The interim early_pg_dir directory established by the kasan initialization code gets eliminated as result. As the kernel runs in DAT-on mode only the PSW_KERNEL_BITS define gets PSW_MASK_DAT bit by default. Additionally, the setup_lowcore_dat_off() and setup_lowcore_dat_on() routines get merged, since there is no DAT-off mode stage anymore. The memory mappings are created with RW+X protection that allows the early boot code setting up all necessary data and services for the kernel being booted. Just before the paging is enabled the memory protection is changed to RO+X for text, RO+NX for read-only data and RW+NX for kernel data and the identity mapping. Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> |
||
---|---|---|
.. | ||
syscalls | ||
vdso32 | ||
vdso64 | ||
.gitignore | ||
abs_lowcore.c | ||
alternative.c | ||
asm-offsets.c | ||
audit.c | ||
audit.h | ||
cache.c | ||
compat_audit.c | ||
compat_linux.c | ||
compat_linux.h | ||
compat_ptrace.h | ||
compat_signal.c | ||
cpcmd.c | ||
cpufeature.c | ||
crash_dump.c | ||
debug.c | ||
diag.c | ||
dis.c | ||
dumpstack.c | ||
early_printk.c | ||
early.c | ||
earlypgm.S | ||
ebcdic.c | ||
entry.h | ||
entry.S | ||
fpu.c | ||
ftrace.c | ||
ftrace.h | ||
guarded_storage.c | ||
head64.S | ||
idle.c | ||
ima_arch.c | ||
ipl_vmparm.c | ||
ipl.c | ||
irq.c | ||
jump_label.c | ||
kdebugfs.c | ||
kexec_elf.c | ||
kexec_image.c | ||
kprobes_insn_page.S | ||
kprobes.c | ||
kprobes.h | ||
lgr.c | ||
machine_kexec_file.c | ||
machine_kexec_reloc.c | ||
machine_kexec.c | ||
Makefile | ||
mcount.S | ||
module.c | ||
nmi.c | ||
nospec-branch.c | ||
nospec-sysfs.c | ||
numa.c | ||
os_info.c | ||
perf_cpum_cf_common.c | ||
perf_cpum_cf_events.c | ||
perf_cpum_cf.c | ||
perf_cpum_sf.c | ||
perf_event.c | ||
perf_pai_crypto.c | ||
perf_pai_ext.c | ||
perf_regs.c | ||
process.c | ||
processor.c | ||
ptrace.c | ||
reipl.S | ||
relocate_kernel.S | ||
runtime_instr.c | ||
setup.c | ||
signal.c | ||
smp.c | ||
stacktrace.c | ||
sthyi.c | ||
syscall.c | ||
sysinfo.c | ||
text_amode31.S | ||
time.c | ||
topology.c | ||
trace.c | ||
traps.c | ||
unwind_bc.c | ||
uprobes.c | ||
uv.c | ||
vdso.c | ||
vmlinux.lds.S | ||
vtime.c |