From: tip-bot for Fenghua Yu <fenghua.yu@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
fenghua.yu@intel.com, tglx@linutronix.de, hpa@linux.intel.com
Subject: [tip:x86/microcode] x86/microcode_core_early.c: Define interfaces for early loading ucode
Date: Fri, 30 Nov 2012 16:23:02 -0800 [thread overview]
Message-ID: <tip-d42bdf2139115faa4d5bdb0dc591d435a644fde4@git.kernel.org> (raw)
In-Reply-To: <1354240068-9821-4-git-send-email-fenghua.yu@intel.com>
Commit-ID: d42bdf2139115faa4d5bdb0dc591d435a644fde4
Gitweb: http://git.kernel.org/tip/d42bdf2139115faa4d5bdb0dc591d435a644fde4
Author: Fenghua Yu <fenghua.yu@intel.com>
AuthorDate: Thu, 29 Nov 2012 17:47:41 -0800
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Fri, 30 Nov 2012 15:18:15 -0800
x86/microcode_core_early.c: Define interfaces for early loading ucode
Define interfaces load_ucode_bsp() and load_ucode_ap() to load ucode on BSP and
AP in early boot time. These are generic interfaces. Internally they call
vendor specific implementations.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1354240068-9821-4-git-send-email-fenghua.yu@intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/include/asm/microcode.h | 23 +++++++++++
arch/x86/kernel/microcode_core_early.c | 70 ++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+)
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 43d921b..2e2ff3a 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -57,4 +57,27 @@ static inline struct microcode_ops * __init init_amd_microcode(void)
static inline void __exit exit_amd_microcode(void) {}
#endif
+struct mc_saved_data {
+ unsigned int mc_saved_count;
+ struct microcode_intel **mc_saved;
+ struct ucode_cpu_info *ucode_cpu_info;
+};
+#ifdef CONFIG_MICROCODE_EARLY
+#define MAX_UCODE_COUNT 128
+extern struct ucode_cpu_info ucode_cpu_info_early[NR_CPUS];
+extern struct microcode_intel __initdata *mc_saved_in_initrd[MAX_UCODE_COUNT];
+extern struct mc_saved_data mc_saved_data;
+extern void __init load_ucode_bsp(char *real_mode_data);
+extern __init void load_ucode_ap(void);
+extern void __init
+save_microcode_in_initrd(struct mc_saved_data *mc_saved_data,
+ struct microcode_intel **mc_saved_in_initrd);
+#else
+static inline void __init load_ucode_bsp(char *real_mode_data) {}
+static inline __init void load_ucode_ap(void) {}
+static inline void __init
+save_microcode_in_initrd(struct mc_saved_data *mc_saved_data,
+ struct microcode_intel **mc_saved_in_initrd) {}
+#endif
+
#endif /* _ASM_X86_MICROCODE_H */
diff --git a/arch/x86/kernel/microcode_core_early.c b/arch/x86/kernel/microcode_core_early.c
new file mode 100644
index 0000000..1c6cc8f
--- /dev/null
+++ b/arch/x86/kernel/microcode_core_early.c
@@ -0,0 +1,70 @@
+/*
+ * X86 CPU microcode early update for Linux
+ *
+ * Copyright (C) 2012 Fenghua Yu <fenghua.yu@intel.com>
+ * H Peter Anvin" <hpa@zytor.com>
+ *
+ * This driver allows to early upgrade microcode on Intel processors
+ * belonging to IA-32 family - PentiumPro, Pentium II,
+ * Pentium III, Xeon, Pentium 4, etc.
+ *
+ * Reference: Section 9.11 of Volume 3, IA-32 Intel Architecture
+ * Software Developer's Manual.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <asm/microcode_intel.h>
+#include <asm/processor.h>
+
+struct ucode_cpu_info ucode_cpu_info_early[NR_CPUS];
+EXPORT_SYMBOL_GPL(ucode_cpu_info_early);
+
+static inline int __init x86_vendor(void)
+{
+ unsigned int eax = 0x00000000;
+ char x86_vendor_id[16];
+ int i;
+ struct {
+ char x86_vendor_id[16];
+ __u8 x86_vendor;
+ } cpu_vendor_table[] = {
+ { "GenuineIntel", X86_VENDOR_INTEL },
+ { "AuthenticAMD", X86_VENDOR_AMD },
+ };
+
+ memset(x86_vendor_id, 0, ARRAY_SIZE(x86_vendor_id));
+ /* Get vendor name */
+ native_cpuid(&eax,
+ (unsigned int *)&x86_vendor_id[0],
+ (unsigned int *)&x86_vendor_id[8],
+ (unsigned int *)&x86_vendor_id[4]);
+
+ for (i = 0; i < ARRAY_SIZE(cpu_vendor_table); i++) {
+ if (!strcmp(x86_vendor_id, cpu_vendor_table[i].x86_vendor_id))
+ return cpu_vendor_table[i].x86_vendor;
+ }
+
+ return X86_VENDOR_UNKNOWN;
+}
+
+
+void __init load_ucode_bsp(char *real_mode_data)
+{
+ /*
+ * boot_cpu_data is not setup yet in this early phase.
+ * So we get vendor information directly through cpuid.
+ */
+ if (x86_vendor() == X86_VENDOR_INTEL)
+ load_ucode_intel_bsp(real_mode_data);
+}
+
+void __cpuinit load_ucode_ap(void)
+{
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+ load_ucode_intel_ap();
+}
next prev parent reply other threads:[~2012-12-01 0:23 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 1:47 [PATCH v2 00/11] x86/microcode: Early load microcode Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 01/10] Documentation/x86: " Fenghua Yu
2012-11-30 19:46 ` H. Peter Anvin
2012-11-30 20:40 ` Yu, Fenghua
2012-11-30 1:47 ` [PATCH v2 02/10] x86/microcode_intel.h: Define functions and macros for early loading ucode Fenghua Yu
2012-12-01 0:21 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 03/10] x86/microcode_core_early.c: Define interfaces " Fenghua Yu
2012-12-01 0:23 ` tip-bot for Fenghua Yu [this message]
2012-11-30 1:47 ` [PATCH v2 04/10] x86/microcode_intel_lib.c: Early update ucode on Intel's CPU Fenghua Yu
2012-12-01 0:24 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 05/10] x86/microcode_intel_early.c: " Fenghua Yu
2012-12-01 0:25 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-12-01 0:55 ` Yinghai Lu
2012-12-04 0:18 ` Yu, Fenghua
2012-12-11 2:39 ` Yinghai Lu
2012-12-11 3:41 ` H. Peter Anvin
2012-12-11 3:55 ` Yinghai Lu
2012-12-11 6:34 ` H. Peter Anvin
2012-12-11 7:07 ` Yinghai Lu
2012-12-11 14:57 ` Borislav Petkov
2012-12-11 16:46 ` Yinghai Lu
2012-12-11 16:48 ` H. Peter Anvin
2012-12-11 17:00 ` Yinghai Lu
2012-12-11 17:06 ` Borislav Petkov
2012-12-11 17:15 ` Yinghai Lu
2012-12-11 17:26 ` Yu, Fenghua
2012-12-11 17:38 ` H. Peter Anvin
2012-12-11 23:53 ` Yinghai Lu
2012-12-11 23:57 ` H. Peter Anvin
2012-12-12 0:27 ` Yinghai Lu
2012-12-12 0:37 ` H. Peter Anvin
2012-12-12 7:14 ` Yinghai Lu
2012-12-12 10:26 ` Yinghai Lu
2012-12-13 1:06 ` Yinghai Lu
2012-12-12 6:57 ` H. Peter Anvin
2012-12-12 13:38 ` Borislav Petkov
2012-12-12 17:43 ` H. Peter Anvin
2012-12-13 5:12 ` H. Peter Anvin
2012-12-13 5:26 ` H. Peter Anvin
2012-12-13 7:01 ` Yinghai Lu
2012-12-13 15:01 ` H. Peter Anvin
2012-12-13 19:13 ` Borislav Petkov
2012-12-13 21:36 ` H. Peter Anvin
2012-12-14 9:11 ` Yinghai Lu
2012-12-14 18:16 ` H. Peter Anvin
2012-12-14 19:46 ` H. Peter Anvin
2012-12-14 20:04 ` Yinghai Lu
2012-12-14 20:08 ` Yinghai Lu
2012-12-14 20:14 ` Yinghai Lu
2012-12-14 20:44 ` H. Peter Anvin
2012-12-15 7:57 ` Yinghai Lu
2012-12-15 19:30 ` H. Peter Anvin
2012-12-15 20:55 ` Yinghai Lu
2012-12-15 21:31 ` H. Peter Anvin
2012-12-15 21:40 ` H. Peter Anvin
2012-12-15 22:13 ` Yinghai Lu
2012-12-15 22:17 ` H. Peter Anvin
2012-12-15 23:15 ` Yinghai Lu
2012-12-15 23:17 ` H. Peter Anvin
2012-12-19 20:37 ` Borislav Petkov
2012-12-19 21:07 ` Jacob Shin
2012-12-19 21:48 ` H. Peter Anvin
2012-12-19 22:05 ` Jacob Shin
2012-12-19 22:25 ` H. Peter Anvin
2012-12-19 22:47 ` Yinghai Lu
2012-12-19 22:59 ` H. Peter Anvin
2012-12-19 22:51 ` Borislav Petkov
2012-12-19 22:59 ` Jacob Shin
2012-12-19 23:03 ` Borislav Petkov
2012-12-19 23:21 ` Jacob Shin
2012-12-19 23:56 ` H. Peter Anvin
2012-12-19 23:22 ` H. Peter Anvin
2012-12-19 23:40 ` Borislav Petkov
2012-12-20 0:02 ` H. Peter Anvin
2012-12-20 0:10 ` Borislav Petkov
2012-12-20 0:15 ` H. Peter Anvin
2012-12-19 23:40 ` Yinghai Lu
2012-12-19 23:43 ` H. Peter Anvin
2012-12-19 23:48 ` Yinghai Lu
2012-12-19 23:40 ` Jacob Shin
2012-12-19 23:45 ` Yinghai Lu
2012-12-19 23:50 ` H. Peter Anvin
2012-12-19 23:55 ` Borislav Petkov
2012-12-19 23:57 ` H. Peter Anvin
2012-12-20 0:07 ` Jacob Shin
2012-12-20 0:24 ` H. Peter Anvin
2012-12-20 0:29 ` Jacob Shin
2012-12-20 0:41 ` H. Peter Anvin
2012-12-20 2:37 ` H. Peter Anvin
2012-12-20 4:16 ` Jacob Shin
2012-12-20 4:21 ` H. Peter Anvin
2012-12-19 22:55 ` Jacob Shin
2012-12-19 23:00 ` Borislav Petkov
2012-12-19 23:17 ` H. Peter Anvin
2012-12-19 23:30 ` Borislav Petkov
2012-12-19 23:37 ` H. Peter Anvin
2012-12-19 23:23 ` H. Peter Anvin
2012-12-16 2:09 ` Yinghai Lu
2012-12-16 5:17 ` Yinghai Lu
2012-12-16 8:50 ` Yinghai Lu
2012-12-17 22:47 ` Yinghai Lu
2012-12-17 23:11 ` H. Peter Anvin
2012-12-17 23:26 ` Yinghai Lu
2012-12-18 1:11 ` Yinghai Lu
2012-12-18 1:51 ` Yinghai Lu
2012-12-18 2:42 ` Yinghai Lu
2012-12-14 20:10 ` H. Peter Anvin
2012-12-14 20:17 ` Yinghai Lu
2012-12-14 20:52 ` H. Peter Anvin
2012-12-14 21:07 ` Yinghai Lu
2012-12-11 18:02 ` H. Peter Anvin
2012-12-11 18:20 ` H. Peter Anvin
2012-12-11 18:42 ` Yinghai Lu
2012-12-11 18:46 ` H. Peter Anvin
2012-12-11 19:18 ` Yinghai Lu
2012-12-11 19:33 ` H. Peter Anvin
2012-11-30 1:47 ` [PATCH v2 06/10] x86/head_32.S: Early update ucode in 32-bit Fenghua Yu
2012-12-01 0:26 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 07/10] x86/head64.c: Early update ucode in 64-bit Fenghua Yu
2012-12-01 0:27 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 08/10] x86/smpboot.c: Early update ucode on AP Fenghua Yu
2012-12-01 0:28 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 09/10] x86/mm/init.c: Copy ucode from initrd image to memory Fenghua Yu
2012-12-01 0:29 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
2012-11-30 1:47 ` [PATCH v2 10/10] x86/Kconfig: Configurations to enable/disable the feature Fenghua Yu
2012-12-01 0:30 ` [tip:x86/microcode] x86/Kconfig: Configurations to enable/ disable " tip-bot for Fenghua Yu
-- strict thread matches above, loose matches on Subject: below --
2012-12-21 7:44 [PATCH v5 05/12] x86/microcode_core_early.c: Define interfaces for early loading ucode Fenghua Yu
2013-01-31 22:29 ` [tip:x86/microcode] " tip-bot for Fenghua Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-d42bdf2139115faa4d5bdb0dc591d435a644fde4@git.kernel.org \
--to=fenghua.yu@intel.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.