* module.viomap support for ppc64
@ 2004-08-12 17:37 Olaf Hering
2004-08-12 19:34 ` Hollis Blanchard
0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2004-08-12 17:37 UTC (permalink / raw)
To: David Boutcher, Olaf Hering; +Cc: linuxppc64-dev, linux-kernel
David,
these 2 patches add support for a modules.viomap to depmod.
It needs also a kernel change.
Current MODULE_DEVICE_TABLE(vio, $table); defines 2 char pointers. I'm
not sure if depmod can really handle it. Where do they point to in the
module binary? I could find an answer, so far. I just declared an array.
According to Segher, the "name" and "compatible" properties have an
undefined size. So we have to pick a value and stick with it. I used 32,
for alignment reasons.
What additional padding is required in VIO_DEVICE_SIZE64?
The depmod change produces a file like that:
/lib/modules/2.6.5-0-pseries64/modules.viomap
# vio module name compatible
ibmveth network IBM,l-lan
ibmvscsic scsi-3 IBM,v-scsi
ibmvscsis v-scsi-host IBM,v-scsi-host
hvcs serial-server hvterm2
diff -purNX /suse/olh/kernel/kernel_exclude.txt x/linux-2.6.5/drivers/char/hvcs.c R/linux-2.6.5/drivers/char/hvcs.c
--- x/linux-2.6.5/drivers/char/hvcs.c 2004-08-12 19:01:32.438100493 +0200
+++ R/linux-2.6.5/drivers/char/hvcs.c 2004-08-12 18:06:44.088172299 +0200
@@ -416,7 +416,7 @@ int khvcsd(void *unused)
static struct vio_device_id hvcs_driver_table[] __devinitdata= {
{"serial-server", "hvterm2"},
- { 0,}
+ { "", ""}
};
MODULE_DEVICE_TABLE(vio, hvcs_driver_table);
diff -purNX /suse/olh/kernel/kernel_exclude.txt x/linux-2.6.5/drivers/net/ibmveth.c R/linux-2.6.5/drivers/net/ibmveth.c
--- x/linux-2.6.5/drivers/net/ibmveth.c 2004-08-12 19:02:22.639596208 +0200
+++ R/linux-2.6.5/drivers/net/ibmveth.c 2004-08-12 18:07:38.302627485 +0200
@@ -1123,7 +1123,7 @@ static void ibmveth_proc_unregister_driv
static struct vio_device_id ibmveth_device_table[] __devinitdata= {
{ "network", "IBM,l-lan"},
- { 0,}
+ { "",""}
};
MODULE_DEVICE_TABLE(vio, ibmveth_device_table);
diff -purNX /suse/olh/kernel/kernel_exclude.txt x/linux-2.6.5/drivers/scsi/ibmvscsi/ibmvscsis.c R/linux-2.6.5/drivers/scsi/ibmvscsi/ibmvscsis.c
--- x/linux-2.6.5/drivers/scsi/ibmvscsi/ibmvscsis.c 2004-08-12 19:01:32.336116964 +0200
+++ R/linux-2.6.5/drivers/scsi/ibmvscsi/ibmvscsis.c 2004-08-12 18:07:10.481881479 +0200
@@ -2754,7 +2754,7 @@ static int ibmvscsis_remove(struct vio_d
static struct vio_device_id ibmvscsis_device_table[] __devinitdata = {
{"v-scsi-host", "IBM,v-scsi-host"},
- {0,}
+ {"", ""}
};
MODULE_DEVICE_TABLE(vio, ibmvscsis_device_table);
diff -purNX /suse/olh/kernel/kernel_exclude.txt x/linux-2.6.5/drivers/scsi/ibmvscsi/rpa_vscsi.c R/linux-2.6.5/drivers/scsi/ibmvscsi/rpa_vscsi.c
--- x/linux-2.6.5/drivers/scsi/ibmvscsi/rpa_vscsi.c 2004-08-12 19:01:32.261995623 +0200
+++ R/linux-2.6.5/drivers/scsi/ibmvscsi/rpa_vscsi.c 2004-08-12 18:05:39.506800342 +0200
@@ -270,7 +270,7 @@ static struct vio_device_id rpa_device_t
{"scsi-3", "IBM,v-scsi"}, /* Note: This entry can go away when
all the firmware is up to date */
{"vscsi", "IBM,v-scsi"},
- {0,}
+ {"", ""}
};
/**
diff -purNX /suse/olh/kernel/kernel_exclude.txt x/linux-2.6.5/include/asm-ppc64/vio.h R/linux-2.6.5/include/asm-ppc64/vio.h
--- x/linux-2.6.5/include/asm-ppc64/vio.h 2004-08-12 19:01:24.135107346 +0200
+++ R/linux-2.6.5/include/asm-ppc64/vio.h 2004-08-12 18:07:40.535531015 +0200
@@ -85,9 +85,10 @@ static inline int vio_set_dma_mask(struc
extern struct bus_type vio_bus_type;
+#define VIO_DEVTABLE_PROPERTY_LENGTH 32
struct vio_device_id {
- char *type;
- char *compat;
+ char type[VIO_DEVTABLE_PROPERTY_LENGTH];
+ char compat[VIO_DEVTABLE_PROPERTY_LENGTH];
};
struct vio_driver {
diff -p -purN module-init-tools-3.0-pre10.orig/depmod.c module-init-tools-3.0-pre10/depmod.c
--- module-init-tools-3.0-pre10.orig/depmod.c 2004-01-23 02:28:17.000000000 +0100
+++ module-init-tools-3.0-pre10/depmod.c 2004-08-12 19:18:04.236399137 +0200
@@ -595,6 +595,7 @@ static struct depfile depfiles[] = {
{ "modules.usbmap", output_usb_table },
{ "modules.ccwmap", output_ccw_table },
{ "modules.ieee1394map", output_ieee1394_table },
+ { "modules.viomap", output_vio_table },
{ "modules.isapnpmap", output_isapnp_table },
{ "modules.inputmap", output_input_table },
{ "modules.alias", output_aliases },
diff -p -purN module-init-tools-3.0-pre10.orig/depmod.h module-init-tools-3.0-pre10/depmod.h
--- module-init-tools-3.0-pre10.orig/depmod.h 2003-12-24 03:10:57.000000000 +0100
+++ module-init-tools-3.0-pre10/depmod.h 2004-08-12 14:57:28.000000000 +0200
@@ -36,6 +36,8 @@ struct module
void *pci_table;
unsigned int usb_size;
void *usb_table;
+ unsigned int vio_size;
+ void *vio_table;
unsigned int ieee1394_size;
void *ieee1394_table;
unsigned int ccw_size;
diff -p -purN module-init-tools-3.0-pre10.orig/moduleops_core.c module-init-tools-3.0-pre10/moduleops_core.c
--- module-init-tools-3.0-pre10.orig/moduleops_core.c 2003-12-24 06:17:07.000000000 +0100
+++ module-init-tools-3.0-pre10/moduleops_core.c 2004-08-12 15:21:44.000000000 +0200
@@ -176,6 +176,10 @@ static void PERBIT(fetch_tables)(struct
module->ccw_table = PERBIT(deref_sym)(module->data,
"__mod_ccw_device_table");
+ module->vio_size = PERBIT(VIO_DEVICE_SIZE);
+ module->vio_table = PERBIT(deref_sym)(module->data,
+ "__mod_vio_device_table");
+
module->ieee1394_size = PERBIT(IEEE1394_DEVICE_SIZE);
module->ieee1394_table = PERBIT(deref_sym)(module->data,
"__mod_ieee1394_device_table");
diff -p -purN module-init-tools-3.0-pre10.orig/tables.c module-init-tools-3.0-pre10/tables.c
--- module-init-tools-3.0-pre10.orig/tables.c 2003-12-24 06:23:38.000000000 +0100
+++ module-init-tools-3.0-pre10/tables.c 2004-08-12 19:19:01.708780583 +0200
@@ -127,7 +127,31 @@ void output_ieee1394_table(struct module
output_ieee1394_entry(fw, shortname, out);
}
}
+static void output_vio_entry(struct vio_device_id *fw, char *name, FILE *out)
+{
+ fprintf(out, "%-20s %-32s %s\n",
+ name, fw->name, fw->compat);
+}
+void output_vio_table(struct module *modules, FILE *out)
+{
+ struct module *i;
+
+ fprintf(out, "%-20s %-32s compatible\n", "# vio module", "name");
+
+ for (i = modules; i; i = i->next) {
+ struct vio_device_id *fw;
+ char shortname[strlen(i->pathname) + 1];
+
+ if (!i->vio_table)
+ continue;
+
+ make_shortname(shortname, i->pathname);
+ for (fw = i->vio_table; *fw->name;
+ fw = (void *) fw + i->vio_size)
+ output_vio_entry(fw, shortname, out);
+ }
+}
/* We set driver_data to zero */
static void output_ccw_entry(struct ccw_device_id *ccw, char *name, FILE *out)
diff -p -purN module-init-tools-3.0-pre10.orig/tables.h module-init-tools-3.0-pre10/tables.h
--- module-init-tools-3.0-pre10.orig/tables.h 2003-12-24 06:18:54.000000000 +0100
+++ module-init-tools-3.0-pre10/tables.h 2004-08-12 18:09:54.000000000 +0200
@@ -35,6 +35,15 @@ struct usb_device_id {
#define USB_DEVICE_SIZE32 (5 * 2 + 6 * 1 + 4)
#define USB_DEVICE_SIZE64 (5 * 2 + 6 * 1 + 8)
+#define VIO_DEVTABLE_PROPERTY_LENGTH 32
+struct vio_device_id {
+ char name[VIO_DEVTABLE_PROPERTY_LENGTH];
+ char compat[VIO_DEVTABLE_PROPERTY_LENGTH];
+};
+
+#define VIO_DEVICE_SIZE32 (2 * VIO_DEVTABLE_PROPERTY_LENGTH + 4)
+#define VIO_DEVICE_SIZE64 (2 * VIO_DEVTABLE_PROPERTY_LENGTH + 8)
+
struct ieee1394_device_id {
unsigned int match_flags;
unsigned int vendor_id;
@@ -119,6 +128,7 @@ struct input_device_id_32 {
/* Functions provided by tables.c */
struct module;
void output_usb_table(struct module *modules, FILE *out);
+void output_vio_table(struct module *modules, FILE *out);
void output_ieee1394_table(struct module *modules, FILE *out);
void output_pci_table(struct module *modules, FILE *out);
void output_ccw_table(struct module *modules, FILE *out);
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-12 17:37 module.viomap support for ppc64 Olaf Hering
@ 2004-08-12 19:34 ` Hollis Blanchard
2004-08-12 23:43 ` Rusty Russell
0 siblings, 1 reply; 10+ messages in thread
From: Hollis Blanchard @ 2004-08-12 19:34 UTC (permalink / raw)
To: Olaf Hering; +Cc: Dave Boutcher, linuxppc64-dev, linux-kernel, Rusty Russell
On Thu, 2004-08-12 at 12:37, Olaf Hering wrote:
> Current MODULE_DEVICE_TABLE(vio, $table); defines 2 char pointers. I'm
> not sure if depmod can really handle it. Where do they point to in the
> module binary? I could find an answer, so far. I just declared an array.
Olaf explained on irc that output_vio_entry() below was finding NULL for
the name and compat pointers. Perhaps some additional relocation needs
to take place before those can be used?
> diff -p -purN module-init-tools-3.0-pre10.orig/moduleops_core.c module-init-tools-3.0-pre10/moduleops_core.c
> --- module-init-tools-3.0-pre10.orig/moduleops_core.c 2003-12-24 06:17:07.000000000 +0100
> +++ module-init-tools-3.0-pre10/moduleops_core.c 2004-08-12 15:21:44.000000000 +0200
> @@ -176,6 +176,10 @@ static void PERBIT(fetch_tables)(struct
> module->ccw_table = PERBIT(deref_sym)(module->data,
> "__mod_ccw_device_table");
>
> + module->vio_size = PERBIT(VIO_DEVICE_SIZE);
> + module->vio_table = PERBIT(deref_sym)(module->data,
> + "__mod_vio_device_table");
> +
> module->ieee1394_size = PERBIT(IEEE1394_DEVICE_SIZE);
> module->ieee1394_table = PERBIT(deref_sym)(module->data,
> "__mod_ieee1394_device_table");
> diff -p -purN module-init-tools-3.0-pre10.orig/tables.c module-init-tools-3.0-pre10/tables.c
> --- module-init-tools-3.0-pre10.orig/tables.c 2003-12-24 06:23:38.000000000 +0100
> +++ module-init-tools-3.0-pre10/tables.c 2004-08-12 19:19:01.708780583 +0200
> @@ -127,7 +127,31 @@ void output_ieee1394_table(struct module
> output_ieee1394_entry(fw, shortname, out);
> }
> }
> +static void output_vio_entry(struct vio_device_id *fw, char *name, FILE *out)
> +{
> + fprintf(out, "%-20s %-32s %s\n",
> + name, fw->name, fw->compat);
> +}
>
> +void output_vio_table(struct module *modules, FILE *out)
> +{
> + struct module *i;
> +
> + fprintf(out, "%-20s %-32s compatible\n", "# vio module", "name");
> +
> + for (i = modules; i; i = i->next) {
> + struct vio_device_id *fw;
> + char shortname[strlen(i->pathname) + 1];
> +
> + if (!i->vio_table)
> + continue;
> +
> + make_shortname(shortname, i->pathname);
> + for (fw = i->vio_table; *fw->name;
> + fw = (void *) fw + i->vio_size)
> + output_vio_entry(fw, shortname, out);
> + }
> +}
>
> /* We set driver_data to zero */
> static void output_ccw_entry(struct ccw_device_id *ccw, char *name, FILE *out)
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-12 19:34 ` Hollis Blanchard
@ 2004-08-12 23:43 ` Rusty Russell
2004-08-13 9:40 ` Olaf Hering
0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2004-08-12 23:43 UTC (permalink / raw)
To: Hollis Blanchard
Cc: Olaf Hering, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, 2004-08-13 at 05:34, Hollis Blanchard wrote:
> On Thu, 2004-08-12 at 12:37, Olaf Hering wrote:
> > Current MODULE_DEVICE_TABLE(vio, $table); defines 2 char pointers. I'm
> > not sure if depmod can really handle it. Where do they point to in the
> > module binary? I could find an answer, so far. I just declared an array.
>
> Olaf explained on irc that output_vio_entry() below was finding NULL for
> the name and compat pointers. Perhaps some additional relocation needs
> to take place before those can be used?
1) Please use char arrays of some fixed size.
2) Please modify scripts/mod/file2alias.c in the kernel source, not the
module tools. The modules.XXXmap files are deprecated: device tables
are supposed to be converted to aliases in the build process, and that
is how userspace tools like hotplug are to find them.
3) I will still accept patches to module-init-tools if required for 2.4
compatibility, but they will be going away at some point!
Hope that clarifies!
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-12 23:43 ` Rusty Russell
@ 2004-08-13 9:40 ` Olaf Hering
2004-08-13 13:42 ` Rusty Russell
0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2004-08-13 9:40 UTC (permalink / raw)
To: Rusty Russell
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, Aug 13, Rusty Russell wrote:
> 2) Please modify scripts/mod/file2alias.c in the kernel source, not the
> module tools. The modules.XXXmap files are deprecated: device tables
> are supposed to be converted to aliases in the build process, and that
> is how userspace tools like hotplug are to find them.
I found no user of the modules.alias file. Hotplug still uses the map
files. Parsing one big file will not improve performance, but thats a
different story.
A hack for 2.6.8-rc4 is below. Can I read the alias file via
while read a b c ; do : done < modules.alias ?
Is b supposed to contain not spaces? What special delimiter chars are
allowed? The 'name' and 'compat' property can contain almost any char.
I used '^' for the time being.
> 3) I will still accept patches to module-init-tools if required for 2.4
> compatibility, but they will be going away at some point!
Noone cares about that old junk.
diff -purNX /suse/olh/kernel/kernel_exclude.txt linux-2.6.7/drivers/char/hvcs.c linux-2.6.8-rc4/drivers/char/hvcs.c
--- linux-2.6.7/drivers/char/hvcs.c 2004-08-13 11:03:00.798522189 +0200
+++ linux-2.6.8-rc4/drivers/char/hvcs.c 2004-08-13 10:32:50.049696245 +0200
@@ -502,7 +502,7 @@ static int khvcsd(void *unused)
static struct vio_device_id hvcs_driver_table[] __devinitdata= {
{"serial-server", "hvterm2"},
- { 0, }
+ { "", ""}
};
MODULE_DEVICE_TABLE(vio, hvcs_driver_table);
diff -purNX /suse/olh/kernel/kernel_exclude.txt linux-2.6.7/drivers/net/ibmveth.c linux-2.6.8-rc4/drivers/net/ibmveth.c
--- linux-2.6.7/drivers/net/ibmveth.c 2004-06-16 07:18:37.000000000 +0200
+++ linux-2.6.8-rc4/drivers/net/ibmveth.c 2004-08-13 10:32:50.052695761 +0200
@@ -1119,7 +1119,7 @@ static void ibmveth_proc_unregister_driv
static struct vio_device_id ibmveth_device_table[] __devinitdata= {
{ "network", "IBM,l-lan"},
- { 0,}
+ { "",""}
};
MODULE_DEVICE_TABLE(vio, ibmveth_device_table);
diff -purNX /suse/olh/kernel/kernel_exclude.txt linux-2.6.7/include/asm-ppc64/vio.h linux-2.6.8-rc4/include/asm-ppc64/vio.h
--- linux-2.6.7/include/asm-ppc64/vio.h 2004-08-13 11:03:10.080494206 +0200
+++ linux-2.6.8-rc4/include/asm-ppc64/vio.h 2004-08-13 10:58:02.418290902 +0200
@@ -86,9 +86,10 @@ static inline int vio_set_dma_mask(struc
extern struct bus_type vio_bus_type;
+#define VIO_DEVTABLE_PROPERTY_LENGTH 32
struct vio_device_id {
- char *type;
- char *compat;
+ char type[VIO_DEVTABLE_PROPERTY_LENGTH];
+ char compat[VIO_DEVTABLE_PROPERTY_LENGTH];
};
struct vio_driver {
diff -purNX /suse/olh/kernel/kernel_exclude.txt linux-2.6.7/include/linux/mod_devicetable.h linux-2.6.8-rc4/include/linux/mod_devicetable.h
--- linux-2.6.7/include/linux/mod_devicetable.h 2004-06-16 07:20:19.000000000 +0200
+++ linux-2.6.8-rc4/include/linux/mod_devicetable.h 2004-08-13 10:58:38.577104617 +0200
@@ -164,5 +164,10 @@ struct pnp_card_device_id {
} devs[PNP_MAX_DEVICES];
};
+#define VIO_DEVTABLE_PROPERTY_LENGTH 32
+struct VIO_device_id {
+ char name[VIO_DEVTABLE_PROPERTY_LENGTH];
+ char compat[VIO_DEVTABLE_PROPERTY_LENGTH];
+};
#endif /* LINUX_MOD_DEVICETABLE_H */
diff -purNX /suse/olh/kernel/kernel_exclude.txt linux-2.6.7/scripts/mod/file2alias.c linux-2.6.8-rc4/scripts/mod/file2alias.c
--- linux-2.6.7/scripts/mod/file2alias.c 2004-08-13 11:03:12.329397812 +0200
+++ linux-2.6.8-rc4/scripts/mod/file2alias.c 2004-08-13 11:29:25.203744273 +0200
@@ -198,6 +198,13 @@ static int do_pnp_card_entry(const char
}
return 1;
}
+/* looks like: "vio:cCdD..." */
+static int do_vio_entry(const char *filename,
+ struct VIO_device_id *id, char *alias)
+{
+ sprintf(alias, "vio:%s^%s", id->name, id->compat);
+ return 1;
+}
/* Ignore any prefix, eg. v850 prepends _ */
static inline int sym_is(const char *symbol, const char *name)
@@ -271,6 +278,9 @@ void handle_moddevtable(struct module *m
else if (sym_is(symname, "__mod_pnp_card_device_table"))
do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id),
do_pnp_card_entry, mod);
+ else if (sym_is(symname, "__mod_vio_device_table"))
+ do_table(symval, sym->st_size, sizeof(struct VIO_device_id),
+ do_vio_entry, mod);
}
/* Now add out buffered information to the generated C source */
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-13 9:40 ` Olaf Hering
@ 2004-08-13 13:42 ` Rusty Russell
2004-08-13 20:22 ` Marcelo Tosatti
2004-08-19 21:28 ` Olaf Hering
0 siblings, 2 replies; 10+ messages in thread
From: Rusty Russell @ 2004-08-13 13:42 UTC (permalink / raw)
To: Olaf Hering
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, 2004-08-13 at 19:40, Olaf Hering wrote:
> On Fri, Aug 13, Rusty Russell wrote:
>
> > 2) Please modify scripts/mod/file2alias.c in the kernel source, not the
> > module tools. The modules.XXXmap files are deprecated: device tables
> > are supposed to be converted to aliases in the build process, and that
> > is how userspace tools like hotplug are to find them.
>
> I found no user of the modules.alias file. Hotplug still uses the map
> files. Parsing one big file will not improve performance, but thats a
> different story.
You don't use the modules.alias file. You simply "modprobe vio:xyz^abc"
and modprobe reads modules.alias if necessary (the user can also insert
aliases in the modprobe.conf file, for example). Note that fnmatch is
used, so you can actually use ? and * in your generated aliases.
> A hack for 2.6.8-rc4 is below. Can I read the alias file via
> while read a b c ; do : done < modules.alias ?
> Is b supposed to contain not spaces? What special delimiter chars are
> allowed? The 'name' and 'compat' property can contain almost any char.
> I used '^' for the time being.
Spaces are probably a bad idea, yes. ^ is a little odd, but probably
not a bad choice. You could even use a full: "vio:name:%s:compat:%s" if
you wanted to.
> > 3) I will still accept patches to module-init-tools if required for 2.4
> > compatibility, but they will be going away at some point!
>
> Noone cares about that old junk.
Shh... Marcelo might get offended 8)
Patch looks fine...
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-13 13:42 ` Rusty Russell
@ 2004-08-13 20:22 ` Marcelo Tosatti
2004-08-19 21:28 ` Olaf Hering
1 sibling, 0 replies; 10+ messages in thread
From: Marcelo Tosatti @ 2004-08-13 20:22 UTC (permalink / raw)
To: Rusty Russell; +Cc: Olaf Hering, lkml - Kernel Mailing List
On Fri, Aug 13, 2004 at 11:42:50PM +1000, Rusty Russell wrote:
> On Fri, 2004-08-13 at 19:40, Olaf Hering wrote:
> > On Fri, Aug 13, Rusty Russell wrote:
> >
> > > 2) Please modify scripts/mod/file2alias.c in the kernel source, not the
> > > module tools. The modules.XXXmap files are deprecated: device tables
> > > are supposed to be converted to aliases in the build process, and that
> > > is how userspace tools like hotplug are to find them.
> >
> > I found no user of the modules.alias file. Hotplug still uses the map
> > files. Parsing one big file will not improve performance, but thats a
> > different story.
>
> You don't use the modules.alias file. You simply "modprobe vio:xyz^abc"
> and modprobe reads modules.alias if necessary (the user can also insert
> aliases in the modprobe.conf file, for example). Note that fnmatch is
> used, so you can actually use ? and * in your generated aliases.
>
> > A hack for 2.6.8-rc4 is below. Can I read the alias file via
> > while read a b c ; do : done < modules.alias ?
> > Is b supposed to contain not spaces? What special delimiter chars are
> > allowed? The 'name' and 'compat' property can contain almost any char.
> > I used '^' for the time being.
>
> Spaces are probably a bad idea, yes. ^ is a little odd, but probably
> not a bad choice. You could even use a full: "vio:name:%s:compat:%s" if
> you wanted to.
>
> > > 3) I will still accept patches to module-init-tools if required for 2.4
> > > compatibility, but they will be going away at some point!
> >
> > Noone cares about that old junk.
I do care!
> Shh... Marcelo might get offended 8)
Yes, I, I, rrrr :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-13 13:42 ` Rusty Russell
2004-08-13 20:22 ` Marcelo Tosatti
@ 2004-08-19 21:28 ` Olaf Hering
2004-08-20 3:47 ` Rusty Russell
1 sibling, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2004-08-19 21:28 UTC (permalink / raw)
To: Rusty Russell
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, Aug 13, Rusty Russell wrote:
> On Fri, 2004-08-13 at 19:40, Olaf Hering wrote:
> > On Fri, Aug 13, Rusty Russell wrote:
> >
> > > 2) Please modify scripts/mod/file2alias.c in the kernel source, not the
> > > module tools. The modules.XXXmap files are deprecated: device tables
> > > are supposed to be converted to aliases in the build process, and that
> > > is how userspace tools like hotplug are to find them.
> >
> > I found no user of the modules.alias file. Hotplug still uses the map
> > files. Parsing one big file will not improve performance, but thats a
> > different story.
>
> You don't use the modules.alias file. You simply "modprobe vio:xyz^abc"
> and modprobe reads modules.alias if necessary (the user can also insert
> aliases in the modprobe.conf file, for example). Note that fnmatch is
> used, so you can actually use ? and * in your generated aliases.
But that complicates the parser. Current the hotplug agent script reads
the simple modules.foomap and generates a list of possible drivers. Then
it looks into the blacklist file to see if one of the possible modules
should not be loaded, and skips this module.
Is there such functionality for the modules.alias file in
module-init-tools? I played around with modprobe -n, but could not
figure it out. Unfortunately, some hardware has more than one driver.
bcm5700/tg3, eepro100/e100 and maybe more.
#!/bin/bash
cd /sys/bus/pci/devices || exit 1
for i in *
do
test -d $i || continue
read pci_class < $i/class
read pci_vendor < $i/vendor
read pci_device < $i/device
read pci_subsystem_vendor < $i/subsystem_vendor
read pci_subsystem_device < $i/subsystem_device
pci_baseclass=$((($pci_class >> 16) & 0xff))
pci_subclass=$((($pci_class >> 8) & 0xff))
pci_interface=$(($pci_class & 0xff))
pci_alias=`printf 'pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X' ${pci_vendor} ${pci_device} ${pci_subsystem_vendor} ${pci_subsystem_device} ${pci_baseclass} ${pci_subclass} ${pci_interface}`
echo $i # $pci_alias
/sbin/modprobe -nvva $pci_alias
done
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-19 21:28 ` Olaf Hering
@ 2004-08-20 3:47 ` Rusty Russell
2004-08-20 5:57 ` Olaf Hering
0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2004-08-20 3:47 UTC (permalink / raw)
To: Olaf Hering
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, 2004-08-20 at 07:28, Olaf Hering wrote:
> On Fri, Aug 13, Rusty Russell wrote:
>
> > On Fri, 2004-08-13 at 19:40, Olaf Hering wrote:
> > > On Fri, Aug 13, Rusty Russell wrote:
> > >
> > > > 2) Please modify scripts/mod/file2alias.c in the kernel source, not the
> > > > module tools. The modules.XXXmap files are deprecated: device tables
> > > > are supposed to be converted to aliases in the build process, and that
> > > > is how userspace tools like hotplug are to find them.
> > >
> > > I found no user of the modules.alias file. Hotplug still uses the map
> > > files. Parsing one big file will not improve performance, but thats a
> > > different story.
> >
> > You don't use the modules.alias file. You simply "modprobe vio:xyz^abc"
> > and modprobe reads modules.alias if necessary (the user can also insert
> > aliases in the modprobe.conf file, for example). Note that fnmatch is
> > used, so you can actually use ? and * in your generated aliases.
>
> But that complicates the parser. Current the hotplug agent script reads
> the simple modules.foomap and generates a list of possible drivers. Then
> it looks into the blacklist file to see if one of the possible modules
> should not be loaded, and skips this module.
Complicates? Leave it to modprobe. Don't read any files. Really.
Current implementation of aliases is to load one at random: multiple
alias resolution is undefined because noone knew what we should do (load
them all? Load until one succeeds?). But note that that the base
config file overrides anything extracted from the modules themselves, so
users/distributions can always specify an exact match.
> Is there such functionality for the modules.alias file in
> module-init-tools? I played around with modprobe -n, but could not
> figure it out. Unfortunately, some hardware has more than one driver.
> bcm5700/tg3, eepro100/e100 and maybe more.
OK, I think the difference here is that I feel modprobe should resolve
it. What's the right answer? Do we need a new "unalias" config cmd
which does the blacklist, or is the current positive method better? How
do you currently decide?
Thanks!
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-20 3:47 ` Rusty Russell
@ 2004-08-20 5:57 ` Olaf Hering
2004-08-20 7:25 ` Rusty Russell
0 siblings, 1 reply; 10+ messages in thread
From: Olaf Hering @ 2004-08-20 5:57 UTC (permalink / raw)
To: Rusty Russell
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List
On Fri, Aug 20, Rusty Russell wrote:
> Current implementation of aliases is to load one at random: multiple
> alias resolution is undefined because noone knew what we should do (load
> them all? Load until one succeeds?). But note that that the base
> config file overrides anything extracted from the modules themselves, so
> users/distributions can always specify an exact match.
How is the blacklist stuff supposed to work then? It must be possible
to map an alias entry to a list of modules, and check if any of them is
blacklisted. Then just 'for i in $DRIVERS ; do modprobe $i ; done'.
> > Is there such functionality for the modules.alias file in
> > module-init-tools? I played around with modprobe -n, but could not
> > figure it out. Unfortunately, some hardware has more than one driver.
> > bcm5700/tg3, eepro100/e100 and maybe more.
>
> OK, I think the difference here is that I feel modprobe should resolve
> it. What's the right answer? Do we need a new "unalias" config cmd
> which does the blacklist, or is the current positive method better? How
> do you currently decide?
modprobe or some other tool can certainly resolve it, but something has
to make a decision based on a blacklist if a certain module can be
loaded.
Look at /etc/hotplug/pci.agent how it currently done, it parses the
modules.pcimap, fills $DRIVERS and passes that variable to the generic
modprobe function from hotplug.functions. It reads
/etc/hotplug/blacklist to decide if any of the modules listed in DRIVERS
must be skipped.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: module.viomap support for ppc64
2004-08-20 5:57 ` Olaf Hering
@ 2004-08-20 7:25 ` Rusty Russell
0 siblings, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2004-08-20 7:25 UTC (permalink / raw)
To: Olaf Hering
Cc: Hollis Blanchard, Dave Boutcher, linuxppc64-dev,
lkml - Kernel Mailing List, Greg KH
On Fri, 2004-08-20 at 15:57, Olaf Hering wrote:
> On Fri, Aug 20, Rusty Russell wrote:
>
> > Current implementation of aliases is to load one at random: multiple
> > alias resolution is undefined because noone knew what we should do (load
> > them all? Load until one succeeds?). But note that that the base
> > config file overrides anything extracted from the modules themselves, so
> > users/distributions can always specify an exact match.
>
> How is the blacklist stuff supposed to work then? It must be possible
> to map an alias entry to a list of modules, and check if any of them is
> blacklisted. Then just 'for i in $DRIVERS ; do modprobe $i ; done'.
Olaf, I'm trying to understand the problem. We currently have a system
where modprobe resolves aliases, and that's good because it allows users
to override those aliases. We could have a "modprobe --resolve-aliases"
function, but that breaks down if the user puts in an install command,
which they should be able to do.
Looking through SLES and my Debian system, I see:
1) Modules which never want autoloading (eg. evbug)
2) Modules which defer to other modules (eg. de4x5)
3) Modules for which you want to suppress autoloading altogether because
they cause problems, or are handled by other subsystems.
For (1), the information should be contained in the module itself. This
will involve a kernel patch.
For (2), the information should be placed in /etc/modprobe.d/ overriding
those aliases the preferred way.
For (3), modprobe cannot have this in a config file, because what needs
to be blacklisted depends on who is invoking modprobe. For example,
there's a comment that ISDN modules on SuSE are not handled by hotplug,
but /etc/init.d/isdn.
So, a solution would be:
a) A "MODULE_NO_TABLES" macro which suppresses ID table alias
generation,
b) A -X argument to modprobe which says "don't load these modules", and
c) Change modprobe to load all the aliases which match, not just one? I
hadn't done this because I wasn't aware of anything which needed it: is
there something?
I think we're getting there: sorry if I seem a bit obtuse...
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-08-20 7:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-12 17:37 module.viomap support for ppc64 Olaf Hering
2004-08-12 19:34 ` Hollis Blanchard
2004-08-12 23:43 ` Rusty Russell
2004-08-13 9:40 ` Olaf Hering
2004-08-13 13:42 ` Rusty Russell
2004-08-13 20:22 ` Marcelo Tosatti
2004-08-19 21:28 ` Olaf Hering
2004-08-20 3:47 ` Rusty Russell
2004-08-20 5:57 ` Olaf Hering
2004-08-20 7:25 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox