Skip to content

Commit ce492a1

Browse files
David BrazdilMarc Zyngier
authored andcommitted
kvm: arm64: Move nVHE hyp namespace macros to hyp_image.h
Minor cleanup to move all macros related to prefixing nVHE hyp section and symbol names into one place: hyp_image.h. Signed-off-by: David Brazdil <dbrazdil@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20200922204910.7265-3-dbrazdil@google.com
1 parent ab25464 commit ce492a1

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎arch/arm64/include/asm/hyp_image.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#ifndef __ARM64_HYP_IMAGE_H__
88
#define __ARM64_HYP_IMAGE_H__
99

10+
/*
11+
* KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_,
12+
* to separate it from the kernel proper.
13+
*/
14+
#define kvm_nvhe_sym(sym) __kvm_nvhe_##sym
15+
1016
#ifdef LINKER_SCRIPT
1117

1218
/*
@@ -19,6 +25,12 @@
1925
#define HYP_SECTION(NAME) \
2026
HYP_SECTION_NAME(NAME) : { *(NAME NAME##.*) }
2127

28+
/*
29+
* Defines a linker script alias of a kernel-proper symbol referenced by
30+
* KVM nVHE hyp code.
31+
*/
32+
#define KVM_NVHE_ALIAS(sym) kvm_nvhe_sym(sym) = sym;
33+
2234
#endif /* LINKER_SCRIPT */
2335

2436
#endif /* __ARM64_HYP_IMAGE_H__ */

‎arch/arm64/include/asm/kvm_asm.h‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef __ARM_KVM_ASM_H__
88
#define __ARM_KVM_ASM_H__
99

10+
#include <asm/hyp_image.h>
1011
#include <asm/virt.h>
1112

1213
#define VCPU_WORKAROUND_2_FLAG_SHIFT 0
@@ -42,13 +43,6 @@
4243

4344
#include <linux/mm.h>
4445

45-
/*
46-
* Translate name of a symbol defined in nVHE hyp to the name seen
47-
* by kernel proper. All nVHE symbols are prefixed by the build system
48-
* to avoid clashes with the VHE variants.
49-
*/
50-
#define kvm_nvhe_sym(sym) __kvm_nvhe_##sym
51-
5246
#define DECLARE_KVM_VHE_SYM(sym) extern char sym[]
5347
#define DECLARE_KVM_NVHE_SYM(sym) extern char kvm_nvhe_sym(sym)[]
5448

‎arch/arm64/kernel/image-vars.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ __efistub__ctype = _ctype;
6161
* memory mappings.
6262
*/
6363

64-
#define KVM_NVHE_ALIAS(sym) __kvm_nvhe_##sym = sym;
65-
6664
/* Alternative callbacks for init-time patching of nVHE hyp code. */
6765
KVM_NVHE_ALIAS(arm64_enable_wa2_handling);
6866
KVM_NVHE_ALIAS(kvm_patch_vector_branch);

‎arch/arm64/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <asm-generic/vmlinux.lds.h>
1111
#include <asm/cache.h>
12+
#include <asm/hyp_image.h>
1213
#include <asm/kernel-pgtable.h>
1314
#include <asm/memory.h>
1415
#include <asm/page.h>

0 commit comments

Comments
 (0)