190776dd1SKees Cook /* SPDX-License-Identifier: GPL-2.0-only */ 290776dd1SKees Cook /* 390776dd1SKees Cook * Linker script variables to be set after section resolution, as 490776dd1SKees Cook * ld.lld does not like variables assigned before SECTIONS is processed. 590776dd1SKees Cook */ 690776dd1SKees Cook #ifndef __ARM64_KERNEL_IMAGE_VARS_H 790776dd1SKees Cook #define __ARM64_KERNEL_IMAGE_VARS_H 890776dd1SKees Cook 990776dd1SKees Cook #ifndef LINKER_SCRIPT 1090776dd1SKees Cook #error This file should only be included in vmlinux.lds.S 1190776dd1SKees Cook #endif 1290776dd1SKees Cook 1390776dd1SKees Cook #ifdef CONFIG_EFI 1490776dd1SKees Cook 159f922377SArd Biesheuvel __efistub_kernel_size = _edata - _text; 16348a625dSArd Biesheuvel __efistub_primary_entry_offset = primary_entry - _text; 179f922377SArd Biesheuvel 1890776dd1SKees Cook 1990776dd1SKees Cook /* 2090776dd1SKees Cook * The EFI stub has its own symbol namespace prefixed by __efistub_, to 2190776dd1SKees Cook * isolate it from the kernel proper. The following symbols are legally 2290776dd1SKees Cook * accessed by the stub, so provide some aliases to make them accessible. 2390776dd1SKees Cook * Only include data symbols here, or text symbols of functions that are 2490776dd1SKees Cook * guaranteed to be safe when executed at another offset than they were 2590776dd1SKees Cook * linked at. The routines below are all implemented in assembler in a 2690776dd1SKees Cook * position independent manner 2790776dd1SKees Cook */ 2890776dd1SKees Cook __efistub_memcmp = __pi_memcmp; 2990776dd1SKees Cook __efistub_memchr = __pi_memchr; 3090776dd1SKees Cook __efistub_memcpy = __pi_memcpy; 3190776dd1SKees Cook __efistub_memmove = __pi_memmove; 3290776dd1SKees Cook __efistub_memset = __pi_memset; 3390776dd1SKees Cook __efistub_strlen = __pi_strlen; 3490776dd1SKees Cook __efistub_strnlen = __pi_strnlen; 3590776dd1SKees Cook __efistub_strcmp = __pi_strcmp; 3690776dd1SKees Cook __efistub_strncmp = __pi_strncmp; 3790776dd1SKees Cook __efistub_strrchr = __pi_strrchr; 38b9676962SArd Biesheuvel __efistub___clean_dcache_area_poc = __pi___clean_dcache_area_poc; 3990776dd1SKees Cook 4090776dd1SKees Cook #ifdef CONFIG_KASAN 4190776dd1SKees Cook __efistub___memcpy = __pi_memcpy; 4290776dd1SKees Cook __efistub___memmove = __pi_memmove; 4390776dd1SKees Cook __efistub___memset = __pi_memset; 4490776dd1SKees Cook #endif 4590776dd1SKees Cook 4690776dd1SKees Cook __efistub__text = _text; 4790776dd1SKees Cook __efistub__end = _end; 4890776dd1SKees Cook __efistub__edata = _edata; 4990776dd1SKees Cook __efistub_screen_info = screen_info; 5091d150c0SArd Biesheuvel __efistub__ctype = _ctype; 5190776dd1SKees Cook 5290776dd1SKees Cook #endif 5390776dd1SKees Cook 5476217129SDavid Brazdil #ifdef CONFIG_KVM 5576217129SDavid Brazdil 5676217129SDavid Brazdil /* 5776217129SDavid Brazdil * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to 5876217129SDavid Brazdil * separate it from the kernel proper. The following symbols are legally 5976217129SDavid Brazdil * accessed by it, therefore provide aliases to make them linkable. 6076217129SDavid Brazdil * Do not include symbols which may not be safely accessed under hypervisor 6176217129SDavid Brazdil * memory mappings. 6276217129SDavid Brazdil */ 6376217129SDavid Brazdil 6476217129SDavid Brazdil #define KVM_NVHE_ALIAS(sym) __kvm_nvhe_##sym = sym; 6576217129SDavid Brazdil 66b877e984SDavid Brazdil /* Alternative callbacks for init-time patching of nVHE hyp code. */ 67b877e984SDavid Brazdil KVM_NVHE_ALIAS(arm64_enable_wa2_handling); 68b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_patch_vector_branch); 69b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_update_va_mask); 70b877e984SDavid Brazdil 71b877e984SDavid Brazdil /* Global kernel state accessed by nVHE hyp code. */ 72b877e984SDavid Brazdil KVM_NVHE_ALIAS(arm64_ssbd_callback_required); 73b877e984SDavid Brazdil KVM_NVHE_ALIAS(kvm_host_data); 7409cf57ebSDavid Brazdil KVM_NVHE_ALIAS(kvm_vgic_global_state); 75b877e984SDavid Brazdil 76b877e984SDavid Brazdil /* Kernel constant needed to compute idmap addresses. */ 77b877e984SDavid Brazdil KVM_NVHE_ALIAS(kimage_voffset); 78b877e984SDavid Brazdil 79b877e984SDavid Brazdil /* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ 8009cf57ebSDavid Brazdil KVM_NVHE_ALIAS(__hyp_panic_string); 81b877e984SDavid Brazdil KVM_NVHE_ALIAS(panic); 82b877e984SDavid Brazdil 83208243c7SAndrew Scull /* Vectors installed by hyp-init on reset HVC. */ 84208243c7SAndrew Scull KVM_NVHE_ALIAS(__hyp_stub_vectors); 85208243c7SAndrew Scull 86208243c7SAndrew Scull /* IDMAP TCR_EL1.T0SZ as computed by the EL1 init code */ 87208243c7SAndrew Scull KVM_NVHE_ALIAS(idmap_t0sz); 88208243c7SAndrew Scull 89e03fa291SDavid Brazdil /* Kernel symbol used by icache_is_vpipt(). */ 90e03fa291SDavid Brazdil KVM_NVHE_ALIAS(__icache_flags); 91e03fa291SDavid Brazdil 92e03fa291SDavid Brazdil /* Kernel symbols needed for cpus_have_final/const_caps checks. */ 93e03fa291SDavid Brazdil KVM_NVHE_ALIAS(arm64_const_caps_ready); 94e03fa291SDavid Brazdil KVM_NVHE_ALIAS(cpu_hwcap_keys); 95e03fa291SDavid Brazdil KVM_NVHE_ALIAS(cpu_hwcaps); 96e03fa291SDavid Brazdil 9709cf57ebSDavid Brazdil /* Static keys which are set if a vGIC trap should be handled in hyp. */ 9809cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v2_cpuif_trap); 9909cf57ebSDavid Brazdil KVM_NVHE_ALIAS(vgic_v3_cpuif_trap); 10009cf57ebSDavid Brazdil 10109cf57ebSDavid Brazdil /* Static key checked in pmr_sync(). */ 10209cf57ebSDavid Brazdil #ifdef CONFIG_ARM64_PSEUDO_NMI 10309cf57ebSDavid Brazdil KVM_NVHE_ALIAS(gic_pmr_sync); 104*33678059SAlexandru Elisei /* Static key checked in GIC_PRIO_IRQOFF. */ 105*33678059SAlexandru Elisei KVM_NVHE_ALIAS(gic_nonsecure_priorities); 10609cf57ebSDavid Brazdil #endif 10709cf57ebSDavid Brazdil 108e9ee186bSJames Morse /* EL2 exception handling */ 109e9ee186bSJames Morse KVM_NVHE_ALIAS(__start___kvm_ex_table); 110e9ee186bSJames Morse KVM_NVHE_ALIAS(__stop___kvm_ex_table); 111e9ee186bSJames Morse 11276217129SDavid Brazdil #endif /* CONFIG_KVM */ 11376217129SDavid Brazdil 11490776dd1SKees Cook #endif /* __ARM64_KERNEL_IMAGE_VARS_H */ 115