aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/k8temp.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-06-20 03:22:32 -0400
committerJean Delvare <khali@linux-fr.org>2010-06-20 03:22:32 -0400
commitcd4de21f7e65a8cd04860f5661b3c18648ee52a1 (patch)
tree11a3b26e3b66bb3a971c8029ccb559e2c0e1ea88 /drivers/hwmon/k8temp.c
parent0e6c7870856c7fb4ee054d28ac253b2d3d0c7e36 (diff)
hwmon: (k8temp) Bypass core swapping on single-core processors
Commit a2e066bba2aad6583e3ff648bf28339d6c9f0898 introduced core swapping for CPU models 64 and later. I recently had a report about a Sempron 3200+, model 95, for which this patch broke temperature reading. It happens that this is a single-core processor, so the effect of the swapping was to read a temperature value for a core that didn't exist, leading to an incorrect value (-49 degrees C.) Disabling core swapping on singe-core processors should fix this. Additional comment from Andreas: The BKDG says Thermal Sensor Core Select (ThermSenseCoreSel)-Bit 2. This bit selects the CPU whose temperature is reported in the CurTemp field. This bit only applies to dual core processors. For single core processors CPU0 Thermal Sensor is always selected. k8temp_probe() correctly detected that SEL_CORE can't be used on single core CPU. Thus k8temp did never update the temperature values stored in temp[1][x] and -49 degrees was reported. For single core CPUs we must use the values read into temp[0][x]. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Rick Moritz <rhavin@gmx.net> Acked-by: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: stable@kernel.org
Diffstat (limited to 'drivers/hwmon/k8temp.c')
-rw-r--r--drivers/hwmon/k8temp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 0ceb6d6200a3..f26acdb11681 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *dev,
120 int temp; 120 int temp;
121 struct k8temp_data *data = k8temp_update_device(dev); 121 struct k8temp_data *data = k8temp_update_device(dev);
122 122
123 if (data->swap_core_select) 123 if (data->swap_core_select && (data->sensorsp & SEL_CORE))
124 core = core ? 0 : 1; 124 core = core ? 0 : 1;
125 125
126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; 126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;