Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 CPU model and CPU extended model cannot sim...
details: https://anonhg.NetBSD.org/src/rev/2d4c6b4ec2f3
branches: trunk
changeset: 749593:2d4c6b4ec2f3
user: sborrill <sborrill%NetBSD.org@localhost>
date: Thu Dec 03 14:44:12 2009 +0000
description:
CPU model and CPU extended model cannot simply be summed; the extended model
differentiates different CPUs within a given model type (i.e. model 0xe with
extended model 0x1 is NOT the same as a model 0xf).
Modern Xeons do not support MSR_IA32_EXT_CONFIG, so use model and extended
model correctly to avoid it
diffstat:
sys/arch/x86/x86/coretemp.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 4b1c5e6e2634 -r 2d4c6b4ec2f3 sys/arch/x86/x86/coretemp.c
--- a/sys/arch/x86/x86/coretemp.c Thu Dec 03 14:29:04 2009 +0000
+++ b/sys/arch/x86/x86/coretemp.c Thu Dec 03 14:44:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.12 2009/03/25 22:53:51 dyoung Exp $ */
+/* $NetBSD: coretemp.c,v 1.13 2009/12/03 14:44:12 sborrill Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.12 2009/03/25 22:53:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.13 2009/12/03 14:44:12 sborrill Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -67,7 +67,7 @@
struct coretemp_softc *sc;
uint32_t regs[4];
uint64_t msr;
- int cpumodel, cpumask;
+ int cpumodel, cpuextmodel, cpumask;
/*
* CPUID 0x06 returns 1 if the processor has on-die thermal
@@ -85,7 +85,7 @@
(int)device_unit(ci->ci_dev));
cpumodel = CPUID2MODEL(ci->ci_signature);
/* extended model */
- cpumodel += CPUID2EXTMODEL(ci->ci_signature);
+ cpuextmodel = CPUID2EXTMODEL(ci->ci_signature);
cpumask = ci->ci_signature & 15;
/*
@@ -111,9 +111,12 @@
*
* The if-clause for CPUs having the MSR_IA32_EXT_CONFIG was adapted
* from the Linux coretemp driver.
+ *
+ * MSR_IA32_EXT_CONFIG is NOT safe on all CPUs
*/
sc->sc_tjmax = 100;
- if ((cpumodel == 0xf && cpumask >= 2) || cpumodel == 0xe) {
+ if ((cpumodel == 0xf && cpumask >= 2) ||
+ (cpumodel == 0xe && cpuextmodel != 1)) {
msr = rdmsr(MSR_IA32_EXT_CONFIG);
if (msr & (1 << 30))
sc->sc_tjmax = 85;
Home |
Main Index |
Thread Index |
Old Index