[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200903091712.46456-2-dbrazdil@google.com>
Date: Thu, 3 Sep 2020 11:17:03 +0200
From: David Brazdil <dbrazdil@...gle.com>
To: Marc Zyngier <maz@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Dennis Zhou <dennis@...nel.org>,
Tejun Heo <tj@...nel.org>, Christoph Lameter <cl@...ux.com>,
Arnd Bergmann <arnd@...db.de>
Cc: James Morse <james.morse@....com>,
Julien Thierry <julien.thierry.kdev@...il.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kvmarm@...ts.cs.columbia.edu, linux-arch@...r.kernel.org,
kernel-team@...roid.com, David Brazdil <dbrazdil@...gle.com>
Subject: [PATCH v2 01/10] Macros to override naming of percpu symbols and sections
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@...gle.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 5430febd34be..8f3f5c45e891 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -920,6 +920,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
@@ -931,7 +945,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
@@ -975,17 +989,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
@@ -1012,11 +1026,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
@@ -1032,8 +1046,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.28.0.402.g5ffc5be6b7-goog
Powered by blists - more mailing lists