WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 ucode: cancel redundant input paramet

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 ucode: cancel redundant input parameter of microcode functions
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2009 10:00:11 -0800
Delivery-date: Thu, 22 Jan 2009 10:00:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1232622604 0
# Node ID 97228980cd0425130eceb958b02f5fcaa8511860
# Parent  a92ed09b4032e612dbc122de5cd4582a3033731c
x86 ucode: cancel redundant input parameter of microcode functions

Cancel redundant input parameter 'uci', since it can get from another
input parameter 'cpu' as index.

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
 xen/arch/x86/microcode.c        |   25 +++++++++++++++----------
 xen/arch/x86/microcode_amd.c    |   10 +++++-----
 xen/arch/x86/microcode_intel.c  |    8 ++++----
 xen/include/asm-x86/microcode.h |    5 ++---
 4 files changed, 26 insertions(+), 22 deletions(-)

diff -r a92ed09b4032 -r 97228980cd04 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c  Thu Jan 22 11:07:32 2009 +0000
+++ b/xen/arch/x86/microcode.c  Thu Jan 22 11:10:04 2009 +0000
@@ -49,23 +49,28 @@ struct microcode_info {
     char buffer[1];
 };
 
-static void microcode_fini_cpu(struct ucode_cpu_info *uci, int cpu)
+static void microcode_fini_cpu(int cpu)
 {
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+
     spin_lock(&microcode_mutex);
     xfree(uci->mc.mc_valid);
     uci->mc.mc_valid = NULL;
     spin_unlock(&microcode_mutex);
 }
 
-static int collect_cpu_info(struct ucode_cpu_info *uci, int cpu)
+static int collect_cpu_info(int cpu)
 {
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
+
     memset(uci, 0, sizeof(*uci));
     return microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
 }
 
-static int microcode_resume_cpu(struct ucode_cpu_info *uci, int cpu)
+static int microcode_resume_cpu(int cpu)
 {
     int err = 0;
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
     struct cpu_signature nsig;
 
     gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu);
@@ -80,25 +85,25 @@ static int microcode_resume_cpu(struct u
     err = microcode_ops->collect_cpu_info(cpu, &nsig);
     if ( err )
     {
-        microcode_fini_cpu(uci, cpu);
+        microcode_fini_cpu(cpu);
         return err;
     }
 
     if ( memcmp(&nsig, &uci->cpu_sig, sizeof(nsig)) )
     {
-        microcode_fini_cpu(uci, cpu);
+        microcode_fini_cpu(cpu);
         /* Should we look for a new ucode here? */
         return -EIO;
     }
 
-    return microcode_ops->apply_microcode(uci, cpu);
+    return microcode_ops->apply_microcode(cpu);
 }
 
 static int microcode_update_cpu(const void *buf, size_t size)
 {
     int err;
     unsigned int cpu = smp_processor_id();
-    struct ucode_cpu_info *uci = &ucode_cpu_info[cpu];
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
 
     spin_lock(&microcode_mutex);
 
@@ -107,11 +112,11 @@ static int microcode_update_cpu(const vo
      * otherwise just request a firmware:
      */
     if ( uci->mc.mc_valid ) {
-        err = microcode_resume_cpu(uci, cpu);
+        err = microcode_resume_cpu(cpu);
     } else {
-        err = collect_cpu_info(uci, cpu);
+        err = collect_cpu_info(cpu);
         if ( !err )
-            err = microcode_ops->cpu_request_microcode(uci, cpu, buf, size);
+            err = microcode_ops->cpu_request_microcode(cpu, buf, size);
     }
 
     spin_unlock(&microcode_mutex);
diff -r a92ed09b4032 -r 97228980cd04 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c      Thu Jan 22 11:07:32 2009 +0000
+++ b/xen/arch/x86/microcode_amd.c      Thu Jan 22 11:10:04 2009 +0000
@@ -122,9 +122,10 @@ out:
     return 0;
 }
 
-static int apply_microcode(struct ucode_cpu_info *uci, int cpu)
+static int apply_microcode(int cpu)
 {
     unsigned long flags;
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
     uint32_t rev, dummy;
     struct microcode_amd *mc_amd = uci->mc.mc_amd;
 
@@ -246,18 +247,17 @@ static int install_equiv_cpu_table(const
     return 0;
 }
 
-static int cpu_request_microcode(struct ucode_cpu_info *uci,
-                               int cpu, const void *buf, size_t size)
+static int cpu_request_microcode(int cpu, const void *buf, size_t size)
 {
     const uint32_t *buf_pos;
     unsigned long offset = 0;
     int error = 0;
     int ret;
+    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
     void *mc;
 
     /* We should bind the task to the CPU */
     BUG_ON(cpu != raw_smp_processor_id());
-    BUG_ON(uci != &ucode_cpu_info[cpu]);
 
     buf_pos = (const uint32_t *)buf;
 
@@ -297,7 +297,7 @@ static int cpu_request_microcode(struct 
         if (error != 0)
             continue;
 
-        error = apply_microcode(uci, cpu);
+        error = apply_microcode(cpu);
         if (error == 0)
             break;
     }
diff -r a92ed09b4032 -r 97228980cd04 xen/arch/x86/microcode_intel.c
--- a/xen/arch/x86/microcode_intel.c    Thu Jan 22 11:07:32 2009 +0000
+++ b/xen/arch/x86/microcode_intel.c    Thu Jan 22 11:10:04 2009 +0000
@@ -244,11 +244,12 @@ static int get_matching_microcode(void *
     return 1;
 }
 
-static int apply_microcode(struct ucode_cpu_info *uci, int cpu)
+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;
 
     /* We should bind the task to the CPU */
     BUG_ON(cpu_num != cpu);
@@ -317,8 +318,7 @@ static long get_next_ucode_from_buffer(v
     return offset + total_size;
 }
 
-static int cpu_request_microcode(struct ucode_cpu_info *uci,
-                                int cpu, const void *buf, size_t size)
+static int cpu_request_microcode(int cpu, const void *buf, size_t size)
 {
     long offset = 0;
     int error = 0;
@@ -341,7 +341,7 @@ static int cpu_request_microcode(struct 
          */
         if ( error == 1 )
         {
-            apply_microcode(uci, cpu);
+            apply_microcode(cpu);
             error = 0;
         }
         xfree(mc);
diff -r a92ed09b4032 -r 97228980cd04 xen/include/asm-x86/microcode.h
--- a/xen/include/asm-x86/microcode.h   Thu Jan 22 11:07:32 2009 +0000
+++ b/xen/include/asm-x86/microcode.h   Thu Jan 22 11:10:04 2009 +0000
@@ -5,10 +5,9 @@ struct ucode_cpu_info;
 struct ucode_cpu_info;
 
 struct microcode_ops {
-    int (*cpu_request_microcode)(struct ucode_cpu_info *uci,
-                                 int cpu, const void *buf, size_t size);
+    int (*cpu_request_microcode)(int cpu, const void *buf, size_t size);
     int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
-    int (*apply_microcode)(struct ucode_cpu_info *uci, int cpu);
+    int (*apply_microcode)(int cpu);
 };
 
 struct microcode_header_intel {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 ucode: cancel redundant input parameter of microcode functions, Xen patchbot-unstable <=