Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Linker script variables to be set after section resolution, as
0004  * ld.lld does not like variables assigned before SECTIONS is processed.
0005  */
0006 #ifndef __ARM64_KERNEL_IMAGE_VARS_H
0007 #define __ARM64_KERNEL_IMAGE_VARS_H
0008 
0009 #ifndef LINKER_SCRIPT
0010 #error This file should only be included in vmlinux.lds.S
0011 #endif
0012 
0013 PROVIDE(__efistub_kernel_size       = _edata - _text);
0014 PROVIDE(__efistub_primary_entry_offset  = primary_entry - _text);
0015 
0016 /*
0017  * The EFI stub has its own symbol namespace prefixed by __efistub_, to
0018  * isolate it from the kernel proper. The following symbols are legally
0019  * accessed by the stub, so provide some aliases to make them accessible.
0020  * Only include data symbols here, or text symbols of functions that are
0021  * guaranteed to be safe when executed at another offset than they were
0022  * linked at. The routines below are all implemented in assembler in a
0023  * position independent manner
0024  */
0025 PROVIDE(__efistub_memcmp        = __pi_memcmp);
0026 PROVIDE(__efistub_memchr        = __pi_memchr);
0027 PROVIDE(__efistub_memcpy        = __pi_memcpy);
0028 PROVIDE(__efistub_memmove       = __pi_memmove);
0029 PROVIDE(__efistub_memset        = __pi_memset);
0030 PROVIDE(__efistub_strlen        = __pi_strlen);
0031 PROVIDE(__efistub_strnlen       = __pi_strnlen);
0032 PROVIDE(__efistub_strcmp        = __pi_strcmp);
0033 PROVIDE(__efistub_strncmp       = __pi_strncmp);
0034 PROVIDE(__efistub_strrchr       = __pi_strrchr);
0035 PROVIDE(__efistub_dcache_clean_poc  = __pi_dcache_clean_poc);
0036 
0037 PROVIDE(__efistub__text         = _text);
0038 PROVIDE(__efistub__end          = _end);
0039 PROVIDE(__efistub__edata        = _edata);
0040 PROVIDE(__efistub_screen_info       = screen_info);
0041 PROVIDE(__efistub__ctype        = _ctype);
0042 
0043 /*
0044  * The __ prefixed memcpy/memset/memmove symbols are provided by KASAN, which
0045  * instruments the conventional ones. Therefore, any references from the EFI
0046  * stub or other position independent, low level C code should be redirected to
0047  * the non-instrumented versions as well.
0048  */
0049 PROVIDE(__efistub___memcpy      = __pi_memcpy);
0050 PROVIDE(__efistub___memmove     = __pi_memmove);
0051 PROVIDE(__efistub___memset      = __pi_memset);
0052 
0053 PROVIDE(__pi___memcpy           = __pi_memcpy);
0054 PROVIDE(__pi___memmove          = __pi_memmove);
0055 PROVIDE(__pi___memset           = __pi_memset);
0056 
0057 #ifdef CONFIG_KVM
0058 
0059 /*
0060  * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to
0061  * separate it from the kernel proper. The following symbols are legally
0062  * accessed by it, therefore provide aliases to make them linkable.
0063  * Do not include symbols which may not be safely accessed under hypervisor
0064  * memory mappings.
0065  */
0066 
0067 /* Alternative callbacks for init-time patching of nVHE hyp code. */
0068 KVM_NVHE_ALIAS(kvm_patch_vector_branch);
0069 KVM_NVHE_ALIAS(kvm_update_va_mask);
0070 KVM_NVHE_ALIAS(kvm_get_kimage_voffset);
0071 KVM_NVHE_ALIAS(kvm_compute_final_ctr_el0);
0072 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_iter);
0073 KVM_NVHE_ALIAS(spectre_bhb_patch_loop_mitigation_enable);
0074 KVM_NVHE_ALIAS(spectre_bhb_patch_wa3);
0075 KVM_NVHE_ALIAS(spectre_bhb_patch_clearbhb);
0076 
0077 /* Global kernel state accessed by nVHE hyp code. */
0078 KVM_NVHE_ALIAS(kvm_vgic_global_state);
0079 
0080 /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */
0081 KVM_NVHE_ALIAS(nvhe_hyp_panic_handler);
0082 
0083 /* Vectors installed by hyp-init on reset HVC. */
0084 KVM_NVHE_ALIAS(__hyp_stub_vectors);
0085 
0086 /* Kernel symbol used by icache_is_vpipt(). */
0087 KVM_NVHE_ALIAS(__icache_flags);
0088 
0089 /* VMID bits set by the KVM VMID allocator */
0090 KVM_NVHE_ALIAS(kvm_arm_vmid_bits);
0091 
0092 /* Kernel symbols needed for cpus_have_final/const_caps checks. */
0093 KVM_NVHE_ALIAS(arm64_const_caps_ready);
0094 KVM_NVHE_ALIAS(cpu_hwcap_keys);
0095 
0096 /* Static keys which are set if a vGIC trap should be handled in hyp. */
0097 KVM_NVHE_ALIAS(vgic_v2_cpuif_trap);
0098 KVM_NVHE_ALIAS(vgic_v3_cpuif_trap);
0099 
0100 /* Static key checked in pmr_sync(). */
0101 #ifdef CONFIG_ARM64_PSEUDO_NMI
0102 KVM_NVHE_ALIAS(gic_pmr_sync);
0103 /* Static key checked in GIC_PRIO_IRQOFF. */
0104 KVM_NVHE_ALIAS(gic_nonsecure_priorities);
0105 #endif
0106 
0107 /* EL2 exception handling */
0108 KVM_NVHE_ALIAS(__start___kvm_ex_table);
0109 KVM_NVHE_ALIAS(__stop___kvm_ex_table);
0110 
0111 /* Array containing bases of nVHE per-CPU memory regions. */
0112 KVM_NVHE_ALIAS(kvm_arm_hyp_percpu_base);
0113 
0114 /* PMU available static key */
0115 #ifdef CONFIG_HW_PERF_EVENTS
0116 KVM_NVHE_ALIAS(kvm_arm_pmu_available);
0117 #endif
0118 
0119 /* Position-independent library routines */
0120 KVM_NVHE_ALIAS_HYP(clear_page, __pi_clear_page);
0121 KVM_NVHE_ALIAS_HYP(copy_page, __pi_copy_page);
0122 KVM_NVHE_ALIAS_HYP(memcpy, __pi_memcpy);
0123 KVM_NVHE_ALIAS_HYP(memset, __pi_memset);
0124 
0125 #ifdef CONFIG_KASAN
0126 KVM_NVHE_ALIAS_HYP(__memcpy, __pi_memcpy);
0127 KVM_NVHE_ALIAS_HYP(__memset, __pi_memset);
0128 #endif
0129 
0130 /* Kernel memory sections */
0131 KVM_NVHE_ALIAS(__start_rodata);
0132 KVM_NVHE_ALIAS(__end_rodata);
0133 KVM_NVHE_ALIAS(__bss_start);
0134 KVM_NVHE_ALIAS(__bss_stop);
0135 
0136 /* Hyp memory sections */
0137 KVM_NVHE_ALIAS(__hyp_idmap_text_start);
0138 KVM_NVHE_ALIAS(__hyp_idmap_text_end);
0139 KVM_NVHE_ALIAS(__hyp_text_start);
0140 KVM_NVHE_ALIAS(__hyp_text_end);
0141 KVM_NVHE_ALIAS(__hyp_bss_start);
0142 KVM_NVHE_ALIAS(__hyp_bss_end);
0143 KVM_NVHE_ALIAS(__hyp_rodata_start);
0144 KVM_NVHE_ALIAS(__hyp_rodata_end);
0145 
0146 /* pKVM static key */
0147 KVM_NVHE_ALIAS(kvm_protected_mode_initialized);
0148 
0149 #endif /* CONFIG_KVM */
0150 
0151 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */