> I was also wondering about another approach - using the PERCPU_SECTION macro > unchanged in the hyp linker script. It would lay out a single .data..percpu and > we would then prefix it with .hyp and the symbols with __kvm_nvhe_ as with > everything else. WDYT? Haven't tried that yet, could be a naive idea. Seems to work. Can't use PERCPU_SECTION directly because then we couldn't rename it in the same linker script, but if we just unwrap that one layer we can use PERCPU_INPUT. No global macro changes needed. Let me know what you think. ------8<------ diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 5904a4de9f40..9e6bf21268f1 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -195,11 +195,9 @@ SECTIONS PERCPU_SECTION(L1_CACHE_BYTES) /* KVM nVHE per-cpu section */ - #undef PERCPU_SECTION_NAME - #undef PERCPU_SYMBOL_NAME - #define PERCPU_SECTION_NAME(suffix) CONCAT3(.hyp, PERCPU_SECTION_BASE_NAME, suffix) - #define PERCPU_SYMBOL_NAME(name) __kvm_nvhe_ ## name - PERCPU_SECTION(L1_CACHE_BYTES) + . = ALIGN(PAGE_SIZE); + .hyp.data..percpu : { *(.hyp.data..percpu) } + . = ALIGN(PAGE_SIZE); .rela.dyn : ALIGN(8) { *(.rela .rela*) diff --git a/arch/arm64/kvm/hyp/nvhe/hyp.lds.S b/arch/arm64/kvm/hyp/nvhe/hyp.lds.S index 7d8c3fa004f4..1d8e4f7edc29 100644 --- a/arch/arm64/kvm/hyp/nvhe/hyp.lds.S +++ b/arch/arm64/kvm/hyp/nvhe/hyp.lds.S @@ -4,6 +4,10 @@ * Written by David Brazdil <dbrazdil@xxxxxxxxxx> */ +#include <asm-generic/vmlinux.lds.h> +#include <asm/cache.h> +#include <asm/memory.h> + /* * Defines an ELF hyp section from input section @NAME and its subsections. */ @@ -11,9 +15,9 @@ SECTIONS { HYP_SECTION(.text) - HYP_SECTION(.data..percpu) - HYP_SECTION(.data..percpu..first) - HYP_SECTION(.data..percpu..page_aligned) - HYP_SECTION(.data..percpu..read_mostly) - HYP_SECTION(.data..percpu..shared_aligned) + + .hyp..data..percpu : { + __per_cpu_load = .; + PERCPU_INPUT(L1_CACHE_BYTES) + } } -----8<------ David