diff options
-rw-r--r-- | arch/x86/kernel/microcode_amd.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 26e33bd8485b..63123d902103 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
@@ -34,6 +34,7 @@ MODULE_LICENSE("GPL v2"); | |||
34 | #define UCODE_UCODE_TYPE 0x00000001 | 34 | #define UCODE_UCODE_TYPE 0x00000001 |
35 | 35 | ||
36 | const struct firmware *firmware; | 36 | const struct firmware *firmware; |
37 | static int supported_cpu; | ||
37 | 38 | ||
38 | struct equiv_cpu_entry { | 39 | struct equiv_cpu_entry { |
39 | u32 installed_cpu; | 40 | u32 installed_cpu; |
@@ -73,15 +74,12 @@ static struct equiv_cpu_entry *equiv_cpu_table; | |||
73 | 74 | ||
74 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) | 75 | static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) |
75 | { | 76 | { |
76 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
77 | u32 dummy; | 77 | u32 dummy; |
78 | 78 | ||
79 | memset(csig, 0, sizeof(*csig)); | 79 | if (!supported_cpu) |
80 | if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { | ||
81 | pr_warning("microcode: CPU%d: AMD CPU family 0x%x not " | ||
82 | "supported\n", cpu, c->x86); | ||
83 | return -1; | 80 | return -1; |
84 | } | 81 | |
82 | memset(csig, 0, sizeof(*csig)); | ||
85 | rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); | 83 | rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); |
86 | pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev); | 84 | pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev); |
87 | return 0; | 85 | return 0; |
@@ -331,6 +329,17 @@ static void microcode_fini_cpu_amd(int cpu) | |||
331 | void init_microcode_amd(struct device *device) | 329 | void init_microcode_amd(struct device *device) |
332 | { | 330 | { |
333 | const char *fw_name = "amd-ucode/microcode_amd.bin"; | 331 | const char *fw_name = "amd-ucode/microcode_amd.bin"; |
332 | struct cpuinfo_x86 *c = &boot_cpu_data; | ||
333 | |||
334 | WARN_ON(c->x86_vendor != X86_VENDOR_AMD); | ||
335 | |||
336 | if (c->x86 < 0x10) { | ||
337 | pr_warning("microcode: AMD CPU family 0x%x not supported\n", | ||
338 | c->x86); | ||
339 | return; | ||
340 | } | ||
341 | supported_cpu = 1; | ||
342 | |||
334 | if (request_firmware(&firmware, fw_name, device)) | 343 | if (request_firmware(&firmware, fw_name, device)) |
335 | pr_err("microcode: failed to load file %s\n", fw_name); | 344 | pr_err("microcode: failed to load file %s\n", fw_name); |
336 | } | 345 | } |