image-vars.h (4610B)
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#ifdef CONFIG_EFI 14 15__efistub_kernel_size = _edata - _text; 16__efistub_primary_entry_offset = primary_entry - _text; 17 18 19/* 20 * The EFI stub has its own symbol namespace prefixed by __efistub_, to 21 * isolate it from the kernel proper. The following symbols are legally 22 * accessed by the stub, so provide some aliases to make them accessible. 23 * Only include data symbols here, or text symbols of functions that are 24 * guaranteed to be safe when executed at another offset than they were 25 * linked at. The routines below are all implemented in assembler in a 26 * position independent manner 27 */ 28__efistub_memcmp = __pi_memcmp; 29__efistub_memchr = __pi_memchr; 30__efistub_memcpy = __pi_memcpy; 31__efistub_memmove = __pi_memmove; 32__efistub_memset = __pi_memset; 33__efistub_strlen = __pi_strlen; 34__efistub_strnlen = __pi_strnlen; 35__efistub_strcmp = __pi_strcmp; 36__efistub_strncmp = __pi_strncmp; 37__efistub_strrchr = __pi_strrchr; 38__efistub_dcache_clean_poc = __pi_dcache_clean_poc; 39 40#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) 41__efistub___memcpy = __pi_memcpy; 42__efistub___memmove = __pi_memmove; 43__efistub___memset = __pi_memset; 44#endif 45 46__efistub__text = _text; 47__efistub__end = _end; 48__efistub__edata = _edata; 49__efistub_screen_info = screen_info; 50__efistub__ctype = _ctype; 51 52#endif 53 54#ifdef CONFIG_KVM 55 56/* 57 * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 58 * separate it from the kernel proper. The following symbols are legally 59 * accessed by it, therefore provide aliases to make them linkable. 60 * Do not include symbols which may not be safely accessed under hypervisor 61 * memory mappings. 62 */ 63 64/* Alternative callbacks for init-time patching of nVHE hyp code. */ 65KVM_NVHE_ALIAS(kvm_patch_vector_branch); 66KVM_NVHE_ALIAS(kvm_update_va_mask); 67KVM_NVHE_ALIAS(kvm_get_kimage_voffset); 68KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0); 69KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter); 70KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable); 71KVM_NVHE_ALIAS(spectre_bhb_patch_wa3); 72KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb); 73 74/* Global kernel state accessed by nVHE hyp code. */ 75KVM_NVHE_ALIAS(kvm_vgic_global_state); 76 77/* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 78KVM_NVHE_ALIAS(nvhe_hyp_panic_handler); 79 80/* Vectors installed by hyp-init on reset HVC. */ 81KVM_NVHE_ALIAS(__hyp_stub_vectors); 82 83/* Kernel symbol used by icache_is_vpipt(). */ 84KVM_NVHE_ALIAS(__icache_flags); 85 86/* VMID bits set by the KVM VMID allocator */ 87KVM_NVHE_ALIAS(kvm_arm_vmid_bits); 88 89/* Kernel symbols needed for cpus_have_final/const_caps checks. */ 90KVM_NVHE_ALIAS(arm64_const_caps_ready); 91KVM_NVHE_ALIAS(cpu_hwcap_keys); 92 93/* Static keys which are set if a vGIC trap should be handled in hyp. */ 94KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 95KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 96 97/* Static key checked in pmr_sync(). */ 98#ifdef CONFIG_ARM64_PSEUDO_NMI 99KVM_NVHE_ALIAS(gic_pmr_sync); 100/* Static key checked in GIC_PRIO_IRQOFF. */ 101KVM_NVHE_ALIAS(gic_nonsecure_priorities); 102#endif 103 104/* EL2 exception handling */ 105KVM_NVHE_ALIAS(__start___kvm_ex_table); 106KVM_NVHE_ALIAS(__stop___kvm_ex_table); 107 108/* Array containing bases of nVHE per-CPU memory regions. */ 109KVM_NVHE_ALIAS(kvm_arm_hyp_percpu_base); 110 111/* PMU available static key */ 112#ifdef CONFIG_HW_PERF_EVENTS 113KVM_NVHE_ALIAS(kvm_arm_pmu_available); 114#endif 115 116/* Position-independent library routines */ 117KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page); 118KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page); 119KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy); 120KVM_NVHE_ALIAS_HYP(memset, __pi_memset); 121 122#ifdef CONFIG_KASAN 123KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy); 124KVM_NVHE_ALIAS_HYP(__memset, __pi_memset); 125#endif 126 127/* Kernel memory sections */ 128KVM_NVHE_ALIAS(__start_rodata); 129KVM_NVHE_ALIAS(__end_rodata); 130KVM_NVHE_ALIAS(__bss_start); 131KVM_NVHE_ALIAS(__bss_stop); 132 133/* Hyp memory sections */ 134KVM_NVHE_ALIAS(__hyp_idmap_text_start); 135KVM_NVHE_ALIAS(__hyp_idmap_text_end); 136KVM_NVHE_ALIAS(__hyp_text_start); 137KVM_NVHE_ALIAS(__hyp_text_end); 138KVM_NVHE_ALIAS(__hyp_bss_start); 139KVM_NVHE_ALIAS(__hyp_bss_end); 140KVM_NVHE_ALIAS(__hyp_rodata_start); 141KVM_NVHE_ALIAS(__hyp_rodata_end); 142 143/* pKVM static key */ 144KVM_NVHE_ALIAS(kvm_protected_mode_initialized); 145 146#endif /* CONFIG_KVM */ 147 148#endif /* __ARM64_KERNEL_IMAGE_VARS_H */