arch/s390/boot/startup.c
Source file repositories/reference/linux-study-clean/arch/s390/boot/startup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/boot/startup.c- Extension
.c- Size
- 22062 bytes
- Lines
- 650
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string.hlinux/elf.hasm/page-states.hasm/boot_data.hasm/extmem.hasm/sections.hasm/diag288.hasm/maccess.hasm/machine.hasm/sysinfo.hasm/cpu_mf.hasm/setup.hasm/timex.hasm/kasan.hasm/kexec.hasm/sclp.hasm/diag.hasm/uv.hasm/abs_lowcore.hasm/physmem_info.hasm/stacktrace.hasm/asm-offsets.hasm/arch-stackprotector.hdecompressor.hboot.huv.h
Detected Declarations
function detect_machine_typefunction detect_diag288function detect_diag9cfunction reset_tod_clockfunction detect_facilitiesfunction cmma_test_essafunction cmma_initfunction setup_lppfunction mem_safe_offsetfunction deploy_kernelfunction rescue_initrdfunction copy_bootdatafunction kaslr_adjust_relocsfunction kaslr_adjust_gotfunction meansfunction get_vmem_sizefunction setup_kernel_memory_layoutfunction clear_bss_sectionfunction offunction kaslr_adjust_vmlinux_infofunction startup_kernelfunction randomize_within_range
Annotated Snippet
if (!sclp_early_get_hsa_size(&hsa_size) && hsa_size) {
ident_map_size = min(ident_map_size, hsa_size);
boot_debug("Stand-alone dump limit: 0x%016lx\n", hsa_size);
}
}
#endif
boot_debug("Identity map size: 0x%016lx\n", ident_map_size);
}
#define FIXMAP_SIZE round_up(MEMCPY_REAL_SIZE + ABS_LOWCORE_MAP_SIZE, sizeof(struct lowcore))
static unsigned long get_vmem_size(unsigned long identity_size,
unsigned long vmemmap_size,
unsigned long vmalloc_size,
unsigned long rte_size)
{
unsigned long max_mappable, vsize;
max_mappable = max(identity_size, MAX_DCSS_ADDR);
vsize = round_up(SZ_2G + max_mappable, rte_size) +
round_up(vmemmap_size, rte_size) +
FIXMAP_SIZE + MODULES_LEN + KASLR_LEN;
if (IS_ENABLED(CONFIG_KMSAN))
vsize += MODULES_LEN * 2;
return size_add(vsize, vmalloc_size);
}
static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
{
unsigned long vmemmap_start;
unsigned long kernel_start;
unsigned long asce_limit;
unsigned long rte_size;
unsigned long pages;
unsigned long vsize;
unsigned long vmax;
pages = ident_map_size / PAGE_SIZE;
/* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */
vmemmap_size = SECTION_ALIGN_UP(pages) * sizeof(struct page);
/* choose kernel address space layout: 4 or 3 levels. */
BUILD_BUG_ON(!IS_ALIGNED(TEXT_OFFSET, THREAD_SIZE));
BUILD_BUG_ON(!IS_ALIGNED(__NO_KASLR_START_KERNEL, THREAD_SIZE));
BUILD_BUG_ON(__NO_KASLR_END_KERNEL > _REGION1_SIZE);
BUILD_BUG_ON(CONFIG_ILLEGAL_POINTER_VALUE < _REGION1_SIZE);
vsize = get_vmem_size(ident_map_size, vmemmap_size, vmalloc_size, _REGION3_SIZE);
boot_debug("vmem size estimated: 0x%016lx\n", vsize);
if (IS_ENABLED(CONFIG_KASAN) || __NO_KASLR_END_KERNEL > _REGION2_SIZE ||
(vsize > _REGION2_SIZE && kaslr_enabled())) {
asce_limit = _REGION1_SIZE;
if (__NO_KASLR_END_KERNEL > _REGION2_SIZE) {
rte_size = _REGION2_SIZE;
vsize = get_vmem_size(ident_map_size, vmemmap_size, vmalloc_size, _REGION2_SIZE);
} else {
rte_size = _REGION3_SIZE;
}
} else {
asce_limit = _REGION2_SIZE;
rte_size = _REGION3_SIZE;
}
/*
* Forcing modules and vmalloc area under the ultravisor
* secure storage limit, so that any vmalloc allocation
* we do could be used to back secure guest storage.
*
* Assume the secure storage limit always exceeds _REGION2_SIZE,
* otherwise asce_limit and rte_size would have been adjusted.
*/
vmax = adjust_to_uv_max(asce_limit);
boot_debug("%d level paging 0x%016lx vmax\n", vmax == _REGION1_SIZE ? 4 : 3, vmax);
#ifdef CONFIG_KASAN
BUILD_BUG_ON(__NO_KASLR_END_KERNEL > KASAN_SHADOW_START);
boot_debug("KASAN shadow area: 0x%016lx-0x%016lx\n", KASAN_SHADOW_START, KASAN_SHADOW_END);
/* force vmalloc and modules below kasan shadow */
vmax = min(vmax, KASAN_SHADOW_START);
#endif
vsize = min(vsize, vmax);
if (kaslr_enabled()) {
unsigned long kernel_end, kaslr_len, slots, pos;
kaslr_len = max(KASLR_LEN, vmax - vsize);
slots = DIV_ROUND_UP(kaslr_len - kernel_size, THREAD_SIZE);
if (get_random(slots, &pos))
pos = 0;
kernel_end = vmax - pos * THREAD_SIZE;
kernel_start = round_down(kernel_end - kernel_size, THREAD_SIZE);
boot_debug("Randomization range: 0x%016lx-0x%016lx\n", vmax - kaslr_len, vmax);
boot_debug("kernel image: 0x%016lx-0x%016lx (kaslr)\n", kernel_start,
Annotation
- Immediate include surface: `linux/string.h`, `linux/elf.h`, `asm/page-states.h`, `asm/boot_data.h`, `asm/extmem.h`, `asm/sections.h`, `asm/diag288.h`, `asm/maccess.h`.
- Detected declarations: `function detect_machine_type`, `function detect_diag288`, `function detect_diag9c`, `function reset_tod_clock`, `function detect_facilities`, `function cmma_test_essa`, `function cmma_init`, `function setup_lpp`, `function mem_safe_offset`, `function deploy_kernel`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.