Re: [PATCH 3/3] coretemp: Get microcode revision from cpu_data v2

From: Jean Delvare
Date: Mon Jul 11 2011 - 07:46:58 EST


On Wed, 6 Jul 2011 16:57:03 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Now that the ucode revision is available in cpu_data remove
> the existing code in coretemp.c to query it manually. Read the ucode
> revision from cpu_data instead
>
> v2: Fix misplaced variable init. Remove unused variables.
> Cc: jbeulich@xxxxxxxxxx
> Cc: fenghua.yu@xxxxxxxxx
> Cc: khali@xxxxxxxxxxxx
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> ---
> drivers/hwmon/coretemp.c | 31 +++++--------------------------
> 1 files changed, 5 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
> index 0070d54..2d038e3 100644
> --- a/drivers/hwmon/coretemp.c
> +++ b/drivers/hwmon/coretemp.c
> @@ -307,15 +307,6 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
> return adjust_tjmax(c, id, dev);
> }
>
> -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 get_pkg_tjmax(unsigned int cpu, struct device *dev)
> {
> int err;
> @@ -410,29 +401,17 @@ static void update_ttarget(__u8 cpu_model, struct temp_data *tdata,
> static int __devinit chk_ucode_version(struct platform_device *pdev)
> {
> struct cpuinfo_x86 *c = &cpu_data(pdev->id);
> - int err;
> - u32 edx;
>
> /*
> * Check if we have problem with errata AE18 of Core processors:
> * Readings might stop update when processor visited too deep sleep,
> * fixed for stepping D0 (6EC).
> */
> - if (c->x86_model == 0xe && c->x86_mask < 0xc) {
> - /* check for microcode update */
> - err = smp_call_function_single(pdev->id, get_ucode_rev_on_cpu,
> - &edx, 1);
> - if (err) {
> - dev_err(&pdev->dev,
> - "Cannot determine microcode revision of "
> - "CPU#%u (%d)!\n", pdev->id, err);
> - return -ENODEV;
> - } else if (edx < 0x39) {
> - dev_err(&pdev->dev,
> - "Errata AE18 not fixed, update BIOS or "
> - "microcode of the CPU!\n");
> - return -ENODEV;
> - }
> + if (c->x86_model == 0xe && c->x86_mask < 0xc && c->microcode < 0x39) {
> + dev_err(&pdev->dev,
> + "Errata AE18 not fixed, update BIOS or "
> + "microcode of the CPU!\n");
> + return -ENODEV;
> }
> return 0;
> }

Looks good, thanks.

Acked-by: Jean Delvare <khali@xxxxxxxxxxxx>

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/