linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* microcode, devfs: Wrong interface change in 2.4.25
       [not found]   ` <20040223142838.GA26601@dbz.icequake.net>
@ 2004-02-23 15:01     ` Giacomo A. Catenazzi
  2004-02-23 15:27       ` Tigran Aivazian
  0 siblings, 1 reply; 4+ messages in thread
From: Giacomo A. Catenazzi @ 2004-02-23 15:01 UTC (permalink / raw)
  To: tigran; +Cc: Ryan Underwood, Giacomo A. Catenazzi, 224355, linux-kernel

Hello!

 From the 2.4.25, devfs doesn't create anymore the microcode
device in /dev/cpu/microcode (as expected from in devices.txt
and LANANA) but in /dev/misc/microcode. The /dev/cpu/microcode
path is also hardcoded also in microcode_ctl and distributions
create only /dev/cpu/microcode.

So last microcode patch (in 2.4.25) is wrong.
You should add again the /dev/cpu/microcode support in devfs, so
that the normal and stable interface is maintained (in stable
kernel serie)

ciao
	giacomo



Ryan Underwood wrote:

> On Mon, Feb 23, 2004 at 09:47:58AM +0100, Giacomo A. Catenazzi wrote:
> 
>>>What I meant is that the name "/dev/misc/microcode" must be used instead
>>>of "/dev/cpu/microcode", because the microcode driver in 2.4.25 no
>>>longer registers with devfs.
>>
>>I don't undestand.
>>Do you say that devfs will register only /dev/misc/microcode ?
> 
> 
> No, the microcode driver only registers with misc.
> 
> 
>>So if devfs will register misc/microcode, it is probably
>>a kernel bug (interface should not change!) or a problem
>>with LANANA (in this case I should change misc microcode
>> in drivers, but after an update to 'makedev' package.
> 
> 
> Examine microcode.c driver diff between 2.4.23 and 2.4.25 in the init
> function.  The removed code is obvious.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: microcode, devfs: Wrong interface change in 2.4.25
  2004-02-23 15:01     ` microcode, devfs: Wrong interface change in 2.4.25 Giacomo A. Catenazzi
