1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 28c2c3df3SCatalin Marinas/* 38c2c3df3SCatalin Marinas * ld script to make ARM Linux kernel 48c2c3df3SCatalin Marinas * taken from the i386 version by Russell King 58c2c3df3SCatalin Marinas * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> 68c2c3df3SCatalin Marinas */ 78c2c3df3SCatalin Marinas 8ce492a16SDavid Brazdil#include <asm/hyp_image.h> 93471ee06SDavid Brazdil#ifdef CONFIG_KVM 10e9ee186bSJames Morse#define HYPERVISOR_EXTABLE \ 11e9ee186bSJames Morse . = ALIGN(SZ_8); \ 12e9ee186bSJames Morse __start___kvm_ex_table = .; \ 13e9ee186bSJames Morse *(__kvm_ex_table) \ 14e9ee186bSJames Morse __stop___kvm_ex_table = .; 1530c95391SDavid Brazdil 162d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS \ 1716174eeaSDavid Brazdil HYP_SECTION_NAME(.rodata) : { \ 18b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 1916174eeaSDavid Brazdil __hyp_rodata_start = .; \ 202d7bf218SDavid Brazdil *(HYP_SECTION_NAME(.data..ro_after_init)) \ 2116174eeaSDavid Brazdil *(HYP_SECTION_NAME(.rodata)) \ 22b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 2316174eeaSDavid Brazdil __hyp_rodata_end = .; \ 242d7bf218SDavid Brazdil } 252d7bf218SDavid Brazdil 2630c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION \ 2730c95391SDavid Brazdil . = ALIGN(PAGE_SIZE); \ 2830c95391SDavid Brazdil HYP_SECTION_NAME(.data..percpu) : { \ 2930c95391SDavid Brazdil *(HYP_SECTION_NAME(.data..percpu)) \ 3030c95391SDavid Brazdil } 318c49b5d4SDavid Brazdil 328c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION \ 338c49b5d4SDavid Brazdil .hyp.reloc : ALIGN(4) { \ 348c49b5d4SDavid Brazdil __hyp_reloc_begin = .; \ 358c49b5d4SDavid Brazdil *(.hyp.reloc) \ 368c49b5d4SDavid Brazdil __hyp_reloc_end = .; \ 378c49b5d4SDavid Brazdil } 388c49b5d4SDavid Brazdil 39380e18adSQuentin Perret#define BSS_FIRST_SECTIONS \ 40380e18adSQuentin Perret __hyp_bss_start = .; \ 41380e18adSQuentin Perret *(HYP_SECTION_NAME(.bss)) \ 42380e18adSQuentin Perret . = ALIGN(PAGE_SIZE); \ 43380e18adSQuentin Perret __hyp_bss_end = .; 44380e18adSQuentin Perret 45380e18adSQuentin Perret/* 46380e18adSQuentin Perret * We require that __hyp_bss_start and __bss_start are aligned, and enforce it 47380e18adSQuentin Perret * with an assertion. But the BSS_SECTION macro places an empty .sbss section 48380e18adSQuentin Perret * between them, which can in some cases cause the linker to misalign them. To 49380e18adSQuentin Perret * work around the issue, force a page alignment for __bss_start. 50380e18adSQuentin Perret */ 51380e18adSQuentin Perret#define SBSS_ALIGN PAGE_SIZE 523471ee06SDavid Brazdil#else /* CONFIG_KVM */ 533471ee06SDavid Brazdil#define HYPERVISOR_EXTABLE 542d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS 5530c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION 568c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION 57380e18adSQuentin Perret#define SBSS_ALIGN 0 583471ee06SDavid Brazdil#endif 59e9ee186bSJames Morse 60d6e2cc56SMark Rutland#define RO_EXCEPTION_TABLE_ALIGN 4 61380e18adSQuentin Perret#define RUNTIME_DISCARD_EXIT 62380e18adSQuentin Perret 63380e18adSQuentin Perret#include <asm-generic/vmlinux.lds.h> 64380e18adSQuentin Perret#include <asm/cache.h> 65380e18adSQuentin Perret#include <asm/kernel-pgtable.h> 6619a046f0SPasha Tatashin#include <asm/kexec.h> 67380e18adSQuentin Perret#include <asm/memory.h> 68380e18adSQuentin Perret#include <asm/page.h> 69380e18adSQuentin Perret 70380e18adSQuentin Perret#include "image.h" 71380e18adSQuentin Perret 72380e18adSQuentin PerretOUTPUT_ARCH(aarch64) 73380e18adSQuentin PerretENTRY(_text) 74380e18adSQuentin Perret 75380e18adSQuentin Perretjiffies = jiffies_64; 76380e18adSQuentin Perret 772240bbb6SMarc Zyngier#define HYPERVISOR_TEXT \ 78b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 795c636aa0SMasahiro Yamada __hyp_idmap_text_start = .; \ 802240bbb6SMarc Zyngier *(.hyp.idmap.text) \ 815c636aa0SMasahiro Yamada __hyp_idmap_text_end = .; \ 825c636aa0SMasahiro Yamada __hyp_text_start = .; \ 832240bbb6SMarc Zyngier *(.hyp.text) \ 84e9ee186bSJames Morse HYPERVISOR_EXTABLE \ 85b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 865c636aa0SMasahiro Yamada __hyp_text_end = .; 872240bbb6SMarc Zyngier 885dfe9d7dSArd Biesheuvel#define IDMAP_TEXT \ 895dfe9d7dSArd Biesheuvel . = ALIGN(SZ_4K); \ 905c636aa0SMasahiro Yamada __idmap_text_start = .; \ 915dfe9d7dSArd Biesheuvel *(.idmap.text) \ 925c636aa0SMasahiro Yamada __idmap_text_end = .; 935dfe9d7dSArd Biesheuvel 9482869ac5SJames Morse#ifdef CONFIG_HIBERNATION 9582869ac5SJames Morse#define HIBERNATE_TEXT \ 96*dc4824faSMark Rutland ALIGN_FUNCTION(); \ 975c636aa0SMasahiro Yamada __hibernate_exit_text_start = .; \ 9882869ac5SJames Morse *(.hibernate_exit.text) \ 995c636aa0SMasahiro Yamada __hibernate_exit_text_end = .; 10082869ac5SJames Morse#else 10182869ac5SJames Morse#define HIBERNATE_TEXT 10282869ac5SJames Morse#endif 10382869ac5SJames Morse 10419a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE 10519a046f0SPasha Tatashin#define KEXEC_TEXT \ 106*dc4824faSMark Rutland ALIGN_FUNCTION(); \ 10719a046f0SPasha Tatashin __relocate_new_kernel_start = .; \ 10819a046f0SPasha Tatashin *(.kexec_relocate.text) \ 10919a046f0SPasha Tatashin __relocate_new_kernel_end = .; 11019a046f0SPasha Tatashin#else 11119a046f0SPasha Tatashin#define KEXEC_TEXT 11219a046f0SPasha Tatashin#endif 11319a046f0SPasha Tatashin 114c7b9adafSWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 115c7b9adafSWill Deacon#define TRAMP_TEXT \ 116c7b9adafSWill Deacon . = ALIGN(PAGE_SIZE); \ 1175c636aa0SMasahiro Yamada __entry_tramp_text_start = .; \ 118c7b9adafSWill Deacon *(.entry.tramp.text) \ 119c7b9adafSWill Deacon . = ALIGN(PAGE_SIZE); \ 1201c9a8e87SArd Biesheuvel __entry_tramp_text_end = .; \ 1211c9a8e87SArd Biesheuvel *(.entry.tramp.rodata) 122c7b9adafSWill Deacon#else 123c7b9adafSWill Deacon#define TRAMP_TEXT 124c7b9adafSWill Deacon#endif 125c7b9adafSWill Deacon 12668c76ad4SArd Biesheuvel#ifdef CONFIG_UNWIND_TABLES 12768c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS \ 12868c76ad4SArd Biesheuvel .eh_frame : { \ 12968c76ad4SArd Biesheuvel __eh_frame_start = .; \ 13068c76ad4SArd Biesheuvel *(.eh_frame) \ 13168c76ad4SArd Biesheuvel __eh_frame_end = .; \ 13268c76ad4SArd Biesheuvel } 13368c76ad4SArd Biesheuvel#else 13468c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS 13568c76ad4SArd Biesheuvel#endif 13668c76ad4SArd Biesheuvel 137a352ea3eSArd Biesheuvel/* 138a352ea3eSArd Biesheuvel * The size of the PE/COFF section that covers the kernel image, which 139348a625dSArd Biesheuvel * runs from _stext to _edata, must be a round multiple of the PE/COFF 140348a625dSArd Biesheuvel * FileAlignment, which we set to its minimum value of 0x200. '_stext' 141a352ea3eSArd Biesheuvel * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned 142a352ea3eSArd Biesheuvel * boundary should be sufficient. 143a352ea3eSArd Biesheuvel */ 144a352ea3eSArd BiesheuvelPECOFF_FILE_ALIGNMENT = 0x200; 145a352ea3eSArd Biesheuvel 146a352ea3eSArd Biesheuvel#ifdef CONFIG_EFI 147a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING \ 148a352ea3eSArd Biesheuvel .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); } 149a352ea3eSArd Biesheuvel#else 150a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING 151a352ea3eSArd Biesheuvel#endif 152a352ea3eSArd Biesheuvel 1538c2c3df3SCatalin MarinasSECTIONS 1548c2c3df3SCatalin Marinas{ 1558c2c3df3SCatalin Marinas /* 1568c2c3df3SCatalin Marinas * XXX: The linker does not define how output sections are 1578c2c3df3SCatalin Marinas * assigned to input sections when there are multiple statements 1588c2c3df3SCatalin Marinas * matching the same input section name. There is no documented 1598c2c3df3SCatalin Marinas * order of matching. 1608c2c3df3SCatalin Marinas */ 1612883352bSKees Cook DISCARDS 1628c2c3df3SCatalin Marinas /DISCARD/ : { 1631e48ef7fSArd Biesheuvel *(.interp .dynamic) 1643bbd3db8SArd Biesheuvel *(.dynsym .dynstr .hash .gnu.hash) 1658c2c3df3SCatalin Marinas } 1668c2c3df3SCatalin Marinas 167120dc60dSArd Biesheuvel . = KIMAGE_VADDR; 1688c2c3df3SCatalin Marinas 1698c2c3df3SCatalin Marinas .head.text : { 1708c2c3df3SCatalin Marinas _text = .; 1718c2c3df3SCatalin Marinas HEAD_TEXT 1728c2c3df3SCatalin Marinas } 173e2a073ddSArd Biesheuvel .text : ALIGN(SEGMENT_ALIGN) { /* Real text segment */ 1748c2c3df3SCatalin Marinas _stext = .; /* Text and read-only data */ 1758c2c3df3SCatalin Marinas IRQENTRY_TEXT 176be7635e7SAlexander Potapenko SOFTIRQENTRY_TEXT 177888b3c87SPratyush Anand ENTRY_TEXT 1788c2c3df3SCatalin Marinas TEXT_TEXT 1798c2c3df3SCatalin Marinas SCHED_TEXT 1806727ad9eSChris Metcalf CPUIDLE_TEXT 1818c2c3df3SCatalin Marinas LOCK_TEXT 1822dd0e8d2SSandeepa Prabhu KPROBES_TEXT 1832240bbb6SMarc Zyngier HYPERVISOR_TEXT 1845dfe9d7dSArd Biesheuvel IDMAP_TEXT 1858c2c3df3SCatalin Marinas *(.gnu.warning) 1868c2c3df3SCatalin Marinas . = ALIGN(16); 1878c2c3df3SCatalin Marinas *(.got) /* Global offset table */ 1888c2c3df3SCatalin Marinas } 1898c2c3df3SCatalin Marinas 190be288182SKees Cook /* 191be288182SKees Cook * Make sure that the .got.plt is either completely empty or it 192be288182SKees Cook * contains only the lazy dispatch entries. 193be288182SKees Cook */ 194be288182SKees Cook .got.plt : { *(.got.plt) } 195be288182SKees Cook ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, 196be288182SKees Cook "Unexpected GOT/PLT entries detected!") 197be288182SKees Cook 19897740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 1999fdc14c5SArd Biesheuvel _etext = .; /* End of text section */ 2009fdc14c5SArd Biesheuvel 20119f6bc32SKees Cook /* everything from this point to __init_begin will be marked RO NX */ 20219f6bc32SKees Cook RO_DATA(PAGE_SIZE) 2038c2c3df3SCatalin Marinas 204eb48d154SMarc Zyngier HYPERVISOR_DATA_SECTIONS 205eb48d154SMarc Zyngier 2066ee3cf6aSArd Biesheuvel /* code sections that are never executed via the kernel mapping */ 2076ee3cf6aSArd Biesheuvel .rodata.text : { 2086ee3cf6aSArd Biesheuvel TRAMP_TEXT 2096ee3cf6aSArd Biesheuvel HIBERNATE_TEXT 2106ee3cf6aSArd Biesheuvel KEXEC_TEXT 2116ee3cf6aSArd Biesheuvel . = ALIGN(PAGE_SIZE); 2126ee3cf6aSArd Biesheuvel } 2136ee3cf6aSArd Biesheuvel 2148eb7e28dSJun Yao idmap_pg_dir = .; 215c3cee924SArd Biesheuvel . += PAGE_SIZE; 2168eb7e28dSJun Yao 2178eb7e28dSJun Yao#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 2188eb7e28dSJun Yao tramp_pg_dir = .; 2198eb7e28dSJun Yao . += PAGE_SIZE; 2208eb7e28dSJun Yao#endif 2218eb7e28dSJun Yao 222833be850SMark Rutland reserved_pg_dir = .; 223833be850SMark Rutland . += PAGE_SIZE; 224833be850SMark Rutland 2258eb7e28dSJun Yao swapper_pg_dir = .; 2268eb7e28dSJun Yao . += PAGE_SIZE; 2278eb7e28dSJun Yao 22897740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2298c2c3df3SCatalin Marinas __init_begin = .; 2302ebe088bSArd Biesheuvel __inittext_begin = .; 2318c2c3df3SCatalin Marinas 2328c2c3df3SCatalin Marinas INIT_TEXT_SECTION(8) 233ca2ef4ffSMark Rutland 234ca2ef4ffSMark Rutland __exittext_begin = .; 2358c2c3df3SCatalin Marinas .exit.text : { 2361eae811dSArd Biesheuvel EXIT_TEXT 2378c2c3df3SCatalin Marinas } 238ca2ef4ffSMark Rutland __exittext_end = .; 239da141706SLaura Abbott 2402ebe088bSArd Biesheuvel . = ALIGN(4); 2412ebe088bSArd Biesheuvel .altinstructions : { 2422ebe088bSArd Biesheuvel __alt_instructions = .; 2432ebe088bSArd Biesheuvel *(.altinstructions) 2442ebe088bSArd Biesheuvel __alt_instructions_end = .; 2452ebe088bSArd Biesheuvel } 2462ebe088bSArd Biesheuvel 24768c76ad4SArd Biesheuvel UNWIND_DATA_SECTIONS 24868c76ad4SArd Biesheuvel 24976085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2502ebe088bSArd Biesheuvel __inittext_end = .; 2512ebe088bSArd Biesheuvel __initdata_begin = .; 2522ebe088bSArd Biesheuvel 253c3cee924SArd Biesheuvel init_idmap_pg_dir = .; 254c3cee924SArd Biesheuvel . += INIT_IDMAP_DIR_SIZE; 255c3cee924SArd Biesheuvel init_idmap_pg_end = .; 256c3cee924SArd Biesheuvel 2578c2c3df3SCatalin Marinas .init.data : { 2588c2c3df3SCatalin Marinas INIT_DATA 2598c2c3df3SCatalin Marinas INIT_SETUP(16) 2608c2c3df3SCatalin Marinas INIT_CALLS 2618c2c3df3SCatalin Marinas CON_INITCALL 2628c2c3df3SCatalin Marinas INIT_RAM_FS 263ba4259a6SCatalin Marinas *(.init.altinstructions .init.bss) /* from the EFI stub */ 2648c2c3df3SCatalin Marinas } 2658c2c3df3SCatalin Marinas .exit.data : { 2661eae811dSArd Biesheuvel EXIT_DATA 2678c2c3df3SCatalin Marinas } 2688c2c3df3SCatalin Marinas 26998fb7548SArd Biesheuvel PERCPU_SECTION(L1_CACHE_BYTES) 27030c95391SDavid Brazdil HYPERVISOR_PERCPU_SECTION 2718c2c3df3SCatalin Marinas 2728c49b5d4SDavid Brazdil HYPERVISOR_RELOC_SECTION 2738c49b5d4SDavid Brazdil 2743bbd3db8SArd Biesheuvel .rela.dyn : ALIGN(8) { 275d7bea550SArd Biesheuvel __rela_start = .; 2761e48ef7fSArd Biesheuvel *(.rela .rela*) 277d7bea550SArd Biesheuvel __rela_end = .; 2781e48ef7fSArd Biesheuvel } 279e039ee4eSAndre Przywara 2805cf896fbSPeter Collingbourne .relr.dyn : ALIGN(8) { 281d7bea550SArd Biesheuvel __relr_start = .; 2825cf896fbSPeter Collingbourne *(.relr.dyn) 283d7bea550SArd Biesheuvel __relr_end = .; 2845cf896fbSPeter Collingbourne } 2855cf896fbSPeter Collingbourne 28697740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2872ebe088bSArd Biesheuvel __initdata_end = .; 2889aa4ec15SMark Rutland __init_end = .; 2899aa4ec15SMark Rutland 2903c620626SMark Salter _data = .; 2918c2c3df3SCatalin Marinas _sdata = .; 292c9174047SKees Cook RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) 293b6113038SJames Morse 294b6113038SJames Morse /* 295b6113038SJames Morse * Data written with the MMU off but read with the MMU on requires 296b6113038SJames Morse * cache lines to be invalidated, discarding up to a Cache Writeback 297b6113038SJames Morse * Granule (CWG) of data from the cache. Keep the section that 298b6113038SJames Morse * requires this type of maintenance to be in its own Cache Writeback 299b6113038SJames Morse * Granule (CWG) area so the cache maintenance operations don't 300b6113038SJames Morse * interfere with adjacent data. 301b6113038SJames Morse */ 302b6113038SJames Morse .mmuoff.data.write : ALIGN(SZ_2K) { 303b6113038SJames Morse __mmuoff_data_start = .; 304b6113038SJames Morse *(.mmuoff.data.write) 305b6113038SJames Morse } 306b6113038SJames Morse . = ALIGN(SZ_2K); 307b6113038SJames Morse .mmuoff.data.read : { 308b6113038SJames Morse *(.mmuoff.data.read) 309b6113038SJames Morse __mmuoff_data_end = .; 310b6113038SJames Morse } 311b6113038SJames Morse 312a352ea3eSArd Biesheuvel PECOFF_EDATA_PADDING 313cad27ef2SArd Biesheuvel __pecoff_data_rawsize = ABSOLUTE(. - __initdata_begin); 3148c2c3df3SCatalin Marinas _edata = .; 3158c2c3df3SCatalin Marinas 316380e18adSQuentin Perret BSS_SECTION(SBSS_ALIGN, 0, 0) 317bd00cd5fSMark Rutland 318bd00cd5fSMark Rutland . = ALIGN(PAGE_SIZE); 3192b5548b6SJun Yao init_pg_dir = .; 3202b5548b6SJun Yao . += INIT_DIR_SIZE; 3212b5548b6SJun Yao init_pg_end = .; 3222b5548b6SJun Yao 32376085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 324cad27ef2SArd Biesheuvel __pecoff_data_size = ABSOLUTE(. - __initdata_begin); 3258c2c3df3SCatalin Marinas _end = .; 3268c2c3df3SCatalin Marinas 3278c2c3df3SCatalin Marinas STABS_DEBUG 328578d7f0fSKees Cook DWARF_DEBUG 329c604abc3SKees Cook ELF_DETAILS 330a2c1d73bSMark Rutland 331a2c1d73bSMark Rutland HEAD_SYMBOLS 332be288182SKees Cook 333be288182SKees Cook /* 334be288182SKees Cook * Sections that should stay zero sized, which is safer to 335be288182SKees Cook * explicitly check instead of blindly discarding. 336be288182SKees Cook */ 337be288182SKees Cook .plt : { 3385f692a81SArd Biesheuvel *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) 339be288182SKees Cook } 340be288182SKees Cook ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") 341be288182SKees Cook 342be288182SKees Cook .data.rel.ro : { *(.data.rel.ro) } 343be288182SKees Cook ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") 3448c2c3df3SCatalin Marinas} 3452240bbb6SMarc Zyngier 34690776dd1SKees Cook#include "image-vars.h" 34790776dd1SKees Cook 3482240bbb6SMarc Zyngier/* 349b83042f0SQuentin Perret * The HYP init code and ID map text can't be longer than a page each. The 350b83042f0SQuentin Perret * former is page-aligned, but the latter may not be with 16K or 64K pages, so 351b83042f0SQuentin Perret * it should also not cross a page boundary. 3522240bbb6SMarc Zyngier */ 353b83042f0SQuentin PerretASSERT(__hyp_idmap_text_end - __hyp_idmap_text_start <= PAGE_SIZE, 354b83042f0SQuentin Perret "HYP init code too big") 3555dfe9d7dSArd BiesheuvelASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K, 3565dfe9d7dSArd Biesheuvel "ID map text too big or misaligned") 35782869ac5SJames Morse#ifdef CONFIG_HIBERNATION 3586ee3cf6aSArd BiesheuvelASSERT(__hibernate_exit_text_end - __hibernate_exit_text_start <= SZ_4K, 3596ee3cf6aSArd Biesheuvel "Hibernate exit text is bigger than 4 KiB") 360*dc4824faSMark RutlandASSERT(__hibernate_exit_text_start == swsusp_arch_suspend_exit, 361*dc4824faSMark Rutland "Hibernate exit text does not start with swsusp_arch_suspend_exit") 36282869ac5SJames Morse#endif 3636c27c408SWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 364a9c406e6SJames MorseASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE, 3656c27c408SWill Deacon "Entry trampoline text too big") 3666c27c408SWill Deacon#endif 367380e18adSQuentin Perret#ifdef CONFIG_KVM 368380e18adSQuentin PerretASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned") 369380e18adSQuentin Perret#endif 370da57a369SMark Rutland/* 371da57a369SMark Rutland * If padding is applied before .head.text, virt<->phys conversions will fail. 372da57a369SMark Rutland */ 373120dc60dSArd BiesheuvelASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 37400ef5434SJoey Gouly 37500ef5434SJoey GoulyASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET, 37600ef5434SJoey Gouly "RESERVED_SWAPPER_OFFSET is wrong!") 3770188a894SJoey Gouly 3780188a894SJoey Gouly#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 3790188a894SJoey GoulyASSERT(swapper_pg_dir - tramp_pg_dir == TRAMP_SWAPPER_OFFSET, 3800188a894SJoey Gouly "TRAMP_SWAPPER_OFFSET is wrong!") 3810188a894SJoey Gouly#endif 38219a046f0SPasha Tatashin 38319a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE 38419a046f0SPasha Tatashin/* kexec relocation code should fit into one KEXEC_CONTROL_PAGE_SIZE */ 3856ee3cf6aSArd BiesheuvelASSERT(__relocate_new_kernel_end - __relocate_new_kernel_start <= SZ_4K, 3866ee3cf6aSArd Biesheuvel "kexec relocation code is bigger than 4 KiB") 38719a046f0SPasha TatashinASSERT(KEXEC_CONTROL_PAGE_SIZE >= SZ_4K, "KEXEC_CONTROL_PAGE_SIZE is broken") 388*dc4824faSMark RutlandASSERT(__relocate_new_kernel_start == arm64_relocate_new_kernel, 389*dc4824faSMark Rutland "kexec control page does not start with arm64_relocate_new_kernel") 39019a046f0SPasha Tatashin#endif 391