lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/9] Macros to override naming of percpu symbols and sections
Date
Modify generic linker script macros to generate section/symbol names for
percpu area using overridable macros. No functional changes.

This will allow arm64 linker script to define a second KVM-specific percpu
data section using the generic PERCPU_SECTION macro.

Signed-off-by: David Brazdil <dbrazdil@google.com>
---
include/asm-generic/vmlinux.lds.h | 40 +++++++++++++++++++++----------
1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index db600ef218d7..1bfc002ecfce 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -892,6 +892,20 @@
#define INIT_RAM_FS
#endif

+/*
+ * Macros to override the naming of percpu symbols and sections.
+ * Used by arm64 linker script to define a separate percpu area for KVM.
+ */
+#define PERCPU_SECTION_BASE_NAME .data..percpu
+
+#ifndef PERCPU_SECTION_NAME
+#define PERCPU_SECTION_NAME(suffix) PERCPU_SECTION_BASE_NAME ## suffix
+#endif
+
+#ifndef PERCPU_SYMBOL_NAME
+#define PERCPU_SYMBOL_NAME(name) name
+#endif
+
/*
* Memory encryption operates on a page basis. Since we need to clear
* the memory encryption mask for this section, it needs to be aligned
@@ -903,7 +917,7 @@
#ifdef CONFIG_AMD_MEM_ENCRYPT
#define PERCPU_DECRYPTED_SECTION \
. = ALIGN(PAGE_SIZE); \
- *(.data..percpu..decrypted) \
+ *(PERCPU_SECTION_NAME(..decrypted)) \
. = ALIGN(PAGE_SIZE);
#else
#define PERCPU_DECRYPTED_SECTION
@@ -947,17 +961,17 @@
* sharing between subsections for different purposes.
*/
#define PERCPU_INPUT(cacheline) \
- __per_cpu_start = .; \
- *(.data..percpu..first) \
+ PERCPU_SYMBOL_NAME(__per_cpu_start) = .; \
+ *(PERCPU_SECTION_NAME(..first)) \
. = ALIGN(PAGE_SIZE); \
- *(.data..percpu..page_aligned) \
+ *(PERCPU_SECTION_NAME(..page_aligned)) \
. = ALIGN(cacheline); \
- *(.data..percpu..read_mostly) \
+ *(PERCPU_SECTION_NAME(..read_mostly)) \
. = ALIGN(cacheline); \
- *(.data..percpu) \
- *(.data..percpu..shared_aligned) \
+ *(PERCPU_SECTION_NAME()) \
+ *(PERCPU_SECTION_NAME(..shared_aligned)) \
PERCPU_DECRYPTED_SECTION \
- __per_cpu_end = .;
+ PERCPU_SYMBOL_NAME(__per_cpu_end) = .;

/**
* PERCPU_VADDR - define output section for percpu area
@@ -984,11 +998,11 @@
* address, use PERCPU_SECTION.
*/
#define PERCPU_VADDR(cacheline, vaddr, phdr) \
- __per_cpu_load = .; \
- .data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \
+ PERCPU_SYMBOL_NAME(__per_cpu_load) = .; \
+ PERCPU_SECTION_NAME() vaddr : AT(PERCPU_SYMBOL_NAME(__per_cpu_load) - LOAD_OFFSET) { \
PERCPU_INPUT(cacheline) \
} phdr \
- . = __per_cpu_load + SIZEOF(.data..percpu);
+ . = PERCPU_SYMBOL_NAME(__per_cpu_load) + SIZEOF(PERCPU_SECTION_NAME());

/**
* PERCPU_SECTION - define output section for percpu area, simple version
@@ -1004,8 +1018,8 @@
*/
#define PERCPU_SECTION(cacheline) \
. = ALIGN(PAGE_SIZE); \
- .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
- __per_cpu_load = .; \
+ PERCPU_SECTION_NAME() : AT(ADDR(PERCPU_SECTION_NAME()) - LOAD_OFFSET) { \
+ PERCPU_SYMBOL_NAME(__per_cpu_load) = .; \
PERCPU_INPUT(cacheline) \
}

--
2.27.0
\
 
 \ /
  Last update: 2020-07-22 18:46    [W:0.062 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site