From 3fda2214f1a7ff972427812e50dc6f1f61cf594f Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Fri, 26 Jul 2019 19:48:48 +0100 Subject: [PATCH] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These macros are identical across the architectures, and shouldn't be separate from the DEFINE_PER_CPU*() infrastructure. This converts the final asm/percpu.h includes, which were all using DECLARE_PER_CPU(), to include xen/percpu.h instead. Signed-off-by: Andrew Cooper Acked-by: Julien Grall Reviewed-by: Roger Pau Monné --- xen/arch/x86/cpu/mcheck/mce.h | 3 ++- xen/include/asm-arm/percpu.h | 5 ----- xen/include/asm-x86/cpuid.h | 2 +- xen/include/asm-x86/irq.h | 2 +- xen/include/asm-x86/percpu.h | 5 ----- xen/include/xen/percpu.h | 8 +++++++- xen/xsm/flask/include/avc.h | 3 ++- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.h b/xen/arch/x86/cpu/mcheck/mce.h index f2cebccdd1..7dcea7b454 100644 --- a/xen/arch/x86/cpu/mcheck/mce.h +++ b/xen/arch/x86/cpu/mcheck/mce.h @@ -3,12 +3,13 @@ #define _MCE_H #include +#include #include #include + #include #include #include -#include #include "x86_mca.h" #include "mctelem.h" diff --git a/xen/include/asm-arm/percpu.h b/xen/include/asm-arm/percpu.h index 5ce81a1707..f1a8768080 100644 --- a/xen/include/asm-arm/percpu.h +++ b/xen/include/asm-arm/percpu.h @@ -10,9 +10,6 @@ extern char __per_cpu_start[], __per_cpu_data_end[]; extern unsigned long __per_cpu_offset[NR_CPUS]; void percpu_init_areas(void); -#define __DEFINE_PER_CPU(attr, type, name) \ - attr __typeof__(type) per_cpu_ ## name - #define per_cpu(var, cpu) \ (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) #define this_cpu(var) \ @@ -23,8 +20,6 @@ void percpu_init_areas(void); #define this_cpu_ptr(var) \ (*RELOC_HIDE(var, READ_SYSREG(TPIDR_EL2))) -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name - #endif #endif /* __ARM_PERCPU_H__ */ diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h index 548108f948..1b00e832d6 100644 --- a/xen/include/asm-x86/cpuid.h +++ b/xen/include/asm-x86/cpuid.h @@ -2,11 +2,11 @@ #define __X86_CPUID_H__ #include -#include #ifndef __ASSEMBLY__ #include #include +#include #include #include diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h index bc0c0c15d2..d3124f7b5d 100644 --- a/xen/include/asm-x86/irq.h +++ b/xen/include/asm-x86/irq.h @@ -6,10 +6,10 @@ #include #include #include +#include #include #include #include -#include extern unsigned int nr_irqs_gsi; extern unsigned int nr_irqs; diff --git a/xen/include/asm-x86/percpu.h b/xen/include/asm-x86/percpu.h index 5b6cef04c4..2b0c29a233 100644 --- a/xen/include/asm-x86/percpu.h +++ b/xen/include/asm-x86/percpu.h @@ -7,17 +7,12 @@ extern unsigned long __per_cpu_offset[NR_CPUS]; void percpu_init_areas(void); #endif -#define __DEFINE_PER_CPU(attr, type, name) \ - attr __typeof__(type) per_cpu_ ## name - /* var is in discarded region: offset to particular copy we want */ #define per_cpu(var, cpu) \ (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) #define this_cpu(var) \ (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset)) -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name - #define this_cpu_ptr(var) \ (*RELOC_HIDE(var, get_cpu_info()->per_cpu_offset)) diff --git a/xen/include/xen/percpu.h b/xen/include/xen/percpu.h index fd50a46382..c7bf57cbcd 100644 --- a/xen/include/xen/percpu.h +++ b/xen/include/xen/percpu.h @@ -3,11 +3,17 @@ #include +#define DECLARE_PER_CPU(type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU(attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name + /* * Separate out the type, so (int[3], foo) works. * * The _##name concatenation is being used here to prevent 'name' from getting - * macro expanded, while still allowing a per-architecture symbol name prefix. + * macro expanded. */ #define DEFINE_PER_CPU(type, name) \ __DEFINE_PER_CPU(__section(".bss.percpu"), type, _ ## name) diff --git a/xen/xsm/flask/include/avc.h b/xen/xsm/flask/include/avc.h index 93386bd7a1..c14bd07a2b 100644 --- a/xen/xsm/flask/include/avc.h +++ b/xen/xsm/flask/include/avc.h @@ -11,8 +11,9 @@ #include #include +#include #include -#include + #include "flask.h" #include "av_permissions.h" #include "security.h" -- 2.30.2