]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
powerpc: Rename mapping based RELOCATABLE to DYNAMIC_MEMSTART for BookE
authorSuzuki Poulose <suzuki@in.ibm.com>
Wed, 14 Dec 2011 22:57:15 +0000 (22:57 +0000)
committerJosh Boyer <jwboyer@gmail.com>
Tue, 20 Dec 2011 15:20:19 +0000 (10:20 -0500)
The current implementation of CONFIG_RELOCATABLE in BookE is based
on mapping the page aligned kernel load address to KERNELBASE. This
approach however is not enough for platforms, where the TLB page size
is large (e.g, 256M on 44x). So we are renaming the RELOCATABLE used
currently in BookE to DYNAMIC_MEMSTART to reflect the actual method.

The CONFIG_RELOCATABLE for PPC32(BookE) based on processing of the
dynamic relocations will be introduced in the later in the patch series.

This change would allow the use of the old method of RELOCATABLE for
platforms which can afford to enforce the page alignment (platforms with
smaller TLB size).

Changes since v3:

* Introduced a new config, NONSTATIC_KERNEL, to denote a kernel which is
  either a RELOCATABLE or DYNAMIC_MEMSTART(Suggested by: Josh Boyer)

Suggested-by: Scott Wood <scottwood@freescale.com>
Tested-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Josh Boyer <jwboyer@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux ppc dev <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
arch/powerpc/Kconfig
arch/powerpc/configs/44x/iss476-smp_defconfig
arch/powerpc/include/asm/kdump.h
arch/powerpc/include/asm/page.h
arch/powerpc/kernel/crash_dump.c
arch/powerpc/kernel/head_44x.S
arch/powerpc/kernel/head_fsl_booke.S
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/mm/44x_mmu.c

index d66a47fde80c7e5b3e81add388c5e4bf1958d35b..6c84756923220558db1bb3ed265c7b2b6a8dd182 100644 (file)
@@ -368,7 +368,8 @@ config KEXEC
 config CRASH_DUMP
        bool "Build a kdump crash kernel"
        depends on PPC64 || 6xx || FSL_BOOKE
-       select RELOCATABLE if PPC64 || FSL_BOOKE
+       select RELOCATABLE if PPC64
+       select DYNAMIC_MEMSTART if FSL_BOOKE
        help
          Build a kernel suitable for use as a kdump capture kernel.
          The same kernel binary can be used as production kernel and dump
@@ -777,6 +778,10 @@ source "drivers/rapidio/Kconfig"
 
 endmenu
 
+config NONSTATIC_KERNEL
+       bool
+       default n
+
 menu "Advanced setup"
        depends on PPC32
 
@@ -826,23 +831,39 @@ config LOWMEM_CAM_NUM
        int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL
        default 3
 
-config RELOCATABLE
-       bool "Build a relocatable kernel (EXPERIMENTAL)"
+config DYNAMIC_MEMSTART
+       bool "Enable page aligned dynamic load address for kernel (EXPERIMENTAL)"
        depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x)
