xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 26 Jul 2019 18:48:48 +0000 (19:48 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Aug 2019 13:37:13 +0000 (14:37 +0100)
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 <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/cpu/mcheck/mce.h
xen/include/asm-arm/percpu.h
xen/include/asm-x86/cpuid.h
xen/include/asm-x86/irq.h
xen/include/asm-x86/percpu.h
xen/include/xen/percpu.h
xen/xsm/flask/include/avc.h

index f2cebccdd1f93b7fba9c8772bd0ccefff2e8c02b..7dcea7b454b848ea0036e5cd0b6ff66361fa2e2d 100644 (file)
@@ -3,12 +3,13 @@
 #define _MCE_H
 
 #include <xen/init.h>
+#include <xen/percpu.h>
 #include <xen/sched.h>
 #include <xen/smp.h>
+
 #include <asm/types.h>
 #include <asm/traps.h>
 #include <asm/atomic.h>
-#include <asm/percpu.h>
 
 #include "x86_mca.h"
 #include "mctelem.h"
index 5ce81a1707bb76e8ce45ecaa5fb82070584c4c27..f1a87680809ebc3fd912b8438b1e9819b551784f 100644 (file)
@@ -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__ */
index 548108f94843a073ebd5e20973f41704e23e5868..1b00e832d6ae299f9e92e27bb0e9ee045d2ef82d 100644 (file)
@@ -2,11 +2,11 @@
 #define __X86_CPUID_H__
 
 #include <asm/cpufeatureset.h>
-#include <asm/percpu.h>
 
 #ifndef __ASSEMBLY__
 #include <xen/types.h>
 #include <xen/kernel.h>
+#include <xen/percpu.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 #include <xen/lib/x86/cpuid.h>
index bc0c0c15d2a7f8630729c43cde7c5f2d6c9a1ff3..d3124f7b5df6531b965f701cb5c5661668705cd5 100644 (file)
@@ -6,10 +6,10 @@
 #include <asm/atomic.h>
 #include <asm/numa.h>
 #include <xen/cpumask.h>
+#include <xen/percpu.h>
 #include <xen/smp.h>
 #include <asm/hvm/irq.h>
 #include <irq_vectors.h>
-#include <asm/percpu.h>
 
 extern unsigned int nr_irqs_gsi;
 extern unsigned int nr_irqs;
index 5b6cef04c4608fd172b4bb61ec2acadbde583825..2b0c29a2331ab28ab1330d557344e4a3392e7810 100644 (file)
@@ -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))
 
index fd50a46382aabcb1a05a0d98741ffd5da87149ef..c7bf57cbcddbea776ce7009209fb49c937d106a7 100644 (file)
@@ -3,11 +3,17 @@
 
 #include <asm/percpu.h>
 
+#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)
index 93386bd7a1f1c8d51e359f4affc8d47e40bcf34f..c14bd07a2b395d89840761c47df51a1e35521610 100644 (file)
@@ -11,8 +11,9 @@
 
 #include <xen/errno.h>
 #include <xen/lib.h>
+#include <xen/percpu.h>
 #include <xen/spinlock.h>
-#include <asm/percpu.h>
+
 #include "flask.h"
 #include "av_permissions.h"
 #include "security.h"