linux-mips
[Top] [All Lists]

Re: IP32 prom crashes due to __pa() funkiness

To: Linux MIPS List <linux-mips@linux-mips.org>
Subject: Re: IP32 prom crashes due to __pa() funkiness
From: Kumba <kumba@gentoo.org>
Date: Wed, 28 Feb 2007 23:33:19 -0500
In-reply-to: <45D8B070.7070405@gentoo.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <45D8B070.7070405@gentoo.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0b2 (Windows/20070116)
Kumba wrote:

Initially, booting a straight git checkout on an IP32 will cause it to prom crash, usually somewhere in between init_bootmem() and init_bootmem_core(). I bisected git to trace this back to one of the inital __pa() introduction patches from commit d4df6d4 (get ride of CPHYSADDR()). It actually appears that the actual commit that broke things was 620a480 (Make __pa() aware of XKPHYS/CKSEG0 address mix for 64 bit kernels).

The [short-term] fix highlighted by Ilya is to make __pa() unconditionally be defined to "((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)"; Discovered by building IP32 with CONFIG_BUILD_ELF64=n.

Normally, this shouldn't be possible, as CONFIG_BUILD_ELF64=n was originally only allowed by using the old o64 hack, which has subsequently died and been replaced with the newer -msym32 form. As far as I know, CONFIG_BUILD_ELF64 is apparently supposed to be removed at some point in the future, since I believe it existed only for quirky 64bit-in-32bit kernels for IP22 and more commonly, IP32. From 2.6.17 onwards, I've been building IP32 kernels with CONFIG_BUILD_ELF64=y and using gcc-4, and haven't had problems up until now.

Anyways, I'm not sure if this is an IP32-specific oddity or not (probably is), but it needs the define highlighted above to work properly. Plain PAGE_OFFSET won't work for these machines. Given the same trick os -msym32 is used for the rare IP22 64bit kernel, I would not be surprised if the same problem and fix both occur and work for those machines as well. Something to maybe test later, I suppose.

But for now, anyone got thoughts as to a sane workaround for this? Perhaps some conditional tweaks in mach-ip32/*.h files somewheres, would it be simpler to just switch to:

#if defined(CONFIG_64BIT) && (!defined(CONFIG_BUILD_ELF64) || defined(CONFIG_SGI_IP32))

(assuming that IP22 doesn't need it; I'll find out later)

"Re-verify range to target, One ping only."


So, anyone got thoughts on this?

I've actually built and booted an SGI IP32 kernel using this logic in include/asm-mips/page.h, Line 135:

#if defined(CONFIG_64BIT) && (!defined(CONFIG_BUILD_ELF64) || (defined(CONFIG_SGI_IP32) || defined(CONFIG_SGI_IP22)))



--Kumba

--
Gentoo/MIPS Team Lead

"Such is oft the course of deeds that move the wheels of the world: small hands do them because they must, while the eyes of the great are elsewhere." --Elrond

<Prev in Thread] Current Thread [Next in Thread>