-       help
-         This builds a kernel image that is capable of running at the
-         location the kernel is loaded at (some alignment restrictions may
-         exist).
-
-         One use is for the kexec on panic case where the recovery kernel
-         must live at a different physical address than the primary
-         kernel.
-
-         Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
-         it has been loaded at and the compile time physical addresses
-         CONFIG_PHYSICAL_START is ignored.  However CONFIG_PHYSICAL_START
-         setting can still be useful to bootwrappers that need to know the
-         load location of the kernel (eg. u-boot/mkimage).
+       select NONSTATIC_KERNEL
+       help
+         This option enables the kernel to be loaded at any page aligned
+         physical address. The kernel creates a mapping from KERNELBASE to 
+         the address where the kernel is loaded. The page size here implies
+         the TLB page size of the mapping for kernel on the particular platform.
+         Please refer to the init code for finding the TLB page size.
+
+         DYNAMIC_MEMSTART is an easy way of implementing pseudo-RELOCATABLE
+         kernel image, where the only restriction is the page aligned kernel
+         load address. When this option is enabled, the compile time physical 
+         address CONFIG_PHYSICAL_START is ignored.
+
+# Mapping based RELOCATABLE is moved to DYNAMIC_MEMSTART
+# config RELOCATABLE
+#      bool "Build a relocatable kernel (EXPERIMENTAL)"
+#      depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x)
+#      help
+#        This builds a kernel image that is capable of running at the
+#        location the kernel is loaded at, without any alignment restrictions.
+#
+#        One use is for the kexec on panic case where the recovery kernel
+#        must live at a different physical address than the primary
+#        kernel.
+#
+#        Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
+#        it has been loaded at and the compile time physical addresses
+#        CONFIG_PHYSICAL_START is ignored.  However CONFIG_PHYSICAL_START
+#        setting can still be useful to bootwrappers that need to know the
+#        load location of the kernel (eg. u-boot/mkimage).
 
 config PAGE_OFFSET_BOOL
        bool "Set custom page offset address"
@@ -872,7 +893,7 @@ config KERNEL_START_BOOL
 config KERNEL_START
        hex "Virtual address of kernel base" if KERNEL_START_BOOL
        default PAGE_OFFSET if PAGE_OFFSET_BOOL
-       default "0xc2000000" if CRASH_DUMP && !RELOCATABLE
+       default "0xc2000000" if CRASH_DUMP && !NONSTATIC_KERNEL
        default "0xc0000000"
 
 config PHYSICAL_START_BOOL
@@ -885,7 +906,7 @@ config PHYSICAL_START_BOOL
 
 config PHYSICAL_START
        hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL
-       default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !RELOCATABLE
+       default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !NONSTATIC_KERNEL
        default "0x00000000"
 
 config PHYSICAL_ALIGN
@@ -931,6 +952,7 @@ endmenu
 if PPC64
 config RELOCATABLE
        bool "Build a relocatable kernel"
+       select NONSTATIC_KERNEL
        help
          This builds a kernel image that is capable of running anywhere
          in the RMA (real memory area) at any 16k-aligned base address.
index a6eb6ad05b2dcc1176126d2082fba01e76437f6f..ca00cf750d3e7bd9e90867cad7d29d30b03e10bf 100644 (file)
@@ -25,7 +25,8 @@ CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="root=/dev/issblk0"
 # CONFIG_PCI is not set
 CONFIG_ADVANCED_OPTIONS=y
-CONFIG_RELOCATABLE=y
+CONFIG_NONSTATIC_KERNEL=y
+CONFIG_DYNAMIC_MEMSTART=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
index bffd062adf799d605460fee0910d14082765df8c..c9776202d7ec5af080a6a5eea868229c97978f32 100644 (file)
 
 #ifndef __ASSEMBLY__
 
-#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_RELOCATABLE)
+#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_NONSTATIC_KERNEL)
 extern void reserve_kdump_trampoline(void);
 extern void setup_kdump_trampoline(void);
 #else
-/* !CRASH_DUMP || RELOCATABLE */
+/* !CRASH_DUMP || !NONSTATIC_KERNEL */
 static inline void reserve_kdump_trampoline(void) { ; }
 static inline void setup_kdump_trampoline(void) { ; }
 #endif
index 9d7485c7e6f8c5864fc447ec8b5aa361a541ee57..f149967ee6b5b69fde826e7cb002ea89ec0f2991 100644 (file)
@@ -92,7 +92,7 @@ extern unsigned int HPAGE_SHIFT;
 #define PAGE_OFFSET    ASM_CONST(CONFIG_PAGE_OFFSET)
 #define LOAD_OFFSET    ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
 
-#if defined(CONFIG_RELOCATABLE)
+#if defined(CONFIG_NONSTATIC_KERNEL)
 #ifndef __ASSEMBLY__
 
 extern phys_addr_t memstart_addr;
