Commit 0f890c8d205e47f7cb0d381ffba582a170fd4f72

Authored by Suzuki Poulose
Committed by Josh Boyer
1 parent 3f53638c80

powerpc: Rename mapping based RELOCATABLE to DYNAMIC_MEMSTART for BookE

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>

Showing 10 changed files with 56 additions and 31 deletions Side-by-side Diff

arch/powerpc/Kconfig
... ... @@ -368,7 +368,8 @@
368 368 config CRASH_DUMP
369 369 bool "Build a kdump crash kernel"
370 370 depends on PPC64 || 6xx || FSL_BOOKE
371   - select RELOCATABLE if PPC64 || FSL_BOOKE
  371 + select RELOCATABLE if PPC64
  372 + select DYNAMIC_MEMSTART if FSL_BOOKE
372 373 help
373 374 Build a kernel suitable for use as a kdump capture kernel.
374 375 The same kernel binary can be used as production kernel and dump
... ... @@ -777,6 +778,10 @@
777 778  
778 779 endmenu
779 780  
  781 +config NONSTATIC_KERNEL
  782 + bool
  783 + default n
  784 +
780 785 menu "Advanced setup"
781 786 depends on PPC32
782 787  
783 788  
784 789  
785 790  
786 791  
... ... @@ -826,23 +831,39 @@
826 831 int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL
827 832 default 3
828 833  
829   -config RELOCATABLE
830   - bool "Build a relocatable kernel (EXPERIMENTAL)"
  834 +config DYNAMIC_MEMSTART
  835 + bool "Enable page aligned dynamic load address for kernel (EXPERIMENTAL)"
831 836 depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x)
  837 + select NONSTATIC_KERNEL
832 838 help
833   - This builds a kernel image that is capable of running at the
834   - location the kernel is loaded at (some alignment restrictions may
835   - exist).
  839 + This option enables the kernel to be loaded at any page aligned
  840 + physical address. The kernel creates a mapping from KERNELBASE to
  841 + the address where the kernel is loaded. The page size here implies
  842 + the TLB page size of the mapping for kernel on the particular platform.
  843 + Please refer to the init code for finding the TLB page size.
836 844  
837   - One use is for the kexec on panic case where the recovery kernel
838   - must live at a different physical address than the primary
839   - kernel.
  845 + DYNAMIC_MEMSTART is an easy way of implementing pseudo-RELOCATABLE
  846 + kernel image, where the only restriction is the page aligned kernel
  847 + load address. When this option is enabled, the compile time physical
  848 + address CONFIG_PHYSICAL_START is ignored.
840 849  
841   - Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
842   - it has been loaded at and the compile time physical addresses
843   - CONFIG_PHYSICAL_START is ignored. However CONFIG_PHYSICAL_START
844   - setting can still be useful to bootwrappers that need to know the
845   - load location of the kernel (eg. u-boot/mkimage).
  850 +# Mapping based RELOCATABLE is moved to DYNAMIC_MEMSTART
  851 +# config RELOCATABLE
  852 +# bool "Build a relocatable kernel (EXPERIMENTAL)"
  853 +# depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x)
  854 +# help
  855 +# This builds a kernel image that is capable of running at the
  856 +# location the kernel is loaded at, without any alignment restrictions.
  857 +#
  858 +# One use is for the kexec on panic case where the recovery kernel
  859 +# must live at a different physical address than the primary
  860 +# kernel.
  861 +#
  862 +# Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
  863 +# it has been loaded at and the compile time physical addresses
  864 +# CONFIG_PHYSICAL_START is ignored. However CONFIG_PHYSICAL_START
  865 +# setting can still be useful to bootwrappers that need to know the
  866 +# load location of the kernel (eg. u-boot/mkimage).
846 867  
847 868 config PAGE_OFFSET_BOOL
848 869 bool "Set custom page offset address"
... ... @@ -872,7 +893,7 @@
872 893 config KERNEL_START
873 894 hex "Virtual address of kernel base" if KERNEL_START_BOOL
874 895 default PAGE_OFFSET if PAGE_OFFSET_BOOL
875   - default "0xc2000000" if CRASH_DUMP && !RELOCATABLE
  896 + default "0xc2000000" if CRASH_DUMP && !NONSTATIC_KERNEL
876 897 default "0xc0000000"
877 898  
878 899 config PHYSICAL_START_BOOL
... ... @@ -885,7 +906,7 @@
885 906  
886 907 config PHYSICAL_START
887 908 hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL
888   - default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !RELOCATABLE
  909 + default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !NONSTATIC_KERNEL
889 910 default "0x00000000"
890 911  
891 912 config PHYSICAL_ALIGN
... ... @@ -931,6 +952,7 @@
931 952 if PPC64
932 953 config RELOCATABLE
933 954 bool "Build a relocatable kernel"
  955 + select NONSTATIC_KERNEL
934 956 help
935 957 This builds a kernel image that is capable of running anywhere
936 958 in the RMA (real memory area) at any 16k-aligned base address.
arch/powerpc/configs/44x/iss476-smp_defconfig
... ... @@ -25,7 +25,8 @@
25 25 CONFIG_CMDLINE="root=/dev/issblk0"
26 26 # CONFIG_PCI is not set
27 27 CONFIG_ADVANCED_OPTIONS=y
28   -CONFIG_RELOCATABLE=y
  28 +CONFIG_NONSTATIC_KERNEL=y
  29 +CONFIG_DYNAMIC_MEMSTART=y
