Message ID | 1457759256-23432-25-git-send-email-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 6bcb675b2f6a3251d0107673949988c619ec18ec |
Delegated to: | Bin Meng |
Headers | show |
On Sat, Mar 12, 2016 at 1:07 PM, Simon Glass <sjg@chromium.org> wrote: > As each core starts up, record its microcode version and CPU ID so these can > be presented with the 'cpu detail' command. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > Changes in v2: > - Don't try to read microcode version on quark > - Use gd->arch.x86_device instead of reading the device ID again > > arch/x86/cpu/intel_common/microcode.c | 7 ++++++- > arch/x86/cpu/mp_init.c | 5 +++++ > arch/x86/include/asm/microcode.h | 9 +++++++++ > 3 files changed, 20 insertions(+), 1 deletion(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
On Mon, Mar 14, 2016 at 1:15 PM, Bin Meng <bmeng.cn@gmail.com> wrote: > On Sat, Mar 12, 2016 at 1:07 PM, Simon Glass <sjg@chromium.org> wrote: >> As each core starts up, record its microcode version and CPU ID so these can >> be presented with the 'cpu detail' command. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> >> Changes in v2: >> - Don't try to read microcode version on quark >> - Use gd->arch.x86_device instead of reading the device ID again >> >> arch/x86/cpu/intel_common/microcode.c | 7 ++++++- >> arch/x86/cpu/mp_init.c | 5 +++++ >> arch/x86/include/asm/microcode.h | 9 +++++++++ >> 3 files changed, 20 insertions(+), 1 deletion(-) >> > > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> applied to u-boot-x86/next, thanks!
diff --git a/arch/x86/cpu/intel_common/microcode.c b/arch/x86/cpu/intel_common/microcode.c index 3054fab..daf0d69 100644 --- a/arch/x86/cpu/intel_common/microcode.c +++ b/arch/x86/cpu/intel_common/microcode.c @@ -64,8 +64,12 @@ static int microcode_decode_node(const void *blob, int node, return 0; } -static inline uint32_t microcode_read_rev(void) +int microcode_read_rev(void) { + /* Quark does not have microcode MSRs */ +#ifdef CONFIG_INTEL_QUARK + return 0; +#else /* * Some Intel CPUs can be very finicky about the CPUID sequence used. * So this is implemented in assembly so that it works reliably. @@ -90,6 +94,7 @@ static inline uint32_t microcode_read_rev(void) ); return high; +#endif } static void microcode_read_cpu(struct microcode_update *cpu) diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c index ca47e9e..4cc6555 100644 --- a/arch/x86/cpu/mp_init.c +++ b/arch/x86/cpu/mp_init.c @@ -15,6 +15,7 @@ #include <asm/cpu.h> #include <asm/interrupt.h> #include <asm/lapic.h> +#include <asm/microcode.h> #include <asm/mp.h> #include <asm/msr.h> #include <asm/mtrr.h> @@ -560,12 +561,16 @@ int mp_init(struct mp_params *p) int mp_init_cpu(struct udevice *cpu, void *unused) { + struct cpu_platdata *plat = dev_get_parent_platdata(cpu); + /* * Multiple APs are brought up simultaneously and they may get the same * seq num in the uclass_resolve_seq() during device_probe(). To avoid * this, set req_seq to the reg number in the device tree in advance. */ cpu->req_seq = fdtdec_get_int(gd->fdt_blob, cpu->of_offset, "reg", -1); + plat->ucode_version = microcode_read_rev(); + plat->device_id = gd->arch.x86_device; return device_probe(cpu); } diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 67f32cc..0478935 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h @@ -18,6 +18,15 @@ * not updates were found, -EINVAL if an update was invalid */ int microcode_update_intel(void); + +/** + * microcode_read_rev() - Read the microcode version + * + * This reads the microcode version of the currently running CPU + * + * @return microcode version number + */ +int microcode_read_rev(void); #endif /* __ASSEMBLY__ */ #endif
As each core starts up, record its microcode version and CPU ID so these can be presented with the 'cpu detail' command. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v2: - Don't try to read microcode version on quark - Use gd->arch.x86_device instead of reading the device ID again arch/x86/cpu/intel_common/microcode.c | 7 ++++++- arch/x86/cpu/mp_init.c | 5 +++++ arch/x86/include/asm/microcode.h | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-)