xref: /linux/arch/arm64/include/asm/hyp_image.h (revision ce492a16ffb8814d9651c3fdafc363bfa1b01189)
1ab25464bSDavid Brazdil /* SPDX-License-Identifier: GPL-2.0 */
2ab25464bSDavid Brazdil /*
3ab25464bSDavid Brazdil  * Copyright (C) 2020 Google LLC.
4ab25464bSDavid Brazdil  * Written by David Brazdil <dbrazdil@google.com>
5ab25464bSDavid Brazdil  */
6ab25464bSDavid Brazdil 
7ab25464bSDavid Brazdil #ifndef __ARM64_HYP_IMAGE_H__
8ab25464bSDavid Brazdil #define __ARM64_HYP_IMAGE_H__
9ab25464bSDavid Brazdil 
10*ce492a16SDavid Brazdil /*
11*ce492a16SDavid Brazdil  * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_,
12*ce492a16SDavid Brazdil  * to separate it from the kernel proper.
13*ce492a16SDavid Brazdil  */
14*ce492a16SDavid Brazdil #define kvm_nvhe_sym(sym)	__kvm_nvhe_##sym
15*ce492a16SDavid Brazdil 
16ab25464bSDavid Brazdil #ifdef LINKER_SCRIPT
17ab25464bSDavid Brazdil 
18ab25464bSDavid Brazdil /*
19ab25464bSDavid Brazdil  * KVM nVHE ELF section names are prefixed with .hyp, to separate them
20ab25464bSDavid Brazdil  * from the kernel proper.
21ab25464bSDavid Brazdil  */
22ab25464bSDavid Brazdil #define HYP_SECTION_NAME(NAME)	.hyp##NAME
23ab25464bSDavid Brazdil 
24ab25464bSDavid Brazdil /* Defines an ELF hyp section from input section @NAME and its subsections. */
25ab25464bSDavid Brazdil #define HYP_SECTION(NAME) \
26ab25464bSDavid Brazdil 	HYP_SECTION_NAME(NAME) : { *(NAME NAME##.*) }
27ab25464bSDavid Brazdil 
28*ce492a16SDavid Brazdil /*
29*ce492a16SDavid Brazdil  * Defines a linker script alias of a kernel-proper symbol referenced by
30*ce492a16SDavid Brazdil  * KVM nVHE hyp code.
31*ce492a16SDavid Brazdil  */
32*ce492a16SDavid Brazdil #define KVM_NVHE_ALIAS(sym)	kvm_nvhe_sym(sym) = sym;
33*ce492a16SDavid Brazdil 
34ab25464bSDavid Brazdil #endif /* LINKER_SCRIPT */
35ab25464bSDavid Brazdil 
36ab25464bSDavid Brazdil #endif /* __ARM64_HYP_IMAGE_H__ */
37