Skip to content

Commit df23cab

Browse files
Andreas HerrmannIngo Molnar
authored andcommitted
x86: microcode_amd: modify log messages
Impact: change microcode printk content Change log level and provide (at least I tried to;-) consistent, short, meaningful content. Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 5549b94 commit df23cab

1 file changed

Lines changed: 26 additions & 32 deletions

File tree

‎arch/x86/kernel/microcode_amd.c‎

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,13 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
9191
u32 dummy;
9292

9393
memset(csig, 0, sizeof(*csig));
94-
9594
if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
96-
printk(KERN_ERR "microcode: CPU%d not a capable AMD processor\n",
97-
cpu);
95+
printk(KERN_WARNING "microcode: CPU%d: AMD CPU family 0x%x not "
96+
"supported\n", cpu, c->x86);
9897
return -1;
9998
}
100-
10199
rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
102-
103-
printk(KERN_INFO "microcode: collect_cpu_info_amd : patch_id=0x%x\n",
104-
csig->rev);
105-
100+
printk(KERN_INFO "microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev);
106101
return 0;
107102
}
108103

@@ -125,21 +120,21 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
125120
}
126121

127122
if (!equiv_cpu_id) {
128-
printk(KERN_ERR "microcode: CPU%d cpu_id "
129-
"not found in equivalent cpu table\n", cpu);
123+
printk(KERN_WARNING "microcode: CPU%d: cpu revision "
124+
"not listed in equivalent cpu table\n", cpu);
130125
return 0;
131126
}
132127

133128
if (mc_header->processor_rev_id != equiv_cpu_id) {
134-
printk(KERN_ERR "microcode: CPU%d patch does not match "
135-
"(processor_rev_id: %x, eqiv_cpu_id: %x)\n",
129+
printk(KERN_ERR "microcode: CPU%d: patch mismatch "
130+
"(processor_rev_id: %x, equiv_cpu_id: %x)\n",
136131
cpu, mc_header->processor_rev_id, equiv_cpu_id);
137132
return 0;
138133
}
139134

140135
/* ucode might be chipset specific -- currently we don't support this */
141136
if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
142-
printk(KERN_WARNING "microcode: CPU%d loading of chipset "
137+
printk(KERN_ERR "microcode: CPU%d: loading of chipset "
143138
"specific code not yet supported\n", cpu);
144139
return 0;
145140
}
@@ -172,15 +167,13 @@ static void apply_microcode_amd(int cpu)
172167

173168
/* check current patch id and patch's id for match */
174169
if (rev != mc_amd->hdr.patch_id) {
175-
printk(KERN_ERR "microcode: CPU%d update from revision "
176-
"0x%x to 0x%x failed\n", cpu_num,
177-
mc_amd->hdr.patch_id, rev);
170+
printk(KERN_ERR "microcode: CPU%d: update failed "
171+
"(for patch_level=0x%x)\n", cpu, mc_amd->hdr.patch_id);
178172
return;
179173
}
180174

181-
printk(KERN_INFO "microcode: CPU%d updated from revision "
182-
"0x%x to 0x%x\n",
183-
cpu_num, uci->cpu_sig.rev, mc_amd->hdr.patch_id);
175+
printk(KERN_INFO "microcode: CPU%d: updated (new patch_level=0x%x)\n",
176+
cpu, rev);
184177

185178
uci->cpu_sig.rev = rev;
186179
}
@@ -202,18 +195,18 @@ static void *get_next_ucode(const u8 *buf, unsigned int size,
202195
return NULL;
203196

204197
if (section_hdr[0] != UCODE_UCODE_TYPE) {
205-
printk(KERN_ERR "microcode: error! "
206-
"Wrong microcode payload type field\n");
198+
printk(KERN_ERR "microcode: error: invalid type field in "
199+
"container file section header\n");
207200
return NULL;
208201
}
209202

210203
total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
211204

212-
printk(KERN_INFO "microcode: size %u, total_size %u\n",
213-
size, total_size);
205+
printk(KERN_DEBUG "microcode: size %u, total_size %u\n",
206+
size, total_size);
214207

215208
if (total_size > size || total_size > UCODE_MAX_SIZE) {
216-
printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
209+
printk(KERN_ERR "microcode: error: size mismatch\n");
217210
return NULL;
218211
}
219212

@@ -243,14 +236,15 @@ static int install_equiv_cpu_table(const u8 *buf)
243236
size = buf_pos[2];
244237

245238
if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
246-
printk(KERN_ERR "microcode: error! "
247-
"Wrong microcode equivalent cpu table\n");
239+
printk(KERN_ERR "microcode: error: invalid type field in "
240+
"container file section header\n");
248241
return 0;
249242
}
250243

251244
equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
252245
if (!equiv_cpu_table) {
253-
printk(KERN_ERR "microcode: error, can't allocate memory for equiv CPU table\n");
246+
printk(KERN_ERR "microcode: failed to allocate "
247+
"equivalent CPU table\n");
254248
return 0;
255249
}
256250

@@ -283,7 +277,8 @@ static int generic_load_microcode(int cpu, const u8 *data, size_t size)
283277

284278
offset = install_equiv_cpu_table(ucode_ptr);
285279
if (!offset) {
286-
printk(KERN_ERR "microcode: installing equivalent cpu table failed\n");
280+
printk(KERN_ERR "microcode: failed to create "
281+
"equivalent cpu table\n");
287282
return -EINVAL;
288283
}
289284

@@ -339,8 +334,7 @@ static int request_microcode_fw(int cpu, struct device *device)
339334

340335
ret = request_firmware(&firmware, fw_name, device);
341336
if (ret) {
342-
printk(KERN_ERR "microcode: ucode data file %s load failed\n",
343-
fw_name);
337+
printk(KERN_ERR "microcode: failed to load file %s\n", fw_name);
344338
return ret;
345339
}
346340

@@ -353,8 +347,8 @@ static int request_microcode_fw(int cpu, struct device *device)
353347

354348
static int request_microcode_user(int cpu, const void __user *buf, size_t size)
355349
{
356-
printk(KERN_WARNING "microcode: AMD microcode update via "
357-
"/dev/cpu/microcode is not supported\n");
350+
printk(KERN_INFO "microcode: AMD microcode update via "
351+
"/dev/cpu/microcode not supported\n");
358352
return -1;
359353
}
360354

0 commit comments

Comments
 (0)