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@xxxxxxxxxx> --- 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