Re: [PATCH]: Prevent sn2 ptc code from executing on all ia64 subarches

From: Prarit Bhargava <prarit_at_sgi.com>
Date: 2005-12-14 02:42:28
This is sort of a mini-RFC for linux-ia64 -- just to see if anyone objects to 
the solution before I implement it.  I'll throw this out onto lkml after I get 
some input here.

I spent the past day or so looking at a couple of solutions to this problem and 
the only solution that appears viable is to (as stated previously) create new 
initcalls of the form

platform_calltype_initcall(fn,platform)

ex)
	platform_device_initcall(sn_prarit_driver, "sn2");

which would check the platform type prior to loading a kernel.

As it turns out this is a little bit more tricky than I thought as the initcalls 
are placed in a list of initcalls in the .initcall section.

do_initcalls then goes through this list in order to run the various initcalls 
on the list.

Since the macro calltype_initcall is placing the specified function in the 
.initcall list we cannot do

if (ia64_platform_is(foo))
	platform_calltype_initcall(fn,platform)

So I'm modifying my original suggestion.  We will still have

platform_calltype_initcall(fn,platform)

ex)

platform_device_initcall(sn_prarit_driver, IA64_PLATFORM_SN2);

but instead of doing the above wrapper, we would create a new section called 
.platform (name of the section is open to debate) and would traverse both the 
.initcall and the .platform sections at the sametime.

Therefore the could would be something like (this is based off the existing 
do_initcalls)

for (call = __initcall_start, platform = __platform_start;
      call < __initcall_end; call++, platform++) {


	if (platform == __platform_end)
		panic(); /* BUG? size(.platform) != size(!initcall) */

	if (platform && IA64_PLATFORM)
		(*call)();

where platform would be some bitmask that represents the various flavours of 
ia64 that the initcall can run on, and IA64_PLATFORM is set very early in the init.

A few other things:

- by default the value of platform would default to all platforms.

ie)
	device_initcall(sn_prarit_driver)

resolves to

	platform_device_initcall(sn_prarit_driver, IA64_PLATFORM_ALL);

- maybe there should be a runtime warning noting that you are using initcall or 
calltype_initcall on ia64?  (Someone convince me that this is really needed)

- I passed this by an ia64 engineer from HP and he made the comment that the 
nice thing about Linux is that the initcalls on all platforms are handled in 
EXACTLY the same manner.  I sort of agree with his assessment, however, no other 
  arch in Linux can compile a generic kernel and run on all of it's subarches...

Suggestions/comments?  Anyone think this is too much bother for the original 
issue of avoiding

	if (!ia64_platform_is("sn2"))
		return -ENOSYS;

?

P.
-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Dec 14 02:44:24 2005

This archive was generated by hypermail 2.1.8 : 2005-12-14 02:44:33 EST