image-vars.h 4.4 KB

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