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 PROVIDE(__efistub_primary_entry = primary_entry); 14 15 /* 16 * The EFI stub has its own symbol namespace prefixed by __efistub_, to 17 * isolate it from the kernel proper. The following symbols are legally 18 * accessed by the stub, so provide some aliases to make them accessible. 19 * Only include data symbols here, or text symbols of functions that are 20 * guaranteed to be safe when executed at another offset than they were 21 * linked at. The routines below are all implemented in assembler in a 22 * position independent manner 23 */ 24 PROVIDE(__efistub_caches_clean_inval_pou = __pi_caches_clean_inval_pou); 25 26 PROVIDE(__efistub__text = _text); 27 PROVIDE(__efistub__end = _end); 28 PROVIDE(__efistub___inittext_end = __inittext_end); 29 PROVIDE(__efistub__edata = _edata); 30 #if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) 31 PROVIDE(__efistub_screen_info = screen_info); 32 #endif 33 PROVIDE(__efistub__ctype = _ctype); 34 35 PROVIDE(__pi___memcpy = __pi_memcpy); 36 PROVIDE(__pi___memmove = __pi_memmove); 37 PROVIDE(__pi___memset = __pi_memset); 38 39 #ifdef CONFIG_KVM 40 41 /* 42 * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 43 * separate it from the kernel proper. The following symbols are legally 44 * accessed by it, therefore provide aliases to make them linkable. 45 * Do not include symbols which may not be safely accessed under hypervisor 46 * memory mappings. 47 */ 48 49 /* Alternative callbacks for init-time patching of nVHE hyp code. */ 50 KVM_NVHE_ALIAS(kvm_patch_vector_branch); 51 KVM_NVHE_ALIAS(kvm_update_va_mask); 52 KVM_NVHE_ALIAS(kvm_get_kimage_voffset); 53 KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0); 54 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter); 55 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable); 56 KVM_NVHE_ALIAS(spectre_bhb_patch_wa3); 57 KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb); 58 KVM_NVHE_ALIAS(alt_cb_patch_nops); 59 60 /* Global kernel state accessed by nVHE hyp code. */ 61 KVM_NVHE_ALIAS(kvm_vgic_global_state); 62 63 /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 64 KVM_NVHE_ALIAS(nvhe_hyp_panic_handler); 65 66 /* Vectors installed by hyp-init on reset HVC. */ 67 KVM_NVHE_ALIAS(__hyp_stub_vectors); 68 69 /* Static keys which are set if a vGIC trap should be handled in hyp. */ 70 KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 71 KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 72 73 #ifdef CONFIG_ARM64_PSEUDO_NMI 74 /* Static key checked in GIC_PRIO_IRQOFF. */ 75 KVM_NVHE_ALIAS(gic_nonsecure_priorities); 76 #endif 77 78 /* EL2 exception handling */ 79 KVM_NVHE_ALIAS(__start___kvm_ex_table); 80 KVM_NVHE_ALIAS(__stop___kvm_ex_table); 81 82 /* PMU available static key */ 83 #ifdef CONFIG_HW_PERF_EVENTS 84 KVM_NVHE_ALIAS(kvm_arm_pmu_available); 85 #endif 86 87 /* Position-independent library routines */ 88 KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); 89 KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); 90 KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); 91 KVM_NVHE_ALIAS_HYP(memset, __pi_memset); 92 93 #ifdef CONFIG_KASAN 94 KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); 95 KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); 96 #endif 97 98 /* Hyp memory sections */ 99 KVM_NVHE_ALIAS(__hyp_idmap_text_start); 100 KVM_NVHE_ALIAS(__hyp_idmap_text_end); 101 KVM_NVHE_ALIAS(__hyp_text_start); 102 KVM_NVHE_ALIAS(__hyp_text_end); 103 KVM_NVHE_ALIAS(__hyp_bss_start); 104 KVM_NVHE_ALIAS(__hyp_bss_end); 105 KVM_NVHE_ALIAS(__hyp_rodata_start); 106 KVM_NVHE_ALIAS(__hyp_rodata_end); 107 108 /* pKVM static key */ 109 KVM_NVHE_ALIAS(kvm_protected_mode_initialized); 110 111 #endif /* CONFIG_KVM */ 112 113 #ifdef CONFIG_EFI_ZBOOT 114 _kernel_codesize = ABSOLUTE(__inittext_end - _text); 115 #endif 116 117 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ 118