From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Rudolf Marek <r.marek@assembler.cz>
Cc: Ingo Molnar <mingo@elte.hu>, x86 maintainers <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
LM Sensors <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for
Date: Tue, 26 May 2009 12:22:33 +0000 [thread overview]
Message-ID: <1243339833.12303.2.camel@localhost.localdomain> (raw)
In-Reply-To: <4A182B61.5010503@assembler.cz>
On Sat, 2009-05-23 at 18:59 +0200, Rudolf Marek wrote:
> Hi,
>
> Yes it works for most CPUs, but for unlucky users we might get complains from
> them - and false alarms.
>
> I'm talking about:
>
> http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/41322.pdf
>
> Errata #319
>
> So far all CPUs have the issue.
>
> Rudolf
>
Here is the patch which will prepare the report for Inaccurate
Temperature Measurement to fix/suppress inaccurate Monitoring.
[PATCH] x86: hwmon/k8temp.c Add support for AMD 10H and 11H
Some AMD 10H cpus reports Inaccurate Temperature Measurement:
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/41322.pdf
Errata #319
So Added report message to fix/suppress inaccurate Monitoring.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
drivers/hwmon/k8temp.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 1fe9951..1e9594a 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -1,5 +1,6 @@
/*
* k8temp.c - Linux kernel module for hardware monitoring
+ * for AMD K8 and derivates
*
* Copyright (C) 2006 Rudolf Marek <r.marek@assembler.cz>
*
@@ -33,7 +34,7 @@
#include <linux/mutex.h>
#include <asm/processor.h>
-#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000)
+#define REG_TCTL 0xa4
#define REG_TEMP 0xe4
#define SEL_PLACE 0x40
#define SEL_CORE 0x04
@@ -52,6 +53,20 @@ struct k8temp_data {
u32 temp_offset;
};
+static const char report[] = "Please send below message to: "
+ "LKML <linux-kernel@vger.kernel.org>, "
+ "Rudolf Marek <r.marek@assembler.cz>, "
+ "Jaswinder Singh Rajput <jaswinder@kernel.org>"
+ "\n\"Invalid temperature:";
+
+static unsigned long temp_from_reg(unsigned long val)
+{
+ if (boot_cpu_data.x86 > 0xf)
+ return ((val) >> 21) * 125;
+ else
+ return ((((val) >> 16) & 0xff) - 49) * 1000;
+}
+
static struct k8temp_data *k8temp_update_device(struct device *dev)
{
struct k8temp_data *data = dev_get_drvdata(dev);
@@ -62,6 +77,11 @@ static struct k8temp_data *k8temp_update_device(struct device *dev)
if (!data->valid
|| time_after(jiffies, data->last_updated + HZ)) {
+ if (boot_cpu_data.x86 > 0xf) {
+ pci_read_config_dword(pdev, REG_TCTL,
+ &data->temp[0][0]);
+ goto update_done;
+ }
pci_read_config_byte(pdev, REG_TEMP, &tmp);
tmp &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
pci_write_config_byte(pdev, REG_TEMP, tmp);
@@ -89,6 +109,7 @@ static struct k8temp_data *k8temp_update_device(struct device *dev)
}
}
+update_done:
data->last_updated = jiffies;
data->valid = 1;
}
@@ -123,7 +144,14 @@ static ssize_t show_temp(struct device *dev,
if (data->swap_core_select)
core = core ? 0 : 1;
- temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
+ temp = temp_from_reg(data->temp[core][place]) + data->temp_offset;
+
+ /* Some AMD 10H cpus reports Inaccurate Temperature Measurement */
+ if ((temp < 21000) || (temp > 90000))
+ WARN_ONCE(1, "%s reg 0x%x temp %d for %d:%d:%d:%d\"\n",
+ report, data->temp[core][place], temp,
+ boot_cpu_data.x86_vendor, boot_cpu_data.x86,
+ boot_cpu_data.x86_model, boot_cpu_data.x86_mask);
return sprintf(buf, "%d\n", temp);
}
@@ -138,6 +166,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
static struct pci_device_id k8temp_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
{ 0 },
};
@@ -157,6 +187,9 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
goto exit;
}
+ if (boot_cpu_data.x86 > 0xf)
+ goto probe_done;
+
model = boot_cpu_data.x86_model;
stepping = boot_cpu_data.x86_mask;
@@ -226,6 +259,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
data->sensorsp &= ~SEL_CORE;
}
+probe_done:
data->name = "k8temp";
mutex_init(&data->update_lock);
dev_set_drvdata(&pdev->dev, data);
--
1.6.0.6
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
WARNING: multiple messages have this Message-ID (diff)
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Rudolf Marek <r.marek@assembler.cz>
Cc: Ingo Molnar <mingo@elte.hu>, x86 maintainers <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
LM Sensors <lm-sensors@lm-sensors.org>
Subject: Re: [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H
Date: Tue, 26 May 2009 17:40:33 +0530 [thread overview]
Message-ID: <1243339833.12303.2.camel@localhost.localdomain> (raw)
In-Reply-To: <4A182B61.5010503@assembler.cz>
On Sat, 2009-05-23 at 18:59 +0200, Rudolf Marek wrote:
> Hi,
>
> Yes it works for most CPUs, but for unlucky users we might get complains from
> them - and false alarms.
>
> I'm talking about:
>
> http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/41322.pdf
>
> Errata #319
>
> So far all CPUs have the issue.
>
> Rudolf
>
Here is the patch which will prepare the report for Inaccurate
Temperature Measurement to fix/suppress inaccurate Monitoring.
[PATCH] x86: hwmon/k8temp.c Add support for AMD 10H and 11H
Some AMD 10H cpus reports Inaccurate Temperature Measurement:
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/41322.pdf
Errata #319
So Added report message to fix/suppress inaccurate Monitoring.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
drivers/hwmon/k8temp.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 1fe9951..1e9594a 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -1,5 +1,6 @@
/*
* k8temp.c - Linux kernel module for hardware monitoring
+ * for AMD K8 and derivates
*
* Copyright (C) 2006 Rudolf Marek <r.marek@assembler.cz>
*
@@ -33,7 +34,7 @@
#include <linux/mutex.h>
#include <asm/processor.h>
-#define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000)
+#define REG_TCTL 0xa4
#define REG_TEMP 0xe4
#define SEL_PLACE 0x40
#define SEL_CORE 0x04
@@ -52,6 +53,20 @@ struct k8temp_data {
u32 temp_offset;
};
+static const char report[] = "Please send below message to: "
+ "LKML <linux-kernel@vger.kernel.org>, "
+ "Rudolf Marek <r.marek@assembler.cz>, "
+ "Jaswinder Singh Rajput <jaswinder@kernel.org>"
+ "\n\"Invalid temperature:";
+
+static unsigned long temp_from_reg(unsigned long val)
+{
+ if (boot_cpu_data.x86 > 0xf)
+ return ((val) >> 21) * 125;
+ else
+ return ((((val) >> 16) & 0xff) - 49) * 1000;
+}
+
static struct k8temp_data *k8temp_update_device(struct device *dev)
{
struct k8temp_data *data = dev_get_drvdata(dev);
@@ -62,6 +77,11 @@ static struct k8temp_data *k8temp_update_device(struct device *dev)
if (!data->valid
|| time_after(jiffies, data->last_updated + HZ)) {
+ if (boot_cpu_data.x86 > 0xf) {
+ pci_read_config_dword(pdev, REG_TCTL,
+ &data->temp[0][0]);
+ goto update_done;
+ }
pci_read_config_byte(pdev, REG_TEMP, &tmp);
tmp &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
pci_write_config_byte(pdev, REG_TEMP, tmp);
@@ -89,6 +109,7 @@ static struct k8temp_data *k8temp_update_device(struct device *dev)
}
}
+update_done:
data->last_updated = jiffies;
data->valid = 1;
}
@@ -123,7 +144,14 @@ static ssize_t show_temp(struct device *dev,
if (data->swap_core_select)
core = core ? 0 : 1;
- temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
+ temp = temp_from_reg(data->temp[core][place]) + data->temp_offset;
+
+ /* Some AMD 10H cpus reports Inaccurate Temperature Measurement */
+ if ((temp < 21000) || (temp > 90000))
+ WARN_ONCE(1, "%s reg 0x%x temp %d for %d:%d:%d:%d\"\n",
+ report, data->temp[core][place], temp,
+ boot_cpu_data.x86_vendor, boot_cpu_data.x86,
+ boot_cpu_data.x86_model, boot_cpu_data.x86_mask);
return sprintf(buf, "%d\n", temp);
}
@@ -138,6 +166,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
static struct pci_device_id k8temp_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
{ 0 },
};
@@ -157,6 +187,9 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
goto exit;
}
+ if (boot_cpu_data.x86 > 0xf)
+ goto probe_done;
+
model = boot_cpu_data.x86_model;
stepping = boot_cpu_data.x86_mask;
@@ -226,6 +259,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
data->sensorsp &= ~SEL_CORE;
}
+probe_done:
data->name = "k8temp";
mutex_init(&data->update_lock);
dev_set_drvdata(&pdev->dev, data);
--
1.6.0.6
next prev parent reply other threads:[~2009-05-26 12:22 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-22 8:04 [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jaswinder Singh Rajput
2009-05-22 8:16 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Rudolf Marek
2009-05-22 8:16 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Rudolf Marek
2009-05-22 8:42 ` Jaswinder Singh Rajput
2009-05-22 8:54 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-22 9:30 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jaswinder Singh Rajput
2009-05-22 9:42 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-23 16:59 ` Rudolf Marek
2009-05-23 16:59 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Rudolf Marek
2009-05-24 12:19 ` Jaswinder Singh Rajput
2009-05-24 12:31 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-26 12:10 ` Jaswinder Singh Rajput [this message]
2009-05-26 12:22 ` Jaswinder Singh Rajput
2009-05-26 15:20 ` Rudolf Marek
2009-05-26 15:20 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Rudolf Marek
2009-05-26 15:44 ` Jaswinder Singh Rajput
2009-05-26 15:56 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-28 11:57 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jaswinder Singh Rajput
2009-05-28 12:09 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-28 12:28 ` Jean Delvare
2009-05-28 12:28 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jean Delvare
2009-05-28 14:13 ` Jaswinder Singh Rajput
2009-05-28 14:25 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-05-28 14:49 ` [lm-sensors] [stable] [PATCH-tip] x86: hwmon/k8temp.c Greg KH
2009-05-28 14:49 ` [stable] [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Greg KH
2009-05-29 5:42 ` Jaswinder Singh Rajput
2009-05-29 5:54 ` [lm-sensors] [stable] [PATCH-tip] x86: hwmon/k8temp.c Add Jaswinder Singh Rajput
2009-05-29 6:05 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jean Delvare
2009-05-29 6:05 ` [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jean Delvare
2009-06-06 10:36 ` Jaswinder Singh Rajput
2009-06-06 10:48 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
2009-06-20 7:56 ` [HWMON] x86: hwmon/k8temp.c Add support for AMD 11H Jaswinder Singh Rajput
2009-06-20 8:08 ` [lm-sensors] " Jaswinder Singh Rajput
2009-06-25 14:09 ` Jaswinder Singh Rajput
2009-06-25 14:21 ` [lm-sensors] " Jaswinder Singh Rajput
2009-07-19 5:03 ` Jaswinder Singh Rajput
2009-07-19 5:15 ` [lm-sensors] " Jaswinder Singh Rajput
2009-05-25 13:45 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jean Delvare
2009-05-25 13:45 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for AMD 10H and 11H Jean Delvare
2009-05-25 14:17 ` Jaswinder Singh Rajput
2009-05-25 14:29 ` [lm-sensors] [PATCH-tip] x86: hwmon/k8temp.c Add support for Jaswinder Singh Rajput
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1243339833.12303.2.camel@localhost.localdomain \
--to=jaswinder@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=mingo@elte.hu \
--cc=r.marek@assembler.cz \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.