Skip to contentSkip to conversation

Backporting coretemp and w83793 to 2.6.18

lm-sensors Boleslaw Ciesielski 3 participants 6 messages Aug 22, 2007 – May 12, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I am new to this list and hopefully this is not too stupid...

I have this new server based on the Asus DSBF-DE/SAS motherboard and a pair of Xeons 5355. I want to run CentOS 5.0 (RHEL 5 clone) on it. CentOS 5.0 is based on the 2.6.18 kernel and as such has drivers for everything *except* for the sensors. The motherboard uses 83793 chip.

So, I wanted to backport the w83793 and coretemp drivers to 2.6.18 kernel. I took the source from 2.6.22.3 for these two and tried to compile them for 2.6.18.

The w83793 compiles and loads as is, without any changes.

coretemp required some changes related to msr so I just restored the code that was in there when coretemp was floating around as a patch before it made it to the kernel. See the attached patch for detail.

Anyway, with those changes both coretemp and w83793 compile and load. I also copied sensors.conf from 2.10.4 and ran "sensors -s". However, neither is providing any data. Output looks like this:

$ sensors
coretemp-isa-0000
Adapter: ISA adapter

coretemp-isa-0001
Adapter: ISA adapter

coretemp-isa-0002
Adapter: ISA adapter

coretemp-isa-0003
Adapter: ISA adapter

coretemp-isa-0004
Adapter: ISA adapter

coretemp-isa-0005
Adapter: ISA adapter

coretemp-isa-0006
Adapter: ISA adapter

coretemp-isa-0007
Adapter: ISA adapter

w83793-i2c-0-2f
Adapter: SMBus I801 adapter at 1100

$

Am I missing something obvious? I did verify that I can get good sensor reading on this motherboard using Fedora 7 and 2.6.22 kernel but that's not what I want to run in production.

Any help will be appreciated.

Thanks,

Bolek

hwmon/coretemp.c renamed from tmp/linux-2.6.22.3/drivers/hwmon/coretemp.c +70 -7
@@ -36,6 +36,71 @@
 #include <asm/msr.h>
 #include <asm/processor.h>
 
+/*
+   Following part ripped from the msr.c. It should be merged with generic MSR
+   infrastructure (once ready)
+*/
+
+static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
+{
+	int err;
+
+	err = rdmsr_safe(reg, eax, edx);
+	if (err)
+		err = -EIO;
+	return err;
+}
+
+#ifdef CONFIG_SMP
+
+struct msr_command {
+	int cpu;
+	int err;
+	u32 reg;
+	u32 data[2];
+};
+
+static void msr_smp_rdmsr(void *cmd_block)
+{
+	struct msr_command *cmd = (struct msr_command *)cmd_block;
+
+	if (cmd->cpu == smp_processor_id())
+		cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
+}
+
+static inline int msr_read(int cpu, u32 reg, u32 * eax, u32 * edx)
+{
+	struct msr_command cmd;
+	int ret;
+
+	preempt_disable();
+	if (cpu == smp_processor_id()) {
+		ret = rdmsr_eio(reg, eax, edx);
+	} else {
+		cmd.cpu = cpu;
+		cmd.reg = reg;
+
+		smp_call_function(msr_smp_rdmsr, &cmd, 1, 1);
+
+		*eax = cmd.data[0];
+		*edx = cmd.data[1];
+
+		ret = cmd.err;
+	}
+	preempt_enable();
+	return ret;
+}
+
+#else				/* ! CONFIG_SMP */
+
+static inline int msr_read(int cpu, u32 reg, u32 *eax, u32 *edx)
+{
+	return rdmsr_eio(reg, eax, edx);
+}
+
+#endif				/* ! CONFIG_SMP */
+
+
 #define DRVNAME	"coretemp"
 
 typedef enum { SHOW_TEMP, SHOW_TJMAX, SHOW_LABEL, SHOW_NAME } SHOW;