29 30 CONFIG_NET=y
30 31 CONFIG_PACKET=y
31 32 CONFIG_UNIX=y
arch/powerpc/include/asm/kdump.h
... ... @@ -32,11 +32,11 @@
32 32  
33 33 #ifndef __ASSEMBLY__
34 34  
35   -#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_RELOCATABLE)
  35 +#if defined(CONFIG_CRASH_DUMP) && !defined(CONFIG_NONSTATIC_KERNEL)
36 36 extern void reserve_kdump_trampoline(void);
37 37 extern void setup_kdump_trampoline(void);
38 38 #else
39   -/* !CRASH_DUMP || RELOCATABLE */
  39 +/* !CRASH_DUMP || !NONSTATIC_KERNEL */
40 40 static inline void reserve_kdump_trampoline(void) { ; }
41 41 static inline void setup_kdump_trampoline(void) { ; }
42 42 #endif
arch/powerpc/include/asm/page.h
... ... @@ -92,7 +92,7 @@
92 92 #define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET)
93 93 #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
94 94  
95   -#if defined(CONFIG_RELOCATABLE)
  95 +#if defined(CONFIG_NONSTATIC_KERNEL)
96 96 #ifndef __ASSEMBLY__
97 97  
98 98 extern phys_addr_t memstart_addr;
... ... @@ -105,7 +105,7 @@
105 105  
106 106 #ifdef CONFIG_PPC64
107 107 #define MEMORY_START 0UL
108   -#elif defined(CONFIG_RELOCATABLE)
  108 +#elif defined(CONFIG_NONSTATIC_KERNEL)
109 109 #define MEMORY_START memstart_addr
110 110 #else
111 111 #define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
arch/powerpc/kernel/crash_dump.c
... ... @@ -28,7 +28,7 @@
28 28 #define DBG(fmt...)
29 29 #endif
30 30  
31   -#ifndef CONFIG_RELOCATABLE
  31 +#ifndef CONFIG_NONSTATIC_KERNEL
32 32 void __init reserve_kdump_trampoline(void)
33 33 {
34 34 memblock_reserve(0, KDUMP_RESERVE_LIMIT);
... ... @@ -67,7 +67,7 @@
67 67  
68 68 DBG(" <- setup_kdump_trampoline()\n");
69 69 }
70   -#endif /* CONFIG_RELOCATABLE */
  70 +#endif /* CONFIG_NONSTATIC_KERNEL */
71 71  
72 72 static int __init parse_savemaxmem(char *p)
73 73 {
arch/powerpc/kernel/head_44x.S
... ... @@ -86,8 +86,10 @@
86 86  
87 87 bl early_init
88 88  
89   -#ifdef CONFIG_RELOCATABLE
  89 +#ifdef CONFIG_DYNAMIC_MEMSTART
90 90 /*
  91 + * Mapping based, page aligned dynamic kernel loading.
  92 + *
91 93 * r25 will contain RPN/ERPN for the start address of memory
92 94 *
93 95 * Add the difference between KERNELBASE and PAGE_OFFSET to the
arch/powerpc/kernel/head_fsl_booke.S
... ... @@ -197,7 +197,7 @@
197 197  
198 198 bl early_init
199 199  
200   -#ifdef CONFIG_RELOCATABLE
  200 +#ifdef CONFIG_DYNAMIC_MEMSTART
201 201 lis r3,kernstart_addr@ha
202 202 la r3,kernstart_addr@l(r3)
203 203 #ifdef CONFIG_PHYS_64BIT
arch/powerpc/kernel/machine_kexec.c
... ... @@ -128,7 +128,7 @@
128 128  
129 129 crash_size = resource_size(&crashk_res);
130 130  
131   -#ifndef CONFIG_RELOCATABLE
  131 +#ifndef CONFIG_NONSTATIC_KERNEL
132 132 if (crashk_res.start != KDUMP_KERNELBASE)
133 133 printk("Crash kernel location must be 0x%x\n",
134 134 KDUMP_KERNELBASE);
arch/powerpc/kernel/prom_init.c
... ... @@ -2845,7 +2845,7 @@
2845 2845 RELOC(of_platform) = prom_find_machine_type();
2846 2846 prom_printf("Detected machine type: %x\n", RELOC(of_platform));
2847 2847  
2848   -#ifndef CONFIG_RELOCATABLE
  2848 +#ifndef CONFIG_NONSTATIC_KERNEL
2849 2849 /* Bail if this is a kdump kernel. */
2850 2850 if (PHYSICAL_START > 0)
2851 2851 prom_panic("Error: You can't boot a kdump kernel from OF!\n");
arch/powerpc/mm/44x_mmu.c
... ... @@ -217,7 +217,7 @@
217 217 {
218 218 u64 size;
219 219  
220   -#ifndef CONFIG_RELOCATABLE
  220 +#ifndef CONFIG_NONSTATIC_KERNEL
221 221 /* We don't currently support the first MEMBLOCK not mapping 0
222 222 * physical on those processors
223 223 */