Commit 32478006 authored by Jan Beulich's avatar Jan Beulich Committed by Guenter Roeck

hwmon: (coretemp) fix reading of microcode revision (v2)

According to the documentation, simply reading the respective MSR
isn't sufficient: It should be written with zeros, cpuid(1) be
executed, and then read (see arch/x86/kernel/cpu/intel.c for an
example).

v2: Fail probe when microcode revision cannot be determined, but is
needed to check for proper operation.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Chen Gong <gong.chen@linux.intel.com>
Cc: Jean Delvare <khali@linux-fr.org>
Acked-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent 17c10d61
...@@ -289,6 +289,15 @@ static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id, ...@@ -289,6 +289,15 @@ static int __devinit get_tjmax(struct cpuinfo_x86 *c, u32 id,
} }
} }
static void __devinit get_ucode_rev_on_cpu(void *edx)
{
u32 eax;
wrmsr(MSR_IA32_UCODE_REV, 0, 0);
sync_core();
rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
}
static int __devinit coretemp_probe(struct platform_device *pdev) static int __devinit coretemp_probe(struct platform_device *pdev)
{ {
struct coretemp_data *data; struct coretemp_data *data;
...@@ -324,8 +333,15 @@ static int __devinit coretemp_probe(struct platform_device *pdev) ...@@ -324,8 +333,15 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) { if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) {
/* check for microcode update */ /* check for microcode update */
rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx); err = smp_call_function_single(data->id, get_ucode_rev_on_cpu,
if (edx < 0x39) { &edx, 1);
if (err) {
dev_err(&pdev->dev,
"Cannot determine microcode revision of "
"CPU#%u (%d)!\n", data->id, err);
err = -ENODEV;
goto exit_free;
} else if (edx < 0x39) {
err = -ENODEV; err = -ENODEV;
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Errata AE18 not fixed, update BIOS or " "Errata AE18 not fixed, update BIOS or "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment