Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Suzuki Poulose and committed by
Josh Boyer
0f890c8d 3f53638c

+53 -28
+38 -16
arch/powerpc/Kconfig
··· 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 ··· 778 777 779 778 endmenu 780 779 780 + config NONSTATIC_KERNEL 781 + bool 782 + default n 783 + 781 784 menu "Advanced setup" 782 785 depends on PPC32 783 786 ··· 831 826 int "Number of CAMs to use to map low memory" if LOWMEM_CAM_NUM_BOOL 832 827 default 3 833 828 834 - config RELOCATABLE 835 - bool "Build a relocatable kernel (EXPERIMENTAL)" 829 + config DYNAMIC_MEMSTART 830 + bool "Enable page aligned dynamic load address for kernel (EXPERIMENTAL)" 836 831 depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x) 832 + select NONSTATIC_KERNEL 837 833 help 838 - This builds a kernel image that is capable of running at the 839 - location the kernel is loaded at (some alignment restrictions may 840 - exist). 834 + This option enables the kernel to be loaded at any page aligned 835 + physical address. The kernel creates a mapping from KERNELBASE to 836 + the address where the kernel is loaded. The page size here implies 837 + the TLB page size of the mapping for kernel on the particular platform. 838 + Please refer to the init code for finding the TLB page size. 841 839 842 - One use is for the kexec on panic case where the recovery kernel 843 - must live at a different physical address than the primary 844 - kernel. 840 + DYNAMIC_MEMSTART is an easy way of implementing pseudo-RELOCATABLE 841 + kernel image, where the only restriction is the page aligned kernel 842 + load address. When this option is enabled, the compile time physical 843 + address CONFIG_PHYSICAL_START is ignored. 845 844 846 - Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address 847 - it has been loaded at and the compile time physical addresses 848 - CONFIG_PHYSICAL_START is ignored. However CONFIG_PHYSICAL_START 849 - setting can still be useful to bootwrappers that need to know the 850 - load location of the kernel (eg. u-boot/mkimage). 845 + # Mapping based RELOCATABLE is moved to DYNAMIC_MEMSTART 846 + # config RELOCATABLE 847 + # bool "Build a relocatable kernel (EXPERIMENTAL)" 848 + # depends on EXPERIMENTAL && ADVANCED_OPTIONS && FLATMEM && (FSL_BOOKE || PPC_47x) 849 + # help 850 + # This builds a kernel image that is capable of running at the 851 + # location the kernel is loaded at, without any alignment restrictions. 852 + # 853 + # One use is for the kexec on panic case where the recovery kernel 854 + # must live at a different physical address than the primary 855 + # kernel. 856 + # 857 + # Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address 858 + # it has been loaded at and the compile time physical addresses 859 + # CONFIG_PHYSICAL_START is ignored. However CONFIG_PHYSICAL_START 860 + # setting can still be useful to bootwrappers that need to know the 861 + # load location of the kernel (eg. u-boot/mkimage). 851 862 852 863 config PAGE_OFFSET_BOOL 853 864 bool "Set custom page offset address" ··· 893 872 config KERNEL_START 894 873 hex "Virtual address of kernel base" if KERNEL_START_BOOL 895 874 default PAGE_OFFSET if PAGE_OFFSET_BOOL 896 - default "0xc2000000" if CRASH_DUMP && !RELOCATABLE 875 + default "0xc2000000" if CRASH_DUMP && !NONSTATIC_KERNEL 897 876 default "0xc0000000" 898 877 899 878 config PHYSICAL_START_BOOL ··· 906 885 907 886 config PHYSICAL_START 908 887 hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL 909 - default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !RELOCATABLE 888 + default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !NONSTATIC_KERNEL 910 889 default "0x00000000" 911 890 912 891 config PHYSICAL_ALIGN ··· 952 931 if PPC64 953 932 config RELOCATABLE 954 933 bool "Build a relocatable kernel" 934 + select NONSTATIC_KERNEL 955 935 help 956 936 This builds a kernel image that is capable of running anywhere 957 937 in the RMA (real memory area) at any 16k-aligned base address.
+2 -1
arch/powerpc/configs/44x/iss476-smp_defconfig
··· 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
+2 -2
arch/powerpc/include/asm/kdump.h
··· 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
+2 -2
arch/powerpc/include/asm/page.h
··· 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 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)
+2 -2
arch/powerpc/kernel/crash_dump.c
··· 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 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 {
+3 -1
arch/powerpc/kernel/head_44x.S
··· 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
+1 -1
arch/powerpc/kernel/head_fsl_booke.S
··· 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
+1 -1
arch/powerpc/kernel/machine_kexec.c
··· 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);
+1 -1
arch/powerpc/kernel/prom_init.c
··· 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");
+1 -1
arch/powerpc/mm/44x_mmu.c
··· 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 */