1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Linker script variables to be set after section resolution, as 4 * ld.lld does not like variables assigned before SECTIONS is processed. 5 */ 6 #ifndef __ARM64_KERNEL_IMAGE_VARS_H 7 #define __ARM64_KERNEL_IMAGE_VARS_H 8 9 #ifndef LINKER_SCRIPT 10 #error This file should only be included in vmlinux.lds.S 11 #endif 12 13 #define PI_EXPORT_SYM(sym) \ 14 __PI_EXPORT_SYM(sym, __pi_ ## sym, Cannot export BSS symbol sym to startup code) 15 #define __PI_EXPORT_SYM(sym, pisym, msg)\ 16 PROVIDE(pisym = sym); \ 17 ASSERT((sym - KIMAGE_VADDR) < (__bss_start - KIMAGE_VADDR), #msg) 18 19 PROVIDE(__efistub_primary_entry = primary_entry); 20 21 /* 22 * The EFI stub has its own symbol namespace prefixed by __efistub_, to 23 * isolate it from the kernel proper. The following symbols are legally 24 * accessed by the stub, so provide some aliases to make them accessible. 25 * Only include data symbols here, or text symbols of functions that are 26 * guaranteed to be safe when executed at another offset than they were 27 * linked at. The routines below are all implemented in assembler in a 28 * position independent manner 29 */ 30 PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou); 31 32 PROVIDE(__efistub__text = _text); 33 PROVIDE(__efistub__end = _end); 34 PROVIDE(__efistub___inittext_end = __inittext_end); 35 PROVIDE(__efistub__edata = _edata); 36 #if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) 37 PROVIDE(__efistub_screen_info = screen_info); 38 #endif 39 PROVIDE(__efistub__ctype = _ctype); 40 41 PROVIDE(__pi___memcpy = __pi_memcpy); 42 PROVIDE(__pi___memmove = __pi_memmove); 43 PROVIDE(__pi___memset = __pi_memset); 44 45 PI_EXPORT_SYM(id_aa64isar1_override); 46 PI_EXPORT_SYM(id_aa64isar2_override); 47 PI_EXPORT_SYM(id_aa64mmfr0_override); 48 PI_EXPORT_SYM(id_aa64mmfr1_override); 49 PI_EXPORT_SYM(id_aa64mmfr2_override); 50 PI_EXPORT_SYM(id_aa64pfr0_override); 51 PI_EXPORT_SYM(id_aa64pfr1_override); 52 PI_EXPORT_SYM(id_aa64smfr0_override); 53 PI_EXPORT_SYM(id_aa64zfr0_override); 54 PI_EXPORT_SYM(arm64_sw_feature_override); 55 PI_EXPORT_SYM(arm64_use_ng_mappings); 56 PI_EXPORT_SYM(_ctype); 57 58 PI_EXPORT_SYM(swapper_pg_dir); 59 60 PI_EXPORT_SYM(_text); 61 PI_EXPORT_SYM(_stext); 62 PI_EXPORT_SYM(_etext); 63 PI_EXPORT_SYM(__start_rodata); 64 PI_EXPORT_SYM(__inittext_begin); 65 PI_EXPORT_SYM(__inittext_end); 66 PI_EXPORT_SYM(__initdata_begin); 67 PI_EXPORT_SYM(__initdata_end); 68 PI_EXPORT_SYM(_data); 69 70 #ifdef CONFIG_KVM 71 72 /* 73 * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 74 * separate it from the kernel proper. The following symbols are legally 75 * accessed by it, therefore provide aliases to make them linkable. 76 * Do not include symbols which may not be safely accessed under hypervisor 77 * memory mappings. 78 */ 79 80 /* Alternative callbacks for init-time patching of nVHE hyp code. */ 81 KVM_NVHE_ALIAS(kvm_patch_vector_branch); 82 KVM_NVHE_ALIAS(kvm_update_va_mask); 83 KVM_NVHE_ALIAS(kvm_get_kimage_voffset); 84 KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0); 85 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter); 86 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable); 87 KVM_NVHE_ALIAS(spectre_bhb_patch_wa3); 88 KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb); 89 KVM_NVHE_ALIAS(alt_cb_patch_nops); 90 91 /* Global kernel state accessed by nVHE hyp code. */ 92 KVM_NVHE_ALIAS(kvm_vgic_global_state); 93 94 /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 95 KVM_NVHE_ALIAS(nvhe_hyp_panic_handler); 96 97 /* Vectors installed by hyp-init on reset HVC. */ 98 KVM_NVHE_ALIAS(__hyp_stub_vectors); 99 100 /* Static keys which are set if a vGIC trap should be handled in hyp. */ 101 KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 102 KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 103 104 /* Static key which is set if CNTVOFF_EL2 is unusable */ 105 KVM_NVHE_ALIAS(broken_cntvoff_key); 106 107 /* EL2 exception handling */ 108 KVM_NVHE_ALIAS(__start___kvm_ex_table); 109 KVM_NVHE_ALIAS(__stop___kvm_ex_table); 110 111 /* Position-independent library routines */ 112 KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); 113 KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); 114 KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); 115 KVM_NVHE_ALIAS_HYP(memset, __pi_memset); 116 117 #ifdef CONFIG_KASAN 118 KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); 119 KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); 120 #endif 121 122 /* Hyp memory sections */ 123 KVM_NVHE_ALIAS(__hyp_idmap_text_start); 124 KVM_NVHE_ALIAS(__hyp_idmap_text_end); 125 KVM_NVHE_ALIAS(__hyp_text_start); 126 KVM_NVHE_ALIAS(__hyp_text_end); 127 KVM_NVHE_ALIAS(__hyp_bss_start); 128 KVM_NVHE_ALIAS(__hyp_bss_end); 129 KVM_NVHE_ALIAS(__hyp_rodata_start); 130 KVM_NVHE_ALIAS(__hyp_rodata_end); 131 132 /* pKVM static key */ 133 KVM_NVHE_ALIAS(kvm_protected_mode_initialized); 134 135 #endif /* CONFIG_KVM */ 136 137 #ifdef CONFIG_EFI_ZBOOT 138 _kernel_codesize = ABSOLUTE(__inittext_end - _text); 139 #endif 140 141 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ 142