diff options
author | Suzuki Poulose <suzuki@in.ibm.com> | 2011-12-14 17:57:15 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@gmail.com> | 2011-12-20 10:20:19 -0500 |
commit | 0f890c8d205e47f7cb0d381ffba582a170fd4f72 (patch) | |
tree | 66d8370622f15636134b83bd19145ce61d8d719c | |
parent | 3f53638c805f75989f4b4be07efcfd173cdd5e2d (diff) |
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>
-rw-r--r-- | arch/powerpc/Kconfig | 60 | ||||
-rw-r--r-- | arch/powerpc/configs/44x/iss476-smp_defconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/include/asm/kdump.h | 4 | ||||
-rw-r--r-- | arch/powerpc/include/asm/page.h | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/crash_dump.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_44x.S | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_fsl_booke.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/machine_kexec.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/44x_mmu.c | 2 |
10 files changed, 56 insertions, 31 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index d66a47fde80c..6c8475692322 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -368,7 +368,8 @@ config KEXEC | |||
368 | config CRASH_DUMP | 368 | config CRASH_DUMP |
369 | bool "Build a kdump crash kernel" | 369 | bool "Build a kdump crash kernel" |
370 | depends on PPC64 || 6xx || FSL_BOOKE | 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 | help | 373 | help |
373 | Build a kernel suitable for use as a kdump capture kernel. | 374 | Build a kernel suitable for use as a kdump capture kernel. |
374 | The same kernel binary can be used as production kernel and dump | 375 | The same kernel binary can be used as production kernel and dump |
@@ -777,6 +778,10 @@ source "drivers/rapidio/Kconfig" | |||
777 | 778 | ||
778 | endmenu | 779 | endmenu |
779 | 780 | ||
781 | config NONSTATIC_KERNEL | ||
782 | bool | ||
783 | default n | ||
784 | |||
780 | menu "Advanced setup" | 785 | menu "Advanced setup" |
781 | depends on PPC32 | 786 | depends on PPC32 |
782 | 787 | ||
@@ -826,23 +831,39 @@ config LOWMEM_CAM_NUM | |||
826 | int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL | 831 | int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL |
827 | default 3 | 832 | default 3 |
828 | 833 | ||
829 | config RELOCATABLE | 834 | config DYNAMIC_MEMSTART |
830 | bool "Build a relocatable kernel (EXPERIMENTAL)" | 835 | bool "Enable page aligned dynamic load address for kernel (EXPERIMENTAL)" |
831 | depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x) | 836 | depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x) |
832 | help | 837 | select NONSTATIC_KERNEL |
833 | This builds a kernel image that is capable of running at the | 838 | help |
834 | location the kernel is loaded at (some alignment restrictions may | 839 | This option enables the kernel to be loaded at any page aligned |
835 | exist). | 840 | physical address. The kernel creates a mapping from KERNELBASE to |
836 | 841 | the address where the kernel is loaded. The page size here implies | |
837 | One use is for the kexec on panic case where the recovery kernel | 842 | the TLB page size of the mapping for kernel on the particular platform. |
838 | must live at a different physical address than the primary | 843 | Please refer to the init code for finding the TLB page size. |
839 | kernel. | 844 | |
840 | 845 | DYNAMIC_MEMSTART is an easy way of implementing pseudo-RELOCATABLE | |
841 | Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address | 846 | kernel image, where the only restriction is the page aligned kernel |
842 | it has been loaded at and the compile time physical addresses | 847 | load address. When this option is enabled, the compile time physical |
843 | CONFIG_PHYSICAL_START is ignored. However CONFIG_PHYSICAL_START | 848 | address CONFIG_PHYSICAL_START is ignored. |
844 | setting can still be useful to bootwrappers that need to know the | 849 | |
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 | config PAGE_OFFSET_BOOL | 868 | config PAGE_OFFSET_BOOL |
848 | bool "Set custom page offset address" | 869 | bool "Set custom page offset address" |
@@ -872,7 +893,7 @@ config KERNEL_START_BOOL | |||
872 | config KERNEL_START | 893 | config KERNEL_START |
873 | hex "Virtual address of kernel base" if KERNEL_START_BOOL | 894 | hex "Virtual address of kernel base" if KERNEL_START_BOOL |
874 | default PAGE_OFFSET if PAGE_OFFSET_BOOL | 895 | default PAGE_OFFSET if PAGE_OFFSET_BOOL |
875 | default "0xc2000000" if CRASH_DUMP && !RELOCATABLE | 896 | default "0xc2000000" if CRASH_DUMP && !NONSTATIC_KERNEL |
876 | default "0xc0000000" | 897 | default "0xc0000000" |
877 | 898 | ||
878 | config PHYSICAL_START_BOOL | 899 | config PHYSICAL_START_BOOL |
@@ -885,7 +906,7 @@ config PHYSICAL_START_BOOL | |||
885 | 906 | ||
886 | config PHYSICAL_START | 907 | config PHYSICAL_START |
887 | hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL | 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 | default "0x00000000" | 910 | default "0x00000000" |
890 | 911 | ||
891 | config PHYSICAL_ALIGN | 912 | config PHYSICAL_ALIGN |
@@ -931,6 +952,7 @@ endmenu | |||
931 | if PPC64 | 952 | if PPC64 |
932 | config RELOCATABLE | 953 | config RELOCATABLE |
933 | bool "Build a relocatable kernel" | 954 | bool "Build a relocatable kernel" |
955 | select NONSTATIC_KERNEL | ||
934 | help | 956 | help |
935 | This builds a kernel image that is capable of running anywhere | 957 | This builds a kernel image that is capable of running anywhere |
936 | in the RMA (real memory area) at any 16k-aligned base address. | 958 | in the RMA (real memory area) at any 16k-aligned base address. |
diff --git a/arch/powerpc/configs/44x/iss476-smp_defconfig b/arch/powerpc/configs/44x/iss476-smp_defconfig index a6eb6ad05b2d..ca00cf750d3e 100644 --- a/arch/powerpc/configs/44x/iss476-smp_defconfig +++ b/arch/powerpc/configs/44x/iss476-smp_defconfig | |||
@@ -25,7 +25,8 @@ CONFIG_CMDLINE_BOOL=y | |||
25 | CONFIG_CMDLINE="root=/dev/issblk0" | 25 | CONFIG_CMDLINE="root=/dev/issblk0" |
26 | # CONFIG_PCI is not set | 26 | # CONFIG_PCI is not set |
27 | CONFIG_ADVANCED_OPTIONS=y | 27 | CONFIG_ADVANCED_OPTIONS=y |
28 | CONFIG_RELOCATABLE=y | 28 | CONFIG_NONSTATIC_KERNEL=y |
29 | CONFIG_DYNAMIC_MEMSTART=y | ||
29 | CONFIG_NET=y | 30 | CONFIG_NET=y |
30 | CONFIG_PACKET=y | 31 | CONFIG_PACKET=y |
31 | CONFIG_UNIX=y | 32 | CONFIG_UNIX=y |
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h index bffd062adf79..c9776202d7ec 100644 --- a/arch/powerpc/include/asm/kdump.h +++ b/arch/powerpc/include/asm/kdump.h | |||
@@ -32,11 +32,11 @@ | |||
32 | 32 | ||
33 | #ifndef __ASSEMBLY__ | 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 | extern void reserve_kdump_trampoline(void); | 36 | extern void reserve_kdump_trampoline(void); |
37 | extern void setup_kdump_trampoline(void); | 37 | extern void setup_kdump_trampoline(void); |
38 | #else | 38 | #else |
39 | /* !CRASH_DUMP || RELOCATABLE */ | 39 | /* !CRASH_DUMP || !NONSTATIC_KERNEL */ |
40 | static inline void reserve_kdump_trampoline(void) { ; } | 40 | static inline void reserve_kdump_trampoline(void) { ; } |
41 | static inline void setup_kdump_trampoline(void) { ; } | 41 | static inline void setup_kdump_trampoline(void) { ; } |
42 | #endif | 42 | #endif |
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index 9d7485c7e6f8..f149967ee6b5 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -92,7 +92,7 @@ extern unsigned int HPAGE_SHIFT; | |||
92 | #define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET) | 92 | #define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET) |
93 | #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START)) | 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 | #ifndef __ASSEMBLY__ | 96 | #ifndef __ASSEMBLY__ |
97 | 97 | ||
98 | extern phys_addr_t memstart_addr; | 98 | extern phys_addr_t memstart_addr; |
@@ -105,7 +105,7 @@ extern phys_addr_t kernstart_addr; | |||
105 | 105 | ||
106 | #ifdef CONFIG_PPC64 | 106 | #ifdef CONFIG_PPC64 |
107 | #define MEMORY_START 0UL | 107 | #define MEMORY_START 0UL |
108 | #elif defined(CONFIG_RELOCATABLE) | 108 | #elif defined(CONFIG_NONSTATIC_KERNEL) |
109 | #define MEMORY_START memstart_addr | 109 | #define MEMORY_START memstart_addr |
110 | #else | 110 | #else |
111 | #define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE) | 111 | #define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE) |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 424afb6b8fba..b3ba5163eae2 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #define DBG(fmt...) | 28 | #define DBG(fmt...) |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifndef CONFIG_RELOCATABLE | 31 | #ifndef CONFIG_NONSTATIC_KERNEL |
32 | void __init reserve_kdump_trampoline(void) | 32 | void __init reserve_kdump_trampoline(void) |
33 | { | 33 | { |
34 | memblock_reserve(0, KDUMP_RESERVE_LIMIT); | 34 | memblock_reserve(0, KDUMP_RESERVE_LIMIT); |
@@ -67,7 +67,7 @@ void __init setup_kdump_trampoline(void) | |||
67 | 67 | ||
68 | DBG(" <- setup_kdump_trampoline()\n"); | 68 | DBG(" <- setup_kdump_trampoline()\n"); |
69 | } | 69 | } |
70 | #endif /* CONFIG_RELOCATABLE */ | 70 | #endif /* CONFIG_NONSTATIC_KERNEL */ |
71 | 71 | ||
72 | static int __init parse_savemaxmem(char *p) | 72 | static int __init parse_savemaxmem(char *p) |
73 | { | 73 | { |
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index bb7a9c7a4c05..d7a1debda10b 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -86,8 +86,10 @@ _ENTRY(_start); | |||
86 | 86 | ||
87 | bl early_init | 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 | * r25 will contain RPN/ERPN for the start address of memory | 93 | * r25 will contain RPN/ERPN for the start address of memory |
92 | * | 94 | * |
93 | * Add the difference between KERNELBASE and PAGE_OFFSET to the | 95 | * Add the difference between KERNELBASE and PAGE_OFFSET to the |
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 9f5d210ddf3f..d5d78c4ceef6 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -197,7 +197,7 @@ _ENTRY(__early_start) | |||
197 | 197 | ||
198 | bl early_init | 198 | bl early_init |
199 | 199 | ||
200 | #ifdef CONFIG_RELOCATABLE | 200 | #ifdef CONFIG_DYNAMIC_MEMSTART |
201 | lis r3,kernstart_addr@ha | 201 | lis r3,kernstart_addr@ha |
202 | la r3,kernstart_addr@l(r3) | 202 | la r3,kernstart_addr@l(r3) |
203 | #ifdef CONFIG_PHYS_64BIT | 203 | #ifdef CONFIG_PHYS_64BIT |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 9ce1672afb59..ec50bb965538 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -128,7 +128,7 @@ void __init reserve_crashkernel(void) | |||
128 | 128 | ||
129 | crash_size = resource_size(&crashk_res); | 129 | crash_size = resource_size(&crashk_res); |
130 | 130 | ||
131 | #ifndef CONFIG_RELOCATABLE | 131 | #ifndef CONFIG_NONSTATIC_KERNEL |
132 | if (crashk_res.start != KDUMP_KERNELBASE) | 132 | if (crashk_res.start != KDUMP_KERNELBASE) |
133 | printk("Crash kernel location must be 0x%x\n", | 133 | printk("Crash kernel location must be 0x%x\n", |
134 | KDUMP_KERNELBASE); | 134 | KDUMP_KERNELBASE); |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 55b4080a821e..eca626ea3f23 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2845,7 +2845,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2845 | RELOC(of_platform) = prom_find_machine_type(); | 2845 | RELOC(of_platform) = prom_find_machine_type(); |
2846 | prom_printf("Detected machine type: %x\n", RELOC(of_platform)); | 2846 | prom_printf("Detected machine type: %x\n", RELOC(of_platform)); |
2847 | 2847 | ||
2848 | #ifndef CONFIG_RELOCATABLE | 2848 | #ifndef CONFIG_NONSTATIC_KERNEL |
2849 | /* Bail if this is a kdump kernel. */ | 2849 | /* Bail if this is a kdump kernel. */ |
2850 | if (PHYSICAL_START > 0) | 2850 | if (PHYSICAL_START > 0) |
2851 | prom_panic("Error: You can't boot a kdump kernel from OF!\n"); | 2851 | prom_panic("Error: You can't boot a kdump kernel from OF!\n"); |
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c index 5d4e3fff6d6d..388b95e1a009 100644 --- a/arch/powerpc/mm/44x_mmu.c +++ b/arch/powerpc/mm/44x_mmu.c | |||
@@ -217,7 +217,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, | |||
217 | { | 217 | { |
218 | u64 size; | 218 | u64 size; |
219 | 219 | ||
220 | #ifndef CONFIG_RELOCATABLE | 220 | #ifndef CONFIG_NONSTATIC_KERNEL |
221 | /* We don't currently support the first MEMBLOCK not mapping 0 | 221 | /* We don't currently support the first MEMBLOCK not mapping 0 |
222 | * physical on those processors | 222 | * physical on those processors |
223 | */ | 223 | */ |