]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.17/hwmon-k8temp-bypass-core-swapping-on-single-core-processors.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / hwmon-k8temp-bypass-core-swapping-on-single-core-processors.patch
1 From cd4de21f7e65a8cd04860f5661b3c18648ee52a1 Mon Sep 17 00:00:00 2001
2 From: Jean Delvare <khali@linux-fr.org>
3 Date: Sun, 20 Jun 2010 09:22:32 +0200
4 Subject: hwmon: (k8temp) Bypass core swapping on single-core processors
5
6 From: Jean Delvare <khali@linux-fr.org>
7
8 commit cd4de21f7e65a8cd04860f5661b3c18648ee52a1 upstream.
9
10 Commit a2e066bba2aad6583e3ff648bf28339d6c9f0898 introduced core
11 swapping for CPU models 64 and later. I recently had a report about
12 a Sempron 3200+, model 95, for which this patch broke temperature
13 reading. It happens that this is a single-core processor, so the
14 effect of the swapping was to read a temperature value for a core
15 that didn't exist, leading to an incorrect value (-49 degrees C.)
16
17 Disabling core swapping on singe-core processors should fix this.
18
19 Additional comment from Andreas:
20
21 The BKDG says
22
23 Thermal Sensor Core Select (ThermSenseCoreSel)-Bit 2. This bit
24 selects the CPU whose temperature is reported in the CurTemp
25 field. This bit only applies to dual core processors. For
26 single core processors CPU0 Thermal Sensor is always selected.
27
28 k8temp_probe() correctly detected that SEL_CORE can't be used on single
29 core CPU. Thus k8temp did never update the temperature values stored
30 in temp[1][x] and -49 degrees was reported. For single core CPUs we
31 must use the values read into temp[0][x].
32
33 Signed-off-by: Jean Delvare <khali@linux-fr.org>
34 Tested-by: Rick Moritz <rhavin@gmx.net>
35 Acked-by: Andreas Herrmann <andreas.herrmann3@amd.com>
36 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
37
38 ---
39 drivers/hwmon/k8temp.c | 2 +-
40 1 file changed, 1 insertion(+), 1 deletion(-)
41
42 --- a/drivers/hwmon/k8temp.c
43 +++ b/drivers/hwmon/k8temp.c
44 @@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *
45 int temp;
46 struct k8temp_data *data = k8temp_update_device(dev);
47
48 - if (data->swap_core_select)
49 + if (data->swap_core_select && (data->sensorsp & SEL_CORE))
50 core = core ? 0 : 1;
51
52 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;