Skip to contentSkip to conversation

Linux IA32 microcode driver

PATCH Chris Rankin 3 participants 4 messages Dec 22, 2001 – Dec 23, 2001

lore
Share & tools
lore
#0 lore raw

Hi,

Am I missing something rather obvious, or is the /dev/cpu/microcode device being mis-created under devfs with Linux 2.4.x? I have enclosed a patch to ensure that the character device really *is* a character device.

Cheers,
Chris

arch/i386/kernel/microcode.c renamed from arch/i386/kernel/microcode.c.orig +1 -1
@@ -125,7 +125,7 @@
 			MICROCODE_MINOR);
 
 	devfs_handle = devfs_register(NULL, "cpu/microcode",
-			DEVFS_FL_DEFAULT, 0, 0, S_IFREG | S_IRUSR | S_IWUSR, 
+			DEVFS_FL_DEFAULT, 0, 0, S_IFCHR | S_IRUSR | S_IWUSR, 
 			&microcode_fops, NULL);
 	if (devfs_handle == NULL && error) {
 		printk(KERN_ERR "microcode: failed to devfs_register()\n");
#1 lore raw
Quoted 4 lines · Chris Rankin

Am I missing something rather obvious, or is the /dev/cpu/microcode device being mis-created under devfs with Linux 2.4.x? I have enclosed a patch to ensure that the character device really *is* a character device.

On my system, running 2.4.16, I get no devfs entry for that or msr at all. I just get the mtrr entry.

This is with microcode and msr loaded as modules.

Signature · 3 lines
Ben Clifford     [email protected]
http://www.hawaga.org.uk/ben/  GPG: 30F06950
webcam: http://barbarella.hawaga.org.uk/~benc/webcam/live.html
#2 lore raw

The msr driver doesn't support devfs at all, and nor does cpuid come to that. However, microcode creates a miscellaneous character device, number (10,184), in the /dev/misc directory. This is why the regular /dev/cpu/microcode file is so mysterious...

Chris

Quoted 7 lines · --- Ben Clifford
Quoted 1 line · Chris Rankin

Am I missing something rather obvious, or is the

/dev/cpu/microcode

Quoted 1 line

device being mis-created under devfs with Linux

2.4.x? I have enclosed

Quoted 1 line

a patch to ensure that the character device really

Quoted 14 lines

*is* a character

Quoted 1 line

device.

On my system, running 2.4.16, I get no devfs entry for that or msr at all.
I just get the mtrr entry.

This is with microcode and msr loaded as modules.

Signature · 3 lines
Ben Clifford     [email protected]
http://www.hawaga.org.uk/ben/  GPG: 30F06950
webcam:

http://barbarella.hawaga.org.uk/~benc/webcam/live.html

Quoted 1 line

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

#3 lore raw
In reply to Chris Rankin

Hi Chris,

Yes, you are missing something, but it is not obvious. It is described in my article in LJ of last February.

Basically, the design of microcode driver takes advantage of devfs when it is available but works fine without it when it is not available. This is so that we can store an extra bit of information in a field not present in device nodes but present in regular files. What is this field? File size.

So, your patch is not to be applied. Instead, if you want to, fix the microcode_ctl startup script to not check if /dev/cpu/microcode is a character device node. It's a bug. Simon, I thought you fixed it, no?

Regards,
Tigran

Quoted 22 lines · Chris Rankin

Hi,

Am I missing something rather obvious, or is the /dev/cpu/microcode device being mis-created under devfs with Linux 2.4.x? I have enclosed a patch to ensure that the character device really *is* a character device.

Cheers,
Chris

arch/i386/kernel/microcode.c renamed from arch/i386/kernel/microcode.c.orig +1 -1
@@ -125,7 +125,7 @@
 			MICROCODE_MINOR);
 
 	devfs_handle = devfs_register(NULL, "cpu/microcode",
-			DEVFS_FL_DEFAULT, 0, 0, S_IFREG | S_IRUSR | S_IWUSR, 
+			DEVFS_FL_DEFAULT, 0, 0, S_IFCHR | S_IRUSR | S_IWUSR, 
 			&microcode_fops, NULL);
 	if (devfs_handle == NULL && error) {
 		printk(KERN_ERR "microcode: failed to devfs_register()\n");