image-vars.h 4.2 KB

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