2001-12-22 12:58:49

by Chris Rankin

[permalink] [raw]
Subject: Linux IA32 microcode driver

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

--- linux-2.4.17/arch/i386/kernel/microcode.c.orig Sat Dec 22 12:37:07 2001
+++ linux-2.4.17/arch/i386/kernel/microcode.c Sat Dec 22 12:43:10 2001
@@ -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");


2001-12-22 18:53:40

by Ben Clifford

[permalink] [raw]
Subject: Re: Linux IA32 microcode driver

On Sat, 22 Dec 2001, Chris Rankin wrote:

> 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.

--
Ben Clifford [email protected]
http://www.hawaga.org.uk/ben/ GPG: 30F06950
webcam: http://barbarella.hawaga.org.uk/~benc/webcam/live.html

2001-12-23 01:38:36

by Chris Rankin

[permalink] [raw]
Subject: Re: Linux IA32 microcode driver

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

--- Ben Clifford <[email protected]> wrote:
> On Sat, 22 Dec 2001, Chris Rankin wrote:
>
> > 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.
>
> --
> Ben Clifford [email protected]
> http://www.hawaga.org.uk/ben/ GPG: 30F06950
> webcam:
>
http://barbarella.hawaga.org.uk/~benc/webcam/live.html
>


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

2001-12-23 09:34:25

by Tigran Aivazian

[permalink] [raw]
Subject: Re: Linux IA32 microcode driver

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




On Sat, 22 Dec 2001, Chris Rankin wrote:

> 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
>
> --- linux-2.4.17/arch/i386/kernel/microcode.c.orig Sat Dec 22 12:37:07 2001
> +++ linux-2.4.17/arch/i386/kernel/microcode.c Sat Dec 22 12:43:10 2001
> @@ -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");
>