[U-Boot] [PATCH 43/69] x86: Update microcode for secondary CPUs

Bin Meng bmeng.cn at gmail.com
Fri Mar 11 08:07:06 CET 2016


Hi Simon,

On Mon, Mar 7, 2016 at 10:28 AM, Simon Glass <sjg at chromium.org> wrote:
> Each CPU needs to have its microcode loaded. Add support for this so that
> all CPUs will have the same version.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
>  arch/x86/cpu/cpu.c               | 1 +
>  arch/x86/cpu/intel_common/car.S  | 2 ++
>  arch/x86/cpu/mp_init.c           | 6 ++++--
>  arch/x86/include/asm/microcode.h | 3 +++
>  arch/x86/lib/fsp/fsp_car.S       | 2 ++
>  5 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index 8eb676c..fcc1980 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -27,6 +27,7 @@
>  #include <asm/control_regs.h>
>  #include <asm/cpu.h>
>  #include <asm/lapic.h>
> +#include <asm/microcode.h>
>  #include <asm/mp.h>
>  #include <asm/msr.h>
>  #include <asm/mtrr.h>
> diff --git a/arch/x86/cpu/intel_common/car.S b/arch/x86/cpu/intel_common/car.S
> index 81ac976..a7ae9b1 100644
> --- a/arch/x86/cpu/intel_common/car.S
> +++ b/arch/x86/cpu/intel_common/car.S
> @@ -237,5 +237,7 @@ mtrr_table_end:
>         .align 4
>  _dt_ucode_base_size:
>         /* These next two fields are filled in by ifdtool */
> +.globl ucode_base
> +ucode_base:    /* Declared in micrcode.h */

typo: microcode.h

>         .long   0                       /* microcode base */
>         .long   0                       /* microcode size */
> diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
> index 94ddbbb..6b5886a 100644
> --- a/arch/x86/cpu/mp_init.c
> +++ b/arch/x86/cpu/mp_init.c
> @@ -248,8 +248,10 @@ static int load_sipi_vector(atomic_t **ap_countp, int num_cpus)
>         if (!stack)
>                 return -ENOMEM;
>         params->stack_top = (u32)(stack + size);
> -
> -       params->microcode_ptr = 0;
> +#ifndef CONFIG_QEMU

I believe for FSP case, we should not load microcode to APs as FSP
already did this for us.

> +       params->microcode_ptr = ucode_base;
> +       debug("Microcode at %x\n", params->microcode_ptr);
> +#endif
>         params->msr_table_ptr = (u32)msr_save;
>         ret = save_bsp_msrs(msr_save, sizeof(msr_save));
>         if (ret < 0)
> diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
> index 0478935..29bf060 100644
> --- a/arch/x86/include/asm/microcode.h
> +++ b/arch/x86/include/asm/microcode.h
> @@ -9,6 +9,9 @@
>
>  #ifndef __ASSEMBLY__
>
> +/* This is a declaration for ucode_base in start.S */
> +extern u32 ucode_base;
> +
>  /**
>   * microcode_update_intel() - Apply microcode updates
>   *
> diff --git a/arch/x86/lib/fsp/fsp_car.S b/arch/x86/lib/fsp/fsp_car.S
> index 15b3751..fbe8aef 100644
> --- a/arch/x86/lib/fsp/fsp_car.S
> +++ b/arch/x86/lib/fsp/fsp_car.S
> @@ -102,6 +102,8 @@ temp_ram_init_romstack:
>  temp_ram_init_params:
>  _dt_ucode_base_size:
>         /* These next two fields are filled in by ifdtool */
> +.globl ucode_base
> +ucode_base:    /* Declared in micrcode.h */

typo: microcode.h

>         .long   0                       /* microcode base */
>         .long   0                       /* microcode size */
>         .long   CONFIG_SYS_MONITOR_BASE /* code region base */
> --

Regards,
Bin


More information about the U-Boot mailing list