[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: move ucode_cpu_info into per-CPU space



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1247481094 -3600
# Node ID ed76e4bbea83c59e4ada9ac4e8134bf7d4d0063e
# Parent  7406764457a029848573923e590fb210738ca6a8
x86: move ucode_cpu_info into per-CPU space

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/microcode.c        |    8 ++++----
 xen/arch/x86/microcode_amd.c    |    6 +++---
 xen/arch/x86/microcode_intel.c  |    8 ++++----
 xen/include/asm-x86/microcode.h |    4 +++-
 4 files changed, 14 insertions(+), 12 deletions(-)

diff -r 7406764457a0 -r ed76e4bbea83 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c  Mon Jul 13 11:31:08 2009 +0100
+++ b/xen/arch/x86/microcode.c  Mon Jul 13 11:31:34 2009 +0100
@@ -40,7 +40,7 @@ const struct microcode_ops *microcode_op
 
 static DEFINE_SPINLOCK(microcode_mutex);
 
-struct ucode_cpu_info ucode_cpu_info[NR_CPUS];
+DEFINE_PER_CPU(struct ucode_cpu_info, ucode_cpu_info);
 
 struct microcode_info {
     unsigned int cpu;
@@ -51,7 +51,7 @@ struct microcode_info {
 
 static void __microcode_fini_cpu(int cpu)
 {
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
 
     xfree(uci->mc.mc_valid);
     memset(uci, 0, sizeof(*uci));
@@ -67,7 +67,7 @@ int microcode_resume_cpu(int cpu)
 int microcode_resume_cpu(int cpu)
 {
     int err = 0;
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
     struct cpu_signature nsig;
 
     gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu);
@@ -101,7 +101,7 @@ static int microcode_update_cpu(const vo
 {
     int err;
     unsigned int cpu = smp_processor_id();
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
 
     spin_lock(&microcode_mutex);
 
diff -r 7406764457a0 -r ed76e4bbea83 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c      Mon Jul 13 11:31:08 2009 +0100
+++ b/xen/arch/x86/microcode_amd.c      Mon Jul 13 11:31:34 2009 +0100
@@ -68,7 +68,7 @@ static int collect_cpu_info(int cpu, str
 
 static int microcode_fits(void *mc, int cpu)
 {
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
     struct microcode_header_amd *mc_header = mc;
     unsigned int current_cpu_id;
     unsigned int equiv_cpu_id = 0x0;
@@ -125,7 +125,7 @@ static int apply_microcode(int cpu)
 static int apply_microcode(int cpu)
 {
     unsigned long flags;
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
     uint32_t rev, dummy;
     struct microcode_amd *mc_amd = uci->mc.mc_amd;
 
@@ -253,7 +253,7 @@ static int cpu_request_microcode(int cpu
     unsigned long offset = 0;
     int error = 0;
     int ret;
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
     void *mc;
 
     /* We should bind the task to the CPU */
diff -r 7406764457a0 -r ed76e4bbea83 xen/arch/x86/microcode_intel.c
--- a/xen/arch/x86/microcode_intel.c    Mon Jul 13 11:31:08 2009 +0100
+++ b/xen/arch/x86/microcode_intel.c    Mon Jul 13 11:31:34 2009 +0100
@@ -99,7 +99,7 @@ static inline int microcode_update_match
 static inline int microcode_update_match(
     int cpu_num, struct microcode_header_intel *mc_header, int sig, int pf)
 {
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu_num);
 
     return (sigmatch(sig, uci->cpu_sig.sig, pf, uci->cpu_sig.pf) &&
             (mc_header->rev > uci->cpu_sig.rev));
@@ -201,7 +201,7 @@ static int microcode_sanity_check(void *
  */
 static int get_matching_microcode(void *mc, int cpu)
 {
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
     struct microcode_header_intel *mc_header = mc;
     struct extended_sigtable *ext_header;
     unsigned long total_size = get_totalsize(mc_header);
@@ -251,7 +251,7 @@ static int apply_microcode(int cpu)
     unsigned long flags;
     unsigned int val[2];
     int cpu_num = raw_smp_processor_id();
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu_num);
 
     /* We should bind the task to the CPU */
     BUG_ON(cpu_num != cpu);
@@ -362,7 +362,7 @@ static int cpu_request_microcode(int cpu
 
 static int microcode_resume_match(int cpu, struct cpu_signature *nsig)
 {
-    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+    struct ucode_cpu_info *uci = &per_cpu(ucode_cpu_info, cpu);
 
     return (sigmatch(nsig->sig, uci->cpu_sig.sig, nsig->pf, uci->cpu_sig.pf) &&
             (uci->cpu_sig.rev > nsig->rev));
diff -r 7406764457a0 -r ed76e4bbea83 xen/include/asm-x86/microcode.h
--- a/xen/include/asm-x86/microcode.h   Mon Jul 13 11:31:08 2009 +0100
+++ b/xen/include/asm-x86/microcode.h   Mon Jul 13 11:31:34 2009 +0100
@@ -1,5 +1,7 @@
 #ifndef ASM_X86__MICROCODE_H
 #define ASM_X86__MICROCODE_H
+
+#include <xen/percpu.h>
 
 struct cpu_signature;
 struct ucode_cpu_info;
@@ -88,7 +90,7 @@ struct ucode_cpu_info {
     } mc;
 };
 
-extern struct ucode_cpu_info ucode_cpu_info[];
+DECLARE_PER_CPU(struct ucode_cpu_info, ucode_cpu_info);
 extern const struct microcode_ops *microcode_ops;
 
 #endif /* ASM_X86__MICROCODE_H */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.