All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kumba <kumba@gentoo.org>
To: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Linux MIPS List <linux-mips@linux-mips.org>,
	Arnaud Giersch <arnaud.giersch@free.fr>
Subject: Re: IP32 prom crashes due to __pa() funkiness
Date: Tue, 20 Mar 2007 10:10:34 -0400	[thread overview]
Message-ID: <45FFEB5A.707@gentoo.org> (raw)
In-Reply-To: <cda58cb80703191435u37ba4ed2se4cc150fcdb734a2@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2288 bytes --]

Franck Bui-Huu wrote:
> 
> I'm really not confident with all your tricks you described. Maybe a
> config that I believed to be uninsteresting and useless should be
> supported still.
> 
> Can you try the attached patch with a plain linux-mips kernel ? This
> patch restore CPHYSADDR() for 64 bits kernels _only_. I guess it's ok
> because we won't need to support mapped kernels on 64 bits machines...
> 
> Could others give their opinions ?

After going through all the fun to get rid of CPHYSADDR, I see no point really 
to bring it back.  Plus that patch unnecessarily complicates those defines.  As 
I highlighted in my original mail, O2 doesn't need CPHYSADDR added to __pa(), it 
just needs the conditional define for __pa_page_offset to be a little bit more 
flexible.

Since only three machines, O2 R5xx, Indy/Indigo2 R4xx, and Cobalt will exhibit 
similar issues (the latter two when booting 64bit kernels), a saner method in my 
opinion is to introduce a flag of sorts into the conditional for 
__pa_page_offset to determine whether to define it strictly to PAGE_OFFSET or to 
the other value listed in the code.  The only thing is, I'm not sure which 
method of the two I've thought up is cleaner.

The first introduces a hidden Kconfig value, CONFIG_SYS_LOADS_IN_CKSEG0, that 
only turns on when BUILD_ELF64 && (SGI_IP22 || (SGI_IP32 && (CPU_R5000 || 
CPU_NEVADA || CPU_RM7000)) || MIPS_COBALT), and then we test for this flag in 
include/asm-mips/page.h when setting the value of __pa_page_offset.

The other way is to define a similar flag in a new header file, memmap.h, in 
include/asm-mips/mach-{ip22,ip32,cobalt}/* called MIPS_USES_CKSEG0, and 
similarly, test for that flag in the same spot as above.  With this method, 
though, I'm not sure where exactly to pull in the memmap.h header, so the patch 
for it is incomplete (but included for reference).

I've tested the first patch (kconfig one), and it works fine.  The second one 
will also work, provided I find a nice spot to pull in memmap.h, but from a 
semantics perspective, which one do you guys like better?



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

[-- Attachment #2: mips-kconfig-ckseg0-idea.patch --]
[-- Type: text/plain, Size: 1353 bytes --]

diff -Naurp mipslinux/arch/mips/Kconfig mipslinux.ckseg0-a/arch/mips/Kconfig
--- mipslinux/arch/mips/Kconfig	2007-03-17 21:12:06.000000000 -0400
+++ mipslinux.ckseg0-a/arch/mips/Kconfig	2007-03-20 01:38:42.000000000 -0400
@@ -1659,6 +1659,11 @@ config SB1_PASS_2_1_WORKAROUNDS
 	depends on CPU_SB1 && CPU_SB1_PASS_2
 	default y
 
+config SYS_LOADS_IN_CKSEG0
+	bool
+	depends on BUILD_ELF64 && (SGI_IP22 || (SGI_IP32 && (CPU_R5000 || CPU_NEVADA || CPU_RM7000)) || MIPS_COBALT)
+	default y
+
 config 64BIT_PHYS_ADDR
 	bool "Support for 64-bit physical address space"
 	depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32 || CPU_MIPS64) && 32BIT
diff -Naurp mipslinux/include/asm-mips/page.h mipslinux.ckseg0-a/include/asm-mips/page.h
--- mipslinux/include/asm-mips/page.h	2007-03-17 21:12:31.000000000 -0400
+++ mipslinux.ckseg0-a/include/asm-mips/page.h	2007-03-20 01:37:31.000000000 -0400
@@ -149,7 +149,7 @@ typedef struct { unsigned long pgprot; }
 /*
  * __pa()/__va() should be used only during mem init.
  */
-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+#if defined(CONFIG_64BIT) && (!defined(CONFIG_BUILD_ELF64) || defined(CONFIG_SYS_LOADS_IN_CKSEG0))
 #define __pa_page_offset(x)	((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
 #else
 #define __pa_page_offset(x)	PAGE_OFFSET

[-- Attachment #3: mips-asm-mach-ckseg0-idea.patch --]
[-- Type: text/plain, Size: 2169 bytes --]

diff -Naurp mipslinux/include/asm-mips/mach-cobalt/memmap.h mipslinux.ckseg0-b/include/asm-mips/mach-cobalt/memmap.h
--- mipslinux/include/asm-mips/mach-cobalt/memmap.h	1969-12-31 19:00:00.000000000 -0500
+++ mipslinux.ckseg0-b/include/asm-mips/mach-cobalt/memmap.h	2007-03-20 01:19:59.000000000 -0400
@@ -0,0 +1,9 @@
+#ifndef __ASM_MACH_IP32_MEMMAP_H
+#define __ASM_MACH_IP32_MEMMAP_H
+
+
+#ifdef CONFIG_64BIT
+#define MIPS_USES_CKSEG0	1
+#endif
+
+#endif /* __ASM_MACH_IP32_MEMMAP_H */
diff -Naurp mipslinux/include/asm-mips/mach-ip22/memmap.h mipslinux.ckseg0-b/include/asm-mips/mach-ip22/memmap.h
--- mipslinux/include/asm-mips/mach-ip22/memmap.h	1969-12-31 19:00:00.000000000 -0500
+++ mipslinux.ckseg0-b/include/asm-mips/mach-ip22/memmap.h	2007-03-20 01:20:14.000000000 -0400
@@ -0,0 +1,9 @@
+#ifndef __ASM_MACH_IP32_MEMMAP_H
+#define __ASM_MACH_IP32_MEMMAP_H
+
+
+#ifdef CONFIG_64BIT
+#define MIPS_USES_CKSEG0	1
+#endif
+
+#endif /* __ASM_MACH_IP32_MEMMAP_H */
diff -Naurp mipslinux/include/asm-mips/mach-ip32/memmap.h mipslinux.ckseg0-b/include/asm-mips/mach-ip32/memmap.h
--- mipslinux/include/asm-mips/mach-ip32/memmap.h	1969-12-31 19:00:00.000000000 -0500
+++ mipslinux.ckseg0-b/include/asm-mips/mach-ip32/memmap.h	2007-03-20 01:12:24.000000000 -0400
@@ -0,0 +1,9 @@
+#ifndef __ASM_MACH_IP32_MEMMAP_H
+#define __ASM_MACH_IP32_MEMMAP_H
+
+
+#if defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_NEVADA) || defined (CONFIG_CPU_RM7000)
+#define MIPS_USES_CKSEG0	1
+#endif
+
+#endif /* __ASM_MACH_IP32_MEMMAP_H */
diff -Naurp mipslinux/include/asm-mips/page.h mipslinux.ckseg0-b/include/asm-mips/page.h
--- mipslinux/include/asm-mips/page.h	2007-03-17 21:12:31.000000000 -0400
+++ mipslinux.ckseg0-b/include/asm-mips/page.h	2007-03-20 01:15:35.000000000 -0400
@@ -149,7 +149,7 @@ typedef struct { unsigned long pgprot; }
 /*
  * __pa()/__va() should be used only during mem init.
  */
-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+#if defined(CONFIG_64BIT) && (!defined(CONFIG_BUILD_ELF64) || defined(MIPS_USES_CKSEG0))
 #define __pa_page_offset(x)	((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
 #else
 #define __pa_page_offset(x)	PAGE_OFFSET

  reply	other threads:[~2007-03-20 14:11 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04 23:18 Building 64 bit kernel on Cobalt Jim Gifford
2007-03-04 23:27 ` Ralf Baechle
2007-03-08  6:11   ` Jim Gifford
2007-03-08  8:46     ` Jim Gifford
2007-03-08 12:48     ` Franck Bui-Huu
2007-03-08 16:11       ` Jim Gifford
2007-03-13  0:57         ` Jim Gifford
2007-03-13 10:38           ` Franck Bui-Huu
2007-03-13 11:53             ` Ralf Baechle
2007-03-18 21:52             ` Jim Gifford
2007-03-19  1:12               ` Atsushi Nemoto
2007-03-19  5:20                 ` Jim Gifford
2007-03-19  6:07                   ` Atsushi Nemoto
2007-03-19 10:08                     ` Franck Bui-Huu
2007-03-19 10:17                       ` Franck Bui-Huu
2007-03-21 17:07                         ` Atsushi Nemoto
2007-03-21 19:31                           ` Franck Bui-Huu
2007-03-23 13:47                             ` Kumba
2007-03-23 15:24                               ` Atsushi Nemoto
2007-03-24  3:31                                 ` Kumba
2007-03-24 14:47                                   ` Atsushi Nemoto
2007-03-24 23:16                                     ` Thiemo Seufer
2007-03-25  7:25                                       ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Kumba
2007-03-25 14:45                                         ` Thiemo Seufer
2007-03-26 11:35                                           ` Maciej W. Rozycki
2007-03-26 11:56                                             ` Ralf Baechle
2007-03-26 12:09                                               ` Maciej W. Rozycki
2007-03-26 12:34                                                 ` Ralf Baechle
2007-03-25 16:10                                         ` Atsushi Nemoto
2007-03-25 16:40                                           ` Ralf Baechle
2007-03-26  9:14                                             ` Franck Bui-Huu
2007-03-26  9:42                                               ` Thiemo Seufer
2007-03-25 16:59                                           ` Kumba
2007-03-25 17:07                                             ` Atsushi Nemoto
2007-03-25 18:33                                               ` Kumba
2007-03-26 10:36                                                 ` Atsushi Nemoto
2007-03-26 13:48                                                   ` Kumba
2007-03-26 14:43                                                     ` Atsushi Nemoto
2007-03-27  0:51                                                       ` Kumba
2007-03-27 14:53                                                         ` Atsushi Nemoto
2007-03-27 17:54                                                           ` Ilya A. Volynets-Evenbakh
2007-03-28 15:14                                                             ` Atsushi Nemoto
2007-03-27 19:01                                                           ` Thiemo Seufer
2007-03-28 13:26                                                           ` Kumba
2007-03-28 15:24                                                             ` Atsushi Nemoto
2007-03-29  1:50                                                               ` Kumba
2007-03-29 14:53                                                                 ` Atsushi Nemoto
2007-03-30  6:18                                                                   ` Kumba
2007-03-30  2:20                                                               ` Kumba
2007-02-18 20:00                                                                 ` IP32 prom crashes due to __pa() funkiness Kumba
2007-03-01  4:33                                                                   ` Kumba
2007-03-01  9:39                                                                   ` Franck Bui-Huu
2007-03-10  9:41                                                                     ` [PATCH], " peter fuerst
2007-03-17 19:52                                                                     ` Kumba
2007-03-17 21:48                                                                       ` Arnaud Giersch
2007-03-18  2:04                                                                         ` Kumba
2007-03-19 13:53                                                                           ` Franck Bui-Huu
2007-03-19 14:07                                                                             ` Thiemo Seufer
2007-03-19 14:19                                                                               ` Franck Bui-Huu
2007-03-19 14:17                                                                             ` Franck Bui-Huu
2007-03-19 14:24                                                                             ` Kumba
2007-03-19 14:45                                                                               ` Thiemo Seufer
2007-03-19 14:46                                                                               ` Atsushi Nemoto
2007-03-19 21:35                                                                               ` Franck Bui-Huu
2007-03-20 14:10                                                                                 ` Kumba [this message]
2007-03-23 15:12                                                                                   ` Franck Bui-Huu
     [not found]                                                                     ` <45FC3923.2080207@gentoo.org>
2007-03-18  9:42                                                                       ` peter fuerst
2007-03-18 21:26                                                                         ` Kumba
2007-03-18 21:37                                                                           ` Kumba
2007-03-18 22:44                                                                         ` Kumba
2007-03-19 13:57                                                                           ` Franck Bui-Huu
2007-03-30  3:01                                                                   ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Atsushi Nemoto
2007-03-30  5:35                                                                     ` Kumba
2007-03-30  6:09                                                                       ` Atsushi Nemoto
2007-09-26  2:08                                                                         ` CONFIG_BUILD_ELF64 broken on IP32 since 2.6.20 Atsushi Nemoto
2007-09-26  5:59                                                                           ` Martin Michlmayr
2007-09-26  6:19                                                                             ` Giuseppe Sacco
2007-09-27  0:24                                                                             ` Thiemo Seufer
2007-09-26  9:14                                                                           ` Franck Bui-Huu
2007-09-26 14:42                                                                             ` Atsushi Nemoto
2007-03-25 22:19                                             ` [PATCH]: Remove CONFIG_BUILD_ELF64 entirely Ralf Baechle
2007-03-26 13:25                                               ` Atsushi Nemoto
2007-03-26 13:54                                               ` Franck Bui-Huu
2007-03-26 14:48                                                 ` Atsushi Nemoto
2007-03-26 15:31                                                   ` Franck Bui-Huu
2007-03-26 15:45                                                     ` Atsushi Nemoto
2007-03-26 16:07                                                       ` Franck Bui-Huu
2007-03-27  3:12                                                         ` Atsushi Nemoto
2007-03-27  8:01                                                           ` Franck Bui-Huu
2007-03-26 15:56                                                     ` Thiemo Seufer
2007-03-26  9:02                                             ` Franck Bui-Huu
2007-03-25 15:40                                       ` Building 64 bit kernel on Cobalt Atsushi Nemoto
  -- strict thread matches above, loose matches on Subject: below --
2007-09-25 18:13 CONFIG_BUILD_ELF64 broken on IP32 since 2.6.20 Martin Michlmayr
2007-09-25 18:32 ` sknauert
2007-09-25 18:43   ` Martin Michlmayr
2007-09-25 18:56     ` sknauert
2007-09-26  8:03 ` Franck Bui-Huu
2007-09-26  9:14   ` Martin Michlmayr
2007-09-26  9:54     ` Franck Bui-Huu
2007-09-26 10:24       ` Martin Michlmayr
2007-09-26 11:32         ` Maciej W. Rozycki
2007-09-26 13:34           ` Franck Bui-Huu
2007-09-26 13:46             ` Martin Michlmayr
2007-09-26 14:49             ` Maciej W. Rozycki
2007-09-26 15:34               ` Atsushi Nemoto
2007-09-26 15:47                 ` Maciej W. Rozycki
2007-09-27  8:11                   ` Franck Bui-Huu
2007-09-27 11:10                     ` Maciej W. Rozycki
2007-09-27 13:36                     ` Ralf Baechle
2007-09-27 13:47                       ` Franck Bui-Huu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45FFEB5A.707@gentoo.org \
    --to=kumba@gentoo.org \
    --cc=arnaud.giersch@free.fr \
    --cc=linux-mips@linux-mips.org \
    --cc=vagabon.xyz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.