@@ -105,7 +105,7 @@ extern phys_addr_t kernstart_addr;
 
 #ifdef CONFIG_PPC64
 #define MEMORY_START   0UL
-#elif defined(CONFIG_RELOCATABLE)
+#elif defined(CONFIG_NONSTATIC_KERNEL)
 #define MEMORY_START   memstart_addr
 #else
 #define MEMORY_START   (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
index 424afb6b8fbaef07f9db351eb4429783b9baa83c..b3ba5163eae2d17614d1308fca7d672aa98b1ba3 100644 (file)
@@ -28,7 +28,7 @@
 #define DBG(fmt...)
 #endif
 
-#ifndef CONFIG_RELOCATABLE
+#ifndef CONFIG_NONSTATIC_KERNEL
 void __init reserve_kdump_trampoline(void)
 {
        memblock_reserve(0, KDUMP_RESERVE_LIMIT);
@@ -67,7 +67,7 @@ void __init setup_kdump_trampoline(void)
 
        DBG(" <- setup_kdump_trampoline()\n");
 }
-#endif /* CONFIG_RELOCATABLE */
+#endif /* CONFIG_NONSTATIC_KERNEL */
 
 static int __init parse_savemaxmem(char *p)
 {
index bb7a9c7a4c05c93889f74b2583c3358f2ad9ec13..d7a1debda10b6471359d76965ab3451ea8a4cd32 100644 (file)
@@ -86,8 +86,10 @@ _ENTRY(_start);
 
        bl      early_init
 
-#ifdef CONFIG_RELOCATABLE
+#ifdef CONFIG_DYNAMIC_MEMSTART
        /*
+        * Mapping based, page aligned dynamic kernel loading.
+        *
         * r25 will contain RPN/ERPN for the start address of memory
         *
         * Add the difference between KERNELBASE and PAGE_OFFSET to the
index 9f5d210ddf3fd02b94570eec31081d7f246fe0f7..d5d78c4ceef6d4200e2d345c8d16fe25a96f6b7c 100644 (file)
@@ -197,7 +197,7 @@ _ENTRY(__early_start)
 
        bl      early_init
 
-#ifdef CONFIG_RELOCATABLE
+#ifdef CONFIG_DYNAMIC_MEMSTART
        lis     r3,kernstart_addr@ha
        la      r3,kernstart_addr@l(r3)
 #ifdef CONFIG_PHYS_64BIT
index 9ce1672afb59c1581151d1a83bc8a80b20586385..ec50bb9655389ac11df55d9a531421463eef365a 100644 (file)
@@ -128,7 +128,7 @@ void __init reserve_crashkernel(void)
 
        crash_size = resource_size(&crashk_res);
 
-#ifndef CONFIG_RELOCATABLE
+#ifndef CONFIG_NONSTATIC_KERNEL
        if (crashk_res.start != KDUMP_KERNELBASE)
                printk("Crash kernel location must be 0x%x\n",
                                KDUMP_KERNELBASE);
index 55b4080a821ed6fc14c0084eb59c8623a1761fd7..eca626ea3f2393dcaf0cd6bfb61f6262a4443e7e 100644 (file)
@@ -2845,7 +2845,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
        RELOC(of_platform) = prom_find_machine_type();
        prom_printf("Detected machine type: %x\n", RELOC(of_platform));
 
-#ifndef CONFIG_RELOCATABLE
+#ifndef CONFIG_NONSTATIC_KERNEL
        /* Bail if this is a kdump kernel. */
        if (PHYSICAL_START > 0)
                prom_panic("Error: You can't boot a kdump kernel from OF!\n");
index 5d4e3fff6d6d6c381b6a9bcaacba9886333c8586..388b95e1a00956adead4fe85d382a7f20ca5b3f9 100644 (file)
@@ -217,7 +217,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
 {
        u64 size;
 
-#ifndef CONFIG_RELOCATABLE
+#ifndef CONFIG_NONSTATIC_KERNEL
        /* We don't currently support the first MEMBLOCK not mapping 0
         * physical on those processors
         */