18f75582aSVasily Gorbik // SPDX-License-Identifier: GPL-2.0 28f75582aSVasily Gorbik #include <linux/string.h> 3805bc0bcSGerald Schaefer #include <linux/elf.h> 473045a08SVasily Gorbik #include <asm/boot_data.h> 5a80313ffSGerald Schaefer #include <asm/sections.h> 6d7e7fbbaSVasily Gorbik #include <asm/cpu_mf.h> 715426ca4SVasily Gorbik #include <asm/setup.h> 8*0c4f2623SVasily Gorbik #include <asm/kasan.h> 9805bc0bcSGerald Schaefer #include <asm/kexec.h> 107516fc11SVasily Gorbik #include <asm/sclp.h> 11a80313ffSGerald Schaefer #include <asm/diag.h> 125abb9351SVasily Gorbik #include <asm/uv.h> 138f75582aSVasily Gorbik #include "compressed/decompressor.h" 148f75582aSVasily Gorbik #include "boot.h" 158f75582aSVasily Gorbik 16d1b52a43SVasily Gorbik extern char __boot_data_start[], __boot_data_end[]; 17bf9921a9SGerald Schaefer extern char __boot_data_preserved_start[], __boot_data_preserved_end[]; 18b2d24b97SGerald Schaefer unsigned long __bootdata_preserved(__kaslr_offset); 19*0c4f2623SVasily Gorbik unsigned long __bootdata_preserved(VMALLOC_START); 20*0c4f2623SVasily Gorbik unsigned long __bootdata_preserved(VMALLOC_END); 21*0c4f2623SVasily Gorbik struct page *__bootdata_preserved(vmemmap); 22*0c4f2623SVasily Gorbik unsigned long __bootdata_preserved(vmemmap_size); 23*0c4f2623SVasily Gorbik unsigned long __bootdata_preserved(MODULES_VADDR); 24*0c4f2623SVasily Gorbik unsigned long __bootdata_preserved(MODULES_END); 2573045a08SVasily Gorbik unsigned long __bootdata(ident_map_size); 26d1b52a43SVasily Gorbik 2717e89e13SSven Schnelle u64 __bootdata_preserved(stfle_fac_list[16]); 2817e89e13SSven Schnelle u64 __bootdata_preserved(alt_stfle_fac_list[16]); 2917e89e13SSven Schnelle 30a80313ffSGerald Schaefer /* 31a80313ffSGerald Schaefer * Some code and data needs to stay below 2 GB, even when the kernel would be 32a80313ffSGerald Schaefer * relocated above 2 GB, because it has to use 31 bit addresses. 33a80313ffSGerald Schaefer * Such code and data is part of the .dma section, and its location is passed 34a80313ffSGerald Schaefer * over to the decompressed / relocated kernel via the .boot.preserved.data 35a80313ffSGerald Schaefer * section. 36a80313ffSGerald Schaefer */ 37a80313ffSGerald Schaefer extern char _sdma[], _edma[]; 38a80313ffSGerald Schaefer extern char _stext_dma[], _etext_dma[]; 39a80313ffSGerald Schaefer extern struct exception_table_entry _start_dma_ex_table[]; 40a80313ffSGerald Schaefer extern struct exception_table_entry _stop_dma_ex_table[]; 41a80313ffSGerald Schaefer unsigned long __bootdata_preserved(__sdma) = __pa(&_sdma); 42a80313ffSGerald Schaefer unsigned long __bootdata_preserved(__edma) = __pa(&_edma); 43a80313ffSGerald Schaefer unsigned long __bootdata_preserved(__stext_dma) = __pa(&_stext_dma); 44a80313ffSGerald Schaefer unsigned long __bootdata_preserved(__etext_dma) = __pa(&_etext_dma); 45a80313ffSGerald Schaefer struct exception_table_entry * 46a80313ffSGerald Schaefer __bootdata_preserved(__start_dma_ex_table) = _start_dma_ex_table; 47a80313ffSGerald Schaefer struct exception_table_entry * 48a80313ffSGerald Schaefer __bootdata_preserved(__stop_dma_ex_table) = _stop_dma_ex_table; 49a80313ffSGerald Schaefer 50a80313ffSGerald Schaefer int _diag210_dma(struct diag210 *addr); 51a80313ffSGerald Schaefer int _diag26c_dma(void *req, void *resp, enum diag26c_sc subcode); 52a80313ffSGerald Schaefer int _diag14_dma(unsigned long rx, unsigned long ry1, unsigned long subcode); 53a80313ffSGerald Schaefer void _diag0c_dma(struct hypfs_diag0c_entry *entry); 54a80313ffSGerald Schaefer void _diag308_reset_dma(void); 55a80313ffSGerald Schaefer struct diag_ops __bootdata_preserved(diag_dma_ops) = { 56a80313ffSGerald Schaefer .diag210 = _diag210_dma, 57a80313ffSGerald Schaefer .diag26c = _diag26c_dma, 58a80313ffSGerald Schaefer .diag14 = _diag14_dma, 59a80313ffSGerald Schaefer .diag0c = _diag0c_dma, 60a80313ffSGerald Schaefer .diag308_reset = _diag308_reset_dma 61a80313ffSGerald Schaefer }; 6233def849SJoe Perches static struct diag210 _diag210_tmp_dma __section(".dma.data"); 63a80313ffSGerald Schaefer struct diag210 *__bootdata_preserved(__diag210_tmp_dma) = &_diag210_tmp_dma; 64a80313ffSGerald Schaefer 657516fc11SVasily Gorbik void error(char *x) 667516fc11SVasily Gorbik { 677516fc11SVasily Gorbik sclp_early_printk("\n\n"); 687516fc11SVasily Gorbik sclp_early_printk(x); 697516fc11SVasily Gorbik sclp_early_printk("\n\n -- System halted"); 707516fc11SVasily Gorbik 7198587c2dSMartin Schwidefsky disabled_wait(); 727516fc11SVasily Gorbik } 737516fc11SVasily Gorbik 74d7e7fbbaSVasily Gorbik static void setup_lpp(void) 75d7e7fbbaSVasily Gorbik { 76d7e7fbbaSVasily Gorbik S390_lowcore.current_pid = 0; 77d7e7fbbaSVasily Gorbik S390_lowcore.lpp = LPP_MAGIC; 78d7e7fbbaSVasily Gorbik if (test_facility(40)) 79d7e7fbbaSVasily Gorbik lpp(&S390_lowcore.lpp); 80d7e7fbbaSVasily Gorbik } 81d7e7fbbaSVasily Gorbik 8215426ca4SVasily Gorbik #ifdef CONFIG_KERNEL_UNCOMPRESSED 8315426ca4SVasily Gorbik unsigned long mem_safe_offset(void) 8415426ca4SVasily Gorbik { 8515426ca4SVasily Gorbik return vmlinux.default_lma + vmlinux.image_size + vmlinux.bss_size; 8615426ca4SVasily Gorbik } 8715426ca4SVasily Gorbik #endif 8815426ca4SVasily Gorbik 899641b8ccSMartin Schwidefsky static void rescue_initrd(unsigned long addr) 9015426ca4SVasily Gorbik { 9115426ca4SVasily Gorbik if (!IS_ENABLED(CONFIG_BLK_DEV_INITRD)) 9215426ca4SVasily Gorbik return; 9315426ca4SVasily Gorbik if (!INITRD_START || !INITRD_SIZE) 9415426ca4SVasily Gorbik return; 959641b8ccSMartin Schwidefsky if (addr <= INITRD_START) 9615426ca4SVasily Gorbik return; 979641b8ccSMartin Schwidefsky memmove((void *)addr, (void *)INITRD_START, INITRD_SIZE); 989641b8ccSMartin Schwidefsky INITRD_START = addr; 9915426ca4SVasily Gorbik } 10015426ca4SVasily Gorbik 101d1b52a43SVasily Gorbik static void copy_bootdata(void) 102d1b52a43SVasily Gorbik { 103d1b52a43SVasily Gorbik if (__boot_data_end - __boot_data_start != vmlinux.bootdata_size) 104d1b52a43SVasily Gorbik error(".boot.data section size mismatch"); 105d1b52a43SVasily Gorbik memcpy((void *)vmlinux.bootdata_off, __boot_data_start, vmlinux.bootdata_size); 106bf9921a9SGerald Schaefer if (__boot_data_preserved_end - __boot_data_preserved_start != vmlinux.bootdata_preserved_size) 107bf9921a9SGerald Schaefer error(".boot.preserved.data section size mismatch"); 108bf9921a9SGerald Schaefer memcpy((void *)vmlinux.bootdata_preserved_off, __boot_data_preserved_start, vmlinux.bootdata_preserved_size); 109d1b52a43SVasily Gorbik } 110d1b52a43SVasily Gorbik 111805bc0bcSGerald Schaefer static void handle_relocs(unsigned long offset) 112805bc0bcSGerald Schaefer { 113805bc0bcSGerald Schaefer Elf64_Rela *rela_start, *rela_end, *rela; 114805bc0bcSGerald Schaefer int r_type, r_sym, rc; 115805bc0bcSGerald Schaefer Elf64_Addr loc, val; 116805bc0bcSGerald Schaefer Elf64_Sym *dynsym; 117805bc0bcSGerald Schaefer 118805bc0bcSGerald Schaefer rela_start = (Elf64_Rela *) vmlinux.rela_dyn_start; 119805bc0bcSGerald Schaefer rela_end = (Elf64_Rela *) vmlinux.rela_dyn_end; 120805bc0bcSGerald Schaefer dynsym = (Elf64_Sym *) vmlinux.dynsym_start; 121805bc0bcSGerald Schaefer for (rela = rela_start; rela < rela_end; rela++) { 122805bc0bcSGerald Schaefer loc = rela->r_offset + offset; 123ac49303dSGerald Schaefer val = rela->r_addend; 124805bc0bcSGerald Schaefer r_sym = ELF64_R_SYM(rela->r_info); 125ac49303dSGerald Schaefer if (r_sym) { 126ac49303dSGerald Schaefer if (dynsym[r_sym].st_shndx != SHN_UNDEF) 127ac49303dSGerald Schaefer val += dynsym[r_sym].st_value + offset; 128ac49303dSGerald Schaefer } else { 129ac49303dSGerald Schaefer /* 130ac49303dSGerald Schaefer * 0 == undefined symbol table index (STN_UNDEF), 131ac49303dSGerald Schaefer * used for R_390_RELATIVE, only add KASLR offset 132ac49303dSGerald Schaefer */ 133ac49303dSGerald Schaefer val += offset; 134ac49303dSGerald Schaefer } 135805bc0bcSGerald Schaefer r_type = ELF64_R_TYPE(rela->r_info); 136805bc0bcSGerald Schaefer rc = arch_kexec_do_relocs(r_type, (void *) loc, val, 0); 137805bc0bcSGerald Schaefer if (rc) 138805bc0bcSGerald Schaefer error("Unknown relocation type"); 139805bc0bcSGerald Schaefer } 140805bc0bcSGerald Schaefer } 141805bc0bcSGerald Schaefer 142980d5f9aSAlexander Egorenkov /* 14373045a08SVasily Gorbik * Merge information from several sources into a single ident_map_size value. 14473045a08SVasily Gorbik * "ident_map_size" represents the upper limit of physical memory we may ever 14573045a08SVasily Gorbik * reach. It might not be all online memory, but also include standby (offline) 14673045a08SVasily Gorbik * memory. "ident_map_size" could be lower then actual standby or even online 14773045a08SVasily Gorbik * memory present, due to limiting factors. We should never go above this limit. 14873045a08SVasily Gorbik * It is the size of our identity mapping. 14973045a08SVasily Gorbik * 15073045a08SVasily Gorbik * Consider the following factors: 15173045a08SVasily Gorbik * 1. max_physmem_end - end of physical memory online or standby. 15273045a08SVasily Gorbik * Always <= end of the last online memory block (get_mem_detect_end()). 15373045a08SVasily Gorbik * 2. CONFIG_MAX_PHYSMEM_BITS - the maximum size of physical memory the 15473045a08SVasily Gorbik * kernel is able to support. 15573045a08SVasily Gorbik * 3. "mem=" kernel command line option which limits physical memory usage. 15673045a08SVasily Gorbik * 4. OLDMEM_BASE which is a kdump memory limit when the kernel is executed as 15773045a08SVasily Gorbik * crash kernel. 15873045a08SVasily Gorbik * 5. "hsa" size which is a memory limit when the kernel is executed during 15973045a08SVasily Gorbik * zfcp/nvme dump. 16073045a08SVasily Gorbik */ 16173045a08SVasily Gorbik static void setup_ident_map_size(unsigned long max_physmem_end) 16273045a08SVasily Gorbik { 16373045a08SVasily Gorbik unsigned long hsa_size; 16473045a08SVasily Gorbik 16573045a08SVasily Gorbik ident_map_size = max_physmem_end; 16673045a08SVasily Gorbik if (memory_limit) 16773045a08SVasily Gorbik ident_map_size = min(ident_map_size, memory_limit); 16873045a08SVasily Gorbik ident_map_size = min(ident_map_size, 1UL << MAX_PHYSMEM_BITS); 16973045a08SVasily Gorbik 17073045a08SVasily Gorbik #ifdef CONFIG_CRASH_DUMP 17173045a08SVasily Gorbik if (OLDMEM_BASE) { 17273045a08SVasily Gorbik kaslr_enabled = 0; 17373045a08SVasily Gorbik ident_map_size = min(ident_map_size, OLDMEM_SIZE); 17473045a08SVasily Gorbik } else if (ipl_block_valid && is_ipl_block_dump()) { 17573045a08SVasily Gorbik kaslr_enabled = 0; 17673045a08SVasily Gorbik if (!sclp_early_get_hsa_size(&hsa_size) && hsa_size) 17773045a08SVasily Gorbik ident_map_size = min(ident_map_size, hsa_size); 17873045a08SVasily Gorbik } 17973045a08SVasily Gorbik #endif 18073045a08SVasily Gorbik } 18173045a08SVasily Gorbik 182*0c4f2623SVasily Gorbik static void setup_kernel_memory_layout(void) 183*0c4f2623SVasily Gorbik { 184*0c4f2623SVasily Gorbik bool vmalloc_size_verified = false; 185*0c4f2623SVasily Gorbik unsigned long vmemmap_off; 186*0c4f2623SVasily Gorbik unsigned long vspace_left; 187*0c4f2623SVasily Gorbik unsigned long rte_size; 188*0c4f2623SVasily Gorbik unsigned long pages; 189*0c4f2623SVasily Gorbik unsigned long vmax; 190*0c4f2623SVasily Gorbik 191*0c4f2623SVasily Gorbik pages = ident_map_size / PAGE_SIZE; 192*0c4f2623SVasily Gorbik /* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */ 193*0c4f2623SVasily Gorbik vmemmap_size = SECTION_ALIGN_UP(pages) * sizeof(struct page); 194*0c4f2623SVasily Gorbik 195*0c4f2623SVasily Gorbik /* choose kernel address space layout: 4 or 3 levels. */ 196*0c4f2623SVasily Gorbik vmemmap_off = round_up(ident_map_size, _REGION3_SIZE); 197*0c4f2623SVasily Gorbik if (IS_ENABLED(CONFIG_KASAN) || 198*0c4f2623SVasily Gorbik vmalloc_size > _REGION2_SIZE || 199*0c4f2623SVasily Gorbik vmemmap_off + vmemmap_size + vmalloc_size + MODULES_LEN > _REGION2_SIZE) 200*0c4f2623SVasily Gorbik vmax = _REGION1_SIZE; 201*0c4f2623SVasily Gorbik else 202*0c4f2623SVasily Gorbik vmax = _REGION2_SIZE; 203*0c4f2623SVasily Gorbik 204*0c4f2623SVasily Gorbik /* keep vmemmap_off aligned to a top level region table entry */ 205*0c4f2623SVasily Gorbik rte_size = vmax == _REGION1_SIZE ? _REGION2_SIZE : _REGION3_SIZE; 206*0c4f2623SVasily Gorbik MODULES_END = vmax; 207*0c4f2623SVasily Gorbik if (is_prot_virt_host()) { 208*0c4f2623SVasily Gorbik /* 209*0c4f2623SVasily Gorbik * forcing modules and vmalloc area under the ultravisor 210*0c4f2623SVasily Gorbik * secure storage limit, so that any vmalloc allocation 211*0c4f2623SVasily Gorbik * we do could be used to back secure guest storage. 212*0c4f2623SVasily Gorbik */ 213*0c4f2623SVasily Gorbik adjust_to_uv_max(&MODULES_END); 214*0c4f2623SVasily Gorbik } 215*0c4f2623SVasily Gorbik 216*0c4f2623SVasily Gorbik #ifdef CONFIG_KASAN 217*0c4f2623SVasily Gorbik if (MODULES_END < vmax) { 218*0c4f2623SVasily Gorbik /* force vmalloc and modules below kasan shadow */ 219*0c4f2623SVasily Gorbik MODULES_END = min(MODULES_END, KASAN_SHADOW_START); 220*0c4f2623SVasily Gorbik } else { 221*0c4f2623SVasily Gorbik /* 222*0c4f2623SVasily Gorbik * leave vmalloc and modules above kasan shadow but make 223*0c4f2623SVasily Gorbik * sure they don't overlap with it 224*0c4f2623SVasily Gorbik */ 225*0c4f2623SVasily Gorbik vmalloc_size = min(vmalloc_size, vmax - KASAN_SHADOW_END - MODULES_LEN); 226*0c4f2623SVasily Gorbik vmalloc_size_verified = true; 227*0c4f2623SVasily Gorbik vspace_left = KASAN_SHADOW_START; 228*0c4f2623SVasily Gorbik } 229*0c4f2623SVasily Gorbik #endif 230*0c4f2623SVasily Gorbik MODULES_VADDR = MODULES_END - MODULES_LEN; 231*0c4f2623SVasily Gorbik VMALLOC_END = MODULES_VADDR; 232*0c4f2623SVasily Gorbik 233*0c4f2623SVasily Gorbik if (vmalloc_size_verified) { 234*0c4f2623SVasily Gorbik VMALLOC_START = VMALLOC_END - vmalloc_size; 235*0c4f2623SVasily Gorbik } else { 236*0c4f2623SVasily Gorbik vmemmap_off = round_up(ident_map_size, rte_size); 237*0c4f2623SVasily Gorbik 238*0c4f2623SVasily Gorbik if (vmemmap_off + vmemmap_size > VMALLOC_END || 239*0c4f2623SVasily Gorbik vmalloc_size > VMALLOC_END - vmemmap_off - vmemmap_size) { 240*0c4f2623SVasily Gorbik /* 241*0c4f2623SVasily Gorbik * allow vmalloc area to occupy up to 1/2 of 242*0c4f2623SVasily Gorbik * the rest virtual space left. 243*0c4f2623SVasily Gorbik */ 244*0c4f2623SVasily Gorbik vmalloc_size = min(vmalloc_size, VMALLOC_END / 2); 245*0c4f2623SVasily Gorbik } 246*0c4f2623SVasily Gorbik VMALLOC_START = VMALLOC_END - vmalloc_size; 247*0c4f2623SVasily Gorbik vspace_left = VMALLOC_START; 248*0c4f2623SVasily Gorbik } 249*0c4f2623SVasily Gorbik 250*0c4f2623SVasily Gorbik pages = vspace_left / (PAGE_SIZE + sizeof(struct page)); 251*0c4f2623SVasily Gorbik pages = SECTION_ALIGN_UP(pages); 252*0c4f2623SVasily Gorbik vmemmap_off = round_up(vspace_left - pages * sizeof(struct page), rte_size); 253*0c4f2623SVasily Gorbik /* keep vmemmap left most starting from a fresh region table entry */ 254*0c4f2623SVasily Gorbik vmemmap_off = min(vmemmap_off, round_up(ident_map_size, rte_size)); 255*0c4f2623SVasily Gorbik /* take care that identity map is lower then vmemmap */ 256*0c4f2623SVasily Gorbik ident_map_size = min(ident_map_size, vmemmap_off); 257*0c4f2623SVasily Gorbik vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page); 258*0c4f2623SVasily Gorbik VMALLOC_START = max(vmemmap_off + vmemmap_size, VMALLOC_START); 259*0c4f2623SVasily Gorbik vmemmap = (struct page *)vmemmap_off; 260*0c4f2623SVasily Gorbik } 261*0c4f2623SVasily Gorbik 26273045a08SVasily Gorbik /* 263980d5f9aSAlexander Egorenkov * This function clears the BSS section of the decompressed Linux kernel and NOT the decompressor's. 264980d5f9aSAlexander Egorenkov */ 2652e83e0ebSVasily Gorbik static void clear_bss_section(void) 2662e83e0ebSVasily Gorbik { 2672e83e0ebSVasily Gorbik memset((void *)vmlinux.default_lma + vmlinux.image_size, 0, vmlinux.bss_size); 2682e83e0ebSVasily Gorbik } 2692e83e0ebSVasily Gorbik 27090178c19SHeiko Carstens /* 27190178c19SHeiko Carstens * Set vmalloc area size to an 8th of (potential) physical memory 27290178c19SHeiko Carstens * size, unless size has been set by kernel command line parameter. 27390178c19SHeiko Carstens */ 27490178c19SHeiko Carstens static void setup_vmalloc_size(void) 27590178c19SHeiko Carstens { 27690178c19SHeiko Carstens unsigned long size; 27790178c19SHeiko Carstens 27890178c19SHeiko Carstens if (vmalloc_size_set) 27990178c19SHeiko Carstens return; 28073045a08SVasily Gorbik size = round_up(ident_map_size / 8, _SEGMENT_SIZE); 28190178c19SHeiko Carstens vmalloc_size = max(size, vmalloc_size); 28290178c19SHeiko Carstens } 28390178c19SHeiko Carstens 2848f75582aSVasily Gorbik void startup_kernel(void) 2858f75582aSVasily Gorbik { 286b2d24b97SGerald Schaefer unsigned long random_lma; 2879641b8ccSMartin Schwidefsky unsigned long safe_addr; 288369f91c3SVasily Gorbik void *img; 2898f75582aSVasily Gorbik 290d7e7fbbaSVasily Gorbik setup_lpp(); 29149698745SVasily Gorbik store_ipl_parmblock(); 2929641b8ccSMartin Schwidefsky safe_addr = mem_safe_offset(); 2939641b8ccSMartin Schwidefsky safe_addr = read_ipl_report(safe_addr); 2949641b8ccSMartin Schwidefsky uv_query_info(); 2959641b8ccSMartin Schwidefsky rescue_initrd(safe_addr); 2969641b8ccSMartin Schwidefsky sclp_early_read_info(); 29749698745SVasily Gorbik setup_boot_command_line(); 298b5e80459SVasily Gorbik parse_boot_command_line(); 29973045a08SVasily Gorbik setup_ident_map_size(detect_memory()); 30090178c19SHeiko Carstens setup_vmalloc_size(); 301*0c4f2623SVasily Gorbik setup_kernel_memory_layout(); 302b2d24b97SGerald Schaefer 303b2d24b97SGerald Schaefer random_lma = __kaslr_offset = 0; 304b2d24b97SGerald Schaefer if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && kaslr_enabled) { 305b2d24b97SGerald Schaefer random_lma = get_random_base(safe_addr); 306b2d24b97SGerald Schaefer if (random_lma) { 307b2d24b97SGerald Schaefer __kaslr_offset = random_lma - vmlinux.default_lma; 308b2d24b97SGerald Schaefer img = (void *)vmlinux.default_lma; 309b2d24b97SGerald Schaefer vmlinux.default_lma += __kaslr_offset; 310b2d24b97SGerald Schaefer vmlinux.entry += __kaslr_offset; 311b2d24b97SGerald Schaefer vmlinux.bootdata_off += __kaslr_offset; 312b2d24b97SGerald Schaefer vmlinux.bootdata_preserved_off += __kaslr_offset; 313b2d24b97SGerald Schaefer vmlinux.rela_dyn_start += __kaslr_offset; 314b2d24b97SGerald Schaefer vmlinux.rela_dyn_end += __kaslr_offset; 315b2d24b97SGerald Schaefer vmlinux.dynsym_start += __kaslr_offset; 316b2d24b97SGerald Schaefer } 317b2d24b97SGerald Schaefer } 318b2d24b97SGerald Schaefer 3198f75582aSVasily Gorbik if (!IS_ENABLED(CONFIG_KERNEL_UNCOMPRESSED)) { 320369f91c3SVasily Gorbik img = decompress_kernel(); 321369f91c3SVasily Gorbik memmove((void *)vmlinux.default_lma, img, vmlinux.image_size); 322b2d24b97SGerald Schaefer } else if (__kaslr_offset) 323b2d24b97SGerald Schaefer memcpy((void *)vmlinux.default_lma, img, vmlinux.image_size); 324b2d24b97SGerald Schaefer 3252e83e0ebSVasily Gorbik clear_bss_section(); 326d1b52a43SVasily Gorbik copy_bootdata(); 327805bc0bcSGerald Schaefer if (IS_ENABLED(CONFIG_RELOCATABLE)) 328b2d24b97SGerald Schaefer handle_relocs(__kaslr_offset); 329b2d24b97SGerald Schaefer 330b2d24b97SGerald Schaefer if (__kaslr_offset) { 331a9f2f686SGerald Schaefer /* 332a9f2f686SGerald Schaefer * Save KASLR offset for early dumps, before vmcore_info is set. 333a9f2f686SGerald Schaefer * Mark as uneven to distinguish from real vmcore_info pointer. 334a9f2f686SGerald Schaefer */ 335a9f2f686SGerald Schaefer S390_lowcore.vmcore_info = __kaslr_offset | 0x1UL; 336b2d24b97SGerald Schaefer /* Clear non-relocated kernel */ 337b2d24b97SGerald Schaefer if (IS_ENABLED(CONFIG_KERNEL_UNCOMPRESSED)) 338b2d24b97SGerald Schaefer memset(img, 0, vmlinux.image_size); 339b2d24b97SGerald Schaefer } 340369f91c3SVasily Gorbik vmlinux.entry(); 3418f75582aSVasily Gorbik } 342