@ 2004-02-23 15:27       ` Tigran Aivazian
  2004-02-23 17:52         ` [patch-2.4.25] microcode.c fix (wasRe: " Tigran Aivazian
  0 siblings, 1 reply; 4+ messages in thread
From: Tigran Aivazian @ 2004-02-23 15:27 UTC (permalink / raw)
  To: Giacomo A. Catenazzi; +Cc: Ryan Underwood, 224355, linux-kernel

Hi Giacomo,

Thank you. Leave it with me and I'll verify what's going on in the
2.4.25 version thereof and correct it.

Kind regards
Tigran

On Mon, 23 Feb 2004, Giacomo A. Catenazzi wrote:

> Hello!
>
>  From the 2.4.25, devfs doesn't create anymore the microcode
> device in /dev/cpu/microcode (as expected from in devices.txt
> and LANANA) but in /dev/misc/microcode. The /dev/cpu/microcode
> path is also hardcoded also in microcode_ctl and distributions
> create only /dev/cpu/microcode.
>
> So last microcode patch (in 2.4.25) is wrong.
> You should add again the /dev/cpu/microcode support in devfs, so
> that the normal and stable interface is maintained (in stable
> kernel serie)
>
> ciao
> 	giacomo
>
>
>
> Ryan Underwood wrote:
>
> > On Mon, Feb 23, 2004 at 09:47:58AM +0100, Giacomo A. Catenazzi wrote:
> >
> >>>What I meant is that the name "/dev/misc/microcode" must be used instead
> >>>of "/dev/cpu/microcode", because the microcode driver in 2.4.25 no
> >>>longer registers with devfs.
> >>
> >>I don't undestand.
> >>Do you say that devfs will register only /dev/misc/microcode ?
> >
> >
> > No, the microcode driver only registers with misc.
> >
> >
> >>So if devfs will register misc/microcode, it is probably
> >>a kernel bug (interface should not change!) or a problem
> >>with LANANA (in this case I should change misc microcode
> >> in drivers, but after an update to 'makedev' package.
> >
> >
> > Examine microcode.c driver diff between 2.4.23 and 2.4.25 in the init
> > function.  The removed code is obvious.
> >
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch-2.4.25] microcode.c fix (wasRe: microcode, devfs: Wrong interface change in 2.4.25
  2004-02-23 15:27       ` Tigran Aivazian
@ 2004-02-23 17:52         ` Tigran Aivazian
  2004-02-24  8:29           ` Giacomo A. Catenazzi
  0 siblings, 1 reply; 4+ messages in thread
From: Tigran Aivazian @ 2004-02-23 17:52 UTC (permalink / raw)
  To: Giacomo A. Catenazzi; +Cc: Ryan Underwood, 224355, linux-kernel

Hi Giacomo,

Yes, you are right. I have now looked at the driver in 2.4.25 and see that
the latest change did break the compatibility inadvertently (because of
wrongly backporting the changes from 2.6 --- can't remember who did it
now, but it doesn't matter).

Please test the attached patch. I have tested it on 2.4.25 but only
without devfs compiled into the kernel.

Kind regards
Tigran

PS.Notice that I also added your earlier suggestion to do compile-time
merging of strings instead of runtime.

--- linux-2.4.25-orig/arch/i386/kernel/microcode.c	2004-02-18 13:36:30.000000000 +0000
+++ linux-2.4.25/arch/i386/kernel/microcode.c	2004-02-23 18:07:41.000000000 +0000
@@ -1,7 +1,7 @@
 /*
  *	Intel CPU Microcode Update driver for Linux
  *
- *	Copyright (C) 2000 Tigran Aivazian
+ *	Copyright (C) 2000-2004 Tigran Aivazian
  *
  *	This driver allows to upgrade microcode on Intel processors
  *	belonging to IA-32 family - PentiumPro, Pentium II,
@@ -64,6 +64,10 @@
  *		Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl
  *		because we no longer hold a copy of applied microcode
  *		in kernel memory.
+ *	1.14	23 Feb 2004 Tigran Aivazian <tigran@veritas.com>
+ *		Restored devfs regular file entry point which was
+ *		accidentally removed when back-porting changes from the 2.6
+ *		version of the driver.
  */


@@ -73,6 +77,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/miscdevice.h>
+#include <linux/devfs_fs_kernel.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>

@@ -84,8 +89,8 @@
 MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>");
 MODULE_LICENSE("GPL");

-#define MICROCODE_VERSION 	"1.13"
-#define MICRO_DEBUG 		1
+#define MICROCODE_VERSION 	"1.14"
+#define MICRO_DEBUG 		0
 #if MICRO_DEBUG
 #define dprintk(x...) printk(KERN_INFO x)
 #else
@@ -470,6 +475,7 @@
 	return -EINVAL;
 }

+/* shared between misc device and devfs regular file */
 static struct file_operations microcode_fops = {
 	.owner		= THIS_MODULE,
 	.write		= microcode_write,
@@ -483,29 +489,38 @@
 	.fops		= &microcode_fops,
 };

+static devfs_handle_t devfs_handle;
+
 static int __init microcode_init (void)
 {
 	int error;

 	error = misc_register(&microcode_dev);
-	if (error) {
+	if (error)
 		printk(KERN_ERR
 			"microcode: can't misc_register on minor=%d\n",
 			MICROCODE_MINOR);
-		return error;
+	devfs_handle = devfs_register(NULL, "cpu/microcode",
+			DEVFS_FL_DEFAULT, 0, 0, S_IFREG | S_IRUSR | S_IWUSR,
+			&microcode_fops, NULL);
+	if (devfs_handle == NULL && error) {
+		printk(KERN_ERR "microcode: failed to devfs_register()\n");
+		goto out;
 	}
-
+	error = 0;
 	printk(KERN_INFO
-		"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n",
-		MICROCODE_VERSION);
-	return 0;
+		"IA-32 Microcode Update Driver: v"
+		MICROCODE_VERSION " <tigran@veritas.com>\n");
+out:
+	return error;
 }

 static void __exit microcode_exit (void)
 {
 	misc_deregister(&microcode_dev);
-	printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n",
-			MICROCODE_VERSION);
+	devfs_unregister(devfs_handle);
+	printk(KERN_INFO "IA-32 Microcode Update Driver v"
+		MICROCODE_VERSION " unregistered\n");
 }

 module_init(microcode_init)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch-2.4.25] microcode.c fix (wasRe: microcode, devfs: Wrong interface change in 2.4.25
  2004-02-23 17:52         ` [patch-2.4.25] microcode.c fix (wasRe: " Tigran Aivazian
@ 2004-02-24  8:29           ` Giacomo A. Catenazzi
  0 siblings, 0 replies; 4+ messages in thread
From: Giacomo A. Catenazzi @ 2004-02-24  8:29 UTC (permalink / raw)
  To: Tigran Aivazian
  Cc: Giacomo A. Catenazzi, Ryan Underwood, 224355, linux-kernel

Tigran Aivazian wrote:

> Hi Giacomo,
> 
> Yes, you are right. I have now looked at the driver in 2.4.25 and see that
> the latest change did break the compatibility inadvertently (because of
> wrongly backporting the changes from 2.6 --- can't remember who did it
> now, but it doesn't matter).
> 
> Please test the attached patch. I have tested it on 2.4.25 but only
> without devfs compiled into the kernel.

The patch is correct. Now devfs will create the devices in 
/dev/cpu/microcode (and in /dev/misc).

[Yesterday I had some space problem with your patch, but I think
the problem was in my MUA]

thanks!

ciao
	giacomo



> 
> Kind regards
> Tigran
> 
> PS.Notice that I also added your earlier suggestion to do compile-time
> merging of strings instead of runtime.
> 
> --- linux-2.4.25-orig/arch/i386/kernel/microcode.c	2004-02-18 13:36:30.000000000 +0000
> +++ linux-2.4.25/arch/i386/kernel/microcode.c	2004-02-23 18:07:41.000000000 +0000
> @@ -1,7 +1,7 @@
>  /*
>   *	Intel CPU Microcode Update driver for Linux
>   *
> - *	Copyright (C) 2000 Tigran Aivazian
> + *	Copyright (C) 2000-2004 Tigran Aivazian
>   *
>   *	This driver allows to upgrade microcode on Intel processors
>   *	belonging to IA-32 family - PentiumPro, Pentium II,
> @@ -64,6 +64,10 @@
>   *		Removed ->read() method and obsoleted MICROCODE_IOCFREE ioctl
>   *		because we no longer hold a copy of applied microcode
>   *		in kernel memory.
> + *	1.14	23 Feb 2004 Tigran Aivazian <tigran@veritas.com>
> + *		Restored devfs regular file entry point which was
> + *		accidentally removed when back-porting changes from the 2.6
> + *		version of the driver.
>   */
> 
> 
> @@ -73,6 +77,7 @@
>  #include <linux/slab.h>
>  #include <linux/vmalloc.h>
>  #include <linux/miscdevice.h>
> +#include <linux/devfs_fs_kernel.h>
>  #include <linux/spinlock.h>
>  #include <linux/mm.h>
> 
> @@ -84,8 +89,8 @@
>  MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>");
>  MODULE_LICENSE("GPL");
> 
> -#define MICROCODE_VERSION 	"1.13"
> -#define MICRO_DEBUG 		1
> +#define MICROCODE_VERSION 	"1.14"
> +#define MICRO_DEBUG 		0
>  #if MICRO_DEBUG
>  #define dprintk(x...) printk(KERN_INFO x)
>  #else
> @@ -470,6 +475,7 @@
>  	return -EINVAL;
>  }
> 
> +/* shared between misc device and devfs regular file */
>  static struct file_operations microcode_fops = {
>  	.owner		= THIS_MODULE,
>  	.write		= microcode_write,
> @@ -483,29 +489,38 @@
>  	.fops		= &microcode_fops,
>  };
> 
> +static devfs_handle_t devfs_handle;
> +
>  static int __init microcode_init (void)
>  {
>  	int error;
> 
>  	error = misc_register(&microcode_dev);
> -	if (error) {
> +	if (error)
>  		printk(KERN_ERR
>  			"microcode: can't misc_register on minor=%d\n",
>  			MICROCODE_MINOR);
> -		return error;
> +	devfs_handle = devfs_register(NULL, "cpu/microcode",
> +			DEVFS_FL_DEFAULT, 0, 0, S_IFREG | S_IRUSR | S_IWUSR,
> +			&microcode_fops, NULL);
> +	if (devfs_handle == NULL && error) {
> +		printk(KERN_ERR "microcode: failed to devfs_register()\n");
> +		goto out;
>  	}
> -
> +	error = 0;
>  	printk(KERN_INFO
> -		"IA-32 Microcode Update Driver: v%s <tigran@veritas.com>\n",
> -		MICROCODE_VERSION);
> -	return 0;
> +		"IA-32 Microcode Update Driver: v"
> +		MICROCODE_VERSION " <tigran@veritas.com>\n");
> +out:
> +	return error;
>  }
> 
>  static void __exit microcode_exit (void)
>  {
>  	misc_deregister(&microcode_dev);
> -	printk(KERN_INFO "IA-32 Microcode Update Driver v%s unregistered\n",
> -			MICROCODE_VERSION);
> +	devfs_unregister(devfs_handle);
> +	printk(KERN_INFO "IA-32 Microcode Update Driver v"
> +		MICROCODE_VERSION " unregistered\n");
>  }
> 
>  module_init(microcode_init)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-24  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1Auyi3-0000Up-00@dbz>
     [not found] ` <4039BE3E.5070302@debian.org>
     [not found]   ` <20040223142838.GA26601@dbz.icequake.net>
2004-02-23 15:01     ` microcode, devfs: Wrong interface change in 2.4.25 Giacomo A. Catenazzi
2004-02-23 15:27       ` Tigran Aivazian
2004-02-23 17:52         ` [patch-2.4.25] microcode.c fix (wasRe: " Tigran Aivazian
2004-02-24  8:29           ` Giacomo A. Catenazzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).