@@ -132,7 +197,7 @@
 		u32 eax, edx;
 
 		data->valid = 0;
-		rdmsr_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
+		msr_read(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
 		data->alarm = (eax >> 5) & 1;
 		/* update only if data has been valid */
 		if (eax & 0x80000000) {
@@ -169,7 +234,7 @@
 	data->tjmax = 100000;
 
 	/* test if we can access the THERM_STATUS MSR */
-	err = rdmsr_safe_on_cpu(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
+	err = msr_read(data->id, MSR_IA32_THERM_STATUS, &eax, &edx);
 	if (err) {
 		dev_err(&pdev->dev,
 			"Unable to access THERM_STATUS MSR, giving up\n");
@@ -183,7 +248,7 @@
 
 	if ((c->x86_model == 0xe) && (c->x86_mask < 0xc)) {
 		/* check for microcode update */
-		rdmsr_on_cpu(data->id, MSR_IA32_UCODE_REV, &eax, &edx);
+		msr_read(data->id, MSR_IA32_UCODE_REV, &eax, &edx);
 		if (edx < 0x39) {
 			err = -ENODEV;
 			dev_err(&pdev->dev,
@@ -200,7 +265,7 @@
 
 	if (((c->x86_model == 0xf) && (c->x86_mask > 3)) ||
 		(c->x86_model == 0xe))  {
-		err = rdmsr_safe_on_cpu(data->id, 0xee, &eax, &edx);
+		err = msr_read(data->id, 0xee, &eax, &edx);
 		if (err) {
 			dev_warn(&pdev->dev,
 				 "Unable to access MSR 0xEE, Tjmax left at %d "
@@ -216,7 +281,7 @@
 	   bit 50 of MSR_IA32_PLATFORM_ID should be 0.
 	*/
 
-	rdmsr_safe_on_cpu(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);
+	msr_read(data->id, MSR_IA32_PLATFORM_ID, &eax, &edx);
 
 	if ((c->x86_model == 0xf) && (!(edx & 0x00040000))) {
 		dev_warn(&pdev->dev, "Using undocumented features, absolute "
@@ -339,11 +404,9 @@
 
 	switch (action) {
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 		coretemp_device_add(cpu);
 		break;
 	case CPU_DEAD:
-	case CPU_DEAD_FROZEN:
 		coretemp_device_remove(cpu);
 		break;
 	}

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 11 lines · Boleslaw Ciesielski

I have this new server based on the Asus DSBF-DE/SAS motherboard and a pair of Xeons 5355. I want to run CentOS 5.0 (RHEL 5 clone) on it. CentOS 5.0 is based on the 2.6.18 kernel and as such has drivers for everything *except* for the sensors. The motherboard uses 83793 chip.

So, I wanted to backport the w83793 and coretemp drivers to 2.6.18 kernel. I took the source from 2.6.22.3 for these two and tried to compile them for 2.6.18.

The w83793 compiles and loads as is, without any changes.

Quoted 7 lines

coretemp required some changes related to msr so I just restored the code that was in there when coretemp was floating around as a patch before it made it to the kernel. See the attached patch for detail.

Anyway, with those changes both coretemp and w83793 compile and load. I also copied sensors.conf from 2.10.4 and ran "sensors -s". However, neither is providing any data. Output looks like this:

Just a quick update. I got reply off-list that I am missing the new versions of the user tools. I installed 2.10.4 rpm from Fedora 7 and I get the readings now.

Thank you

Bolek

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Boleslaw Ciesielski

Hi,

I have the same problema as you reported (the only difference is that my system is a x64 Cent OS 5.1, board Supermicro X7DBR-3 (Winbond W83793G), kernel 2.6.18-53.1.14.el5.

We need that kernel version and I’m blocked because I have absolutly no experience in compiling and installing drivers… so can you send me those compiled by you or detailed instructions or references for compiling and installing them?

Thank you in advance, sorry if my request is too silly.

Regards

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Boleslaw Ciesielski

Sorry, this question is about one archived post
(http://lists.lm-sensors.org/pipermail/lm-sensors/2007-August/021007.html)
by Boleslaw Ciesielski... (bellow)

Any help will be appreciated.

Quoted 20 lines
Quoted 11 lines · Boleslaw Ciesielski

I have this new server based on the Asus DSBF-DE/SAS motherboard and a pair of Xeons 5355. I want to run CentOS 5.0 (RHEL 5 clone) on it. CentOS 5.0 is based on the 2.6.18 kernel and as such has drivers for everything *except* for the sensors. The motherboard uses 83793 chip.

So, I wanted to backport the w83793 and coretemp drivers to 2.6.18 kernel. I took the source from 2.6.22.3 for these two and tried to compile them for 2.6.18.

The w83793 compiles and loads as is, without any changes.

Quoted 7 lines

coretemp required some changes related to msr so I just restored the code that was in there when coretemp was floating around as a patch before it made it to the kernel. See the attached patch for detail.

Anyway, with those changes both coretemp and w83793 compile and load. I also copied sensors.conf from 2.10.4 and ran "sensors -s". However, neither is providing any data. Output looks like this:

Quoted 7 lines

Just a quick update. I got reply off-list that I am missing the new versions of the user tools. I installed 2.10.4 rpm from Fedora 7 and I get the readings now.

Thank you

Bolek

__________ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 3071 (20080502) __________

ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Boleslaw Ciesielski
Quoted 8 lines · Darth Tumi

I have the same problema as you reported (the only difference is that my system is a x64 Cent OS 5.1, board Supermicro X7DBR-3 (Winbond W83793G), kernel 2.6.18-53.1.14.el5.

We need that kernel version and I'm blocked because I have absolutly no experience in compiling and installing drivers so can you send me those compiled by you or detailed instructions or references for compiling and installing them?

I happen to have backported the w83793 driver to kernel 2.6.18 for a friend of mine already. You can pick it from:
http://jdelvare.pck.nerim.net/sensors/w83793/

In order to build it, you'll need the usual tools (gcc, make) and the kernel sources matching your running kernel. Just running "make" should build the w83793 driver, and "make modules_install" as root should install it. Then all you have to do is "modprobe w83793".

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Boleslaw Ciesielski

Great!
Thanks a lot

-----Mensaje original-----
De: Jean Delvare [mailto:[email protected]]
Enviado el: lunes, 12 de mayo de 2008 14:38
Para: Darth Tumi
CC: [email protected]
Asunto: Re: [lm-sensors] Backporting coretemp and w83793 to 2.6.18

Quoted 8 lines · Darth Tumi

I have the same problema as you reported (the only difference is that my system is a x64 Cent OS 5.1, board Supermicro X7DBR-3 (Winbond W83793G), kernel 2.6.18-53.1.14.el5.

We need that kernel version and I'm blocked because I have absolutly no experience in compiling and installing drivers so can you send me those compiled by you or detailed instructions or references for compiling and installing them?

I happen to have backported the w83793 driver to kernel 2.6.18 for a friend of mine already. You can pick it from:
http://jdelvare.pck.nerim.net/sensors/w83793/

In order to build it, you'll need the usual tools (gcc, make) and the kernel sources matching your running kernel. Just running "make" should build the w83793 driver, and "make modules_install" as root should install it. Then all you have to do is "modprobe w83793".

Signature · 23 lines
Jean Delvare
 

__________ Información de ESET NOD32 Antivirus, versión de la base de firmas
de virus 3092 (20080512) __________

ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
 
 

__________ Información de ESET NOD32 Antivirus, versión de la base de firmas
de virus 3092 (20080512) __________

ESET NOD32 Antivirus ha comprobado este mensaje.
http://www.eset.com
 


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors