Re: IP32 prom crashes due to __pa() funkiness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux