ia64/xen-unstable

changeset 19069:97228980cd04

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@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 22 11:10:04 2009 +0000 (2009-01-22)
parents a92ed09b4032
children a1d0868ffadf
files xen/arch/x86/microcode.c xen/arch/x86/microcode_amd.c xen/arch/x86/microcode_intel.c xen/include/asm-x86/microcode.h
line diff
     1.1 --- a/xen/arch/x86/microcode.c	Thu Jan 22 11:07:32 2009 +0000
     1.2 +++ b/xen/arch/x86/microcode.c	Thu Jan 22 11:10:04 2009 +0000
     1.3 @@ -49,23 +49,28 @@ struct microcode_info {
     1.4      char buffer[1];
     1.5  };
     1.6  
     1.7 -static void microcode_fini_cpu(struct ucode_cpu_info *uci, int cpu)
     1.8 +static void microcode_fini_cpu(int cpu)
     1.9  {
    1.10 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    1.11 +
    1.12      spin_lock(&microcode_mutex);
    1.13      xfree(uci->mc.mc_valid);
    1.14      uci->mc.mc_valid = NULL;
    1.15      spin_unlock(&microcode_mutex);
    1.16  }
    1.17  
    1.18 -static int collect_cpu_info(struct ucode_cpu_info *uci, int cpu)
    1.19 +static int collect_cpu_info(int cpu)
    1.20  {
    1.21 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    1.22 +
    1.23      memset(uci, 0, sizeof(*uci));
    1.24      return microcode_ops->collect_cpu_info(cpu, &uci->cpu_sig);
    1.25  }
    1.26  
    1.27 -static int microcode_resume_cpu(struct ucode_cpu_info *uci, int cpu)
    1.28 +static int microcode_resume_cpu(int cpu)
    1.29  {
    1.30      int err = 0;
    1.31 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    1.32      struct cpu_signature nsig;
    1.33  
    1.34      gdprintk(XENLOG_INFO, "microcode: CPU%d resumed\n", cpu);
    1.35 @@ -80,25 +85,25 @@ static int microcode_resume_cpu(struct u
    1.36      err = microcode_ops->collect_cpu_info(cpu, &nsig);
    1.37      if ( err )
    1.38      {
    1.39 -        microcode_fini_cpu(uci, cpu);
    1.40 +        microcode_fini_cpu(cpu);
    1.41          return err;
    1.42      }
    1.43  
    1.44      if ( memcmp(&nsig, &uci->cpu_sig, sizeof(nsig)) )
    1.45      {
    1.46 -        microcode_fini_cpu(uci, cpu);
    1.47 +        microcode_fini_cpu(cpu);
    1.48          /* Should we look for a new ucode here? */
    1.49          return -EIO;
    1.50      }
    1.51  
    1.52 -    return microcode_ops->apply_microcode(uci, cpu);
    1.53 +    return microcode_ops->apply_microcode(cpu);
    1.54  }
    1.55  
    1.56  static int microcode_update_cpu(const void *buf, size_t size)
    1.57  {
    1.58      int err;
    1.59      unsigned int cpu = smp_processor_id();
    1.60 -    struct ucode_cpu_info *uci = &ucode_cpu_info[cpu];
    1.61 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    1.62  
    1.63      spin_lock(&microcode_mutex);
    1.64  
    1.65 @@ -107,11 +112,11 @@ static int microcode_update_cpu(const vo
    1.66       * otherwise just request a firmware:
    1.67       */
    1.68      if ( uci->mc.mc_valid ) {
    1.69 -        err = microcode_resume_cpu(uci, cpu);
    1.70 +        err = microcode_resume_cpu(cpu);
    1.71      } else {
    1.72 -        err = collect_cpu_info(uci, cpu);
    1.73 +        err = collect_cpu_info(cpu);
    1.74          if ( !err )
    1.75 -            err = microcode_ops->cpu_request_microcode(uci, cpu, buf, size);
    1.76 +            err = microcode_ops->cpu_request_microcode(cpu, buf, size);
    1.77      }
    1.78  
    1.79      spin_unlock(&microcode_mutex);
     2.1 --- a/xen/arch/x86/microcode_amd.c	Thu Jan 22 11:07:32 2009 +0000
     2.2 +++ b/xen/arch/x86/microcode_amd.c	Thu Jan 22 11:10:04 2009 +0000
     2.3 @@ -122,9 +122,10 @@ out:
     2.4      return 0;
     2.5  }
     2.6  
     2.7 -static int apply_microcode(struct ucode_cpu_info *uci, int cpu)
     2.8 +static int apply_microcode(int cpu)
     2.9  {
    2.10      unsigned long flags;
    2.11 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    2.12      uint32_t rev, dummy;
    2.13      struct microcode_amd *mc_amd = uci->mc.mc_amd;
    2.14  
    2.15 @@ -246,18 +247,17 @@ static int install_equiv_cpu_table(const
    2.16      return 0;
    2.17  }
    2.18  
    2.19 -static int cpu_request_microcode(struct ucode_cpu_info *uci,
    2.20 -				int cpu, const void *buf, size_t size)
    2.21 +static int cpu_request_microcode(int cpu, const void *buf, size_t size)
    2.22  {
    2.23      const uint32_t *buf_pos;
    2.24      unsigned long offset = 0;
    2.25      int error = 0;
    2.26      int ret;
    2.27 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
    2.28      void *mc;
    2.29  
    2.30      /* We should bind the task to the CPU */
    2.31      BUG_ON(cpu != raw_smp_processor_id());
    2.32 -    BUG_ON(uci != &ucode_cpu_info[cpu]);
    2.33  
    2.34      buf_pos = (const uint32_t *)buf;
    2.35  
    2.36 @@ -297,7 +297,7 @@ static int cpu_request_microcode(struct 
    2.37          if (error != 0)
    2.38              continue;
    2.39  
    2.40 -        error = apply_microcode(uci, cpu);
    2.41 +        error = apply_microcode(cpu);
    2.42          if (error == 0)
    2.43              break;
    2.44      }
     3.1 --- a/xen/arch/x86/microcode_intel.c	Thu Jan 22 11:07:32 2009 +0000
     3.2 +++ b/xen/arch/x86/microcode_intel.c	Thu Jan 22 11:10:04 2009 +0000
     3.3 @@ -244,11 +244,12 @@ static int get_matching_microcode(void *
     3.4      return 1;
     3.5  }
     3.6  
     3.7 -static int apply_microcode(struct ucode_cpu_info *uci, int cpu)
     3.8 +static int apply_microcode(int cpu)
     3.9  {
    3.10      unsigned long flags;
    3.11      unsigned int val[2];
    3.12      int cpu_num = raw_smp_processor_id();
    3.13 +    struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
    3.14  
    3.15      /* We should bind the task to the CPU */
    3.16      BUG_ON(cpu_num != cpu);
    3.17 @@ -317,8 +318,7 @@ static long get_next_ucode_from_buffer(v
    3.18      return offset + total_size;
    3.19  }
    3.20  
    3.21 -static int cpu_request_microcode(struct ucode_cpu_info *uci,
    3.22 -                                int cpu, const void *buf, size_t size)
    3.23 +static int cpu_request_microcode(int cpu, const void *buf, size_t size)
    3.24  {
    3.25      long offset = 0;
    3.26      int error = 0;
    3.27 @@ -341,7 +341,7 @@ static int cpu_request_microcode(struct 
    3.28           */
    3.29          if ( error == 1 )
    3.30          {
    3.31 -            apply_microcode(uci, cpu);
    3.32 +            apply_microcode(cpu);
    3.33              error = 0;
    3.34          }
    3.35          xfree(mc);
     4.1 --- a/xen/include/asm-x86/microcode.h	Thu Jan 22 11:07:32 2009 +0000
     4.2 +++ b/xen/include/asm-x86/microcode.h	Thu Jan 22 11:10:04 2009 +0000
     4.3 @@ -5,10 +5,9 @@ struct cpu_signature;
     4.4  struct ucode_cpu_info;
     4.5  
     4.6  struct microcode_ops {
     4.7 -    int (*cpu_request_microcode)(struct ucode_cpu_info *uci,
     4.8 -                                 int cpu, const void *buf, size_t size);
     4.9 +    int (*cpu_request_microcode)(int cpu, const void *buf, size_t size);
    4.10      int (*collect_cpu_info)(int cpu, struct cpu_signature *csig);
    4.11 -    int (*apply_microcode)(struct ucode_cpu_info *uci, int cpu);
    4.12 +    int (*apply_microcode)(int cpu);
    4.13  };
    4.14  
    4.15  struct microcode_header_intel {