powerpc: tweak the kernel options for CRASH_DUMP and RELOCATABLE
v2 cover powerpc: tweak the kernel options for CRASH_DUMP and RELOCATABLE
v2:
Compare to v1 [1], the main differences are:
- Still automatically select RELOCATABLE when CRASH_DUMP is enabled.
- Add a new patch to kill RELOCATABLE_PPC32.
v1:
The first patch fixes a build error when CRASH_DUMP=y && ADVANCED_OPTIONS=n for ppc32. The second does some cleanup for RELOCATABLE option.
Kevin Hao (3):
powerpc32: booke: fix the build error when CRASH_DUMP is enabled
powerpc: merge the RELOCATABLE config entries for ppc32 and ppc64
powerpc32: kill RELOCATABLE_PPC32
arch/powerpc/Kconfig | 61 +++++++++++++++------------------------ arch/powerpc/include/asm/page.h | 6 ++-- arch/powerpc/kernel/Makefile | 3 +- arch/powerpc/kernel/vmlinux.lds.S | 2 +- arch/powerpc/mm/init_32.c | 2 +- 5 files changed, 29 insertions(+), 45 deletions(-)
Signature · 1 line
2.8.1
PATCH v2 1/3 powerpc32: booke: fix the build error when CRASH_DUMP is enabled
In the current code, the RELOCATABLE will be forcedly enabled when
enabling CRASH_DUMP. But for ppc32, the RELOCABLE also depend onADVANCED_OPTIONS and select NONSTATIC_KERNEL. This will cause the
following build error when CRASH_DUMP=y && ADVANCED_OPTIONS=n
because the select of NONSTATIC_KERNEL doesn't take effect.
arch/powerpc/include/asm/io.h: In function 'virt_to_phys':
arch/powerpc/include/asm/page.h:113:26: error: 'virt_phys_offset' undeclared (first use in this function)
#define VIRT_PHYS_OFFSET virt_phys_offset
^It doesn't have any strong reasons to make the RELOCATABLE depend on ADVANCED_OPTIONS. So remove this dependency to fix this issue.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -952,7 +952,7 @@ config DYNAMIC_MEMSTART config RELOCATABLE bool "Build a relocatable kernel" - depends on ADVANCED_OPTIONS && FLATMEM && (44x || FSL_BOOKE) + depends on FLATMEM && (44x || FSL_BOOKE) select NONSTATIC_KERNEL help This builds a kernel image that is capable of running at the
Signature · 1 line
2.8.1
Re: [v2, 1/3] powerpc32: booke: fix the build error when CRASH_DUMP is enabled
Quoted 7 lines · Kevin Hao
In the current code, the RELOCATABLE will be forcedly enabled when
enablingCRASH_DUMP. But for ppc32, the RELOCABLE also depend onADVANCED_OPTIONSand selectNONSTATIC_KERNEL. This will cause the
following build error when CRASH_DUMP=y && ADVANCED_OPTIONS=n
because the select ofNONSTATIC_KERNELdoesn't take effect.
arch/powerpc/include/asm/io.h: In function 'virt_to_phys':
arch/powerpc/include/asm/page.h:113:26: error: 'virt_phys_offset' undeclared (first use in this function)
Quoted 6 lines
#define VIRT_PHYS_OFFSET virt_phys_offset ^It doesn't have any strong reasons to make the RELOCATABLE depend on
ADVANCED_OPTIONS. So remove this dependency to fix this issue.Signed-off-by Kevin Hao <[email protected]>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/da4230714662278781d007fb2b
cheers
PATCH v2 2/3 powerpc: merge the RELOCATABLE config entries for ppc32 and ppc64
In reply to Kevin HaoIt makes no sense to keep two separate RELOCATABLE config entries for ppc32 and ppc64 respectively. Merge them into one and move it to a common place.
--- arch/powerpc/Kconfig | 65 ++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 38 deletions(-)
arch/powerpc/Kconfig +27 -38
@@ -458,6 +458,33 @@ config KEXEC interface is strongly in flux, so no good recommendation can be made. +config RELOCATABLE + bool "Build a relocatable kernel" + depends on (PPC64 && !COMPILE_TEST) || (FLATMEM && (44x || FSL_BOOKE)) + select NONSTATIC_KERNEL + help + This builds a kernel image that is capable of running at the + location the kernel is loaded at. For ppc32, there is no any + alignment restrictions, and this feature is a superset of + DYNAMIC_MEMSTART and hence overrides it. For ppc64, we should use + 16k-aligned base address. The kernel is linked as a + position-independent executable (PIE) and contains dynamic relocations + which are processed early in the bootup process. + + 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 address of the kernel (eg. u-boot/mkimage). + +config RELOCATABLE_PPC32 + def_bool y + depends on PPC32 && RELOCATABLE + config CRASH_DUMP bool "Build a kdump crash kernel" depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
@@ -950,29 +977,6 @@ config DYNAMIC_MEMSTART This option is overridden by CONFIG_RELOCATABLE -config RELOCATABLE - bool "Build a relocatable kernel" - depends on FLATMEM && (44x || FSL_BOOKE) - select NONSTATIC_KERNEL - help - This builds a kernel image that is capable of running at the - location the kernel is loaded at, without any alignment restrictions. - This feature is a superset of DYNAMIC_MEMSTART and hence overrides it. - - 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 address of the kernel (eg. u-boot/mkimage). - -config RELOCATABLE_PPC32 - def_bool y - depends on PPC32 && RELOCATABLE - config PAGE_OFFSET_BOOL bool "Set custom page offset address" depends on ADVANCED_OPTIONS
@@ -1063,21 +1067,6 @@ config PIN_TLB_IMMR endmenu if PPC64 -config RELOCATABLE - bool "Build a relocatable kernel" - depends on !COMPILE_TEST - 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. - The kernel is linked as a position-independent executable (PIE) - and contains dynamic relocations which are processed early - in the bootup process. - - One use is for the kexec on panic case where the recovery kernel - must live at a different physical address than the primary - kernel. - # This value must have zeroes in the bottom 60 bits otherwise lots will break config PAGE_OFFSET hex
Signature · 1 line
2.8.1
PATCH v2 3/3 powerpc32: kill RELOCATABLE_PPC32
In reply to Kevin HaoIt is seldom used in the kernel code and can be easily replaced by either RELOCATABLE or PPC32. So there is no reason to keep a separate kernel option for this.
--- arch/powerpc/Kconfig | 4 ---- arch/powerpc/include/asm/page.h | 6 +++--- arch/powerpc/kernel/Makefile | 3 +-- arch/powerpc/kernel/vmlinux.lds.S | 2 +- arch/powerpc/mm/init_32.c | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-)
arch/powerpc/Kconfig +0 -4
@@ -481,10 +481,6 @@ config RELOCATABLE setting can still be useful to bootwrappers that need to know the load address of the kernel (eg. u-boot/mkimage). -config RELOCATABLE_PPC32 - def_bool y - depends on PPC32 && RELOCATABLE - config CRASH_DUMP bool "Build a kdump crash kernel" depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
arch/powerpc/include/asm/page.h +3 -3
@@ -96,7 +96,7 @@ extern unsigned int HPAGE_SHIFT;extern phys_addr_t memstart_addr;extern phys_addr_t kernstart_addr; -#ifdef CONFIG_RELOCATABLE_PPC32 +#if defined(CONFIG_RELOCATABLE ) && defined(CONFIG_PPC32 )extern long long virt_phys_offset;#endif
@@ -139,9 +139,9 @@ extern long long virt_phys_offset;* determine MEMORY_START until then. However we can determine PHYSICAL_START * from information at hand (program counter, TLB lookup). * -* On BookE with RELOCATABLE (RELOCATABLE_PPC32) +* On BookE with RELOCATABLE && PPC32 * -* With RELOCATABLE_PPC32, we support loading the kernel at any physical +* With RELOCATABLE && PPC32, we support loading the kernel at any physical * address without any restriction on the page alignment. * * We find the runtime address of _stext and relocate ourselves based on
arch/powerpc/kernel/Makefile +1 -2
@@ -47,7 +47,6 @@ obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_power.o obj-$(CONFIG_PPC_BOOK3S_64) += mce.o mce_power.o hmi.o -obj64-$(CONFIG_RELOCATABLE) += reloc_64.o obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o obj-$(CONFIG_PPC64) += vdso64/ obj-$(CONFIG_ALTIVEC) += vecemu.o
@@ -92,7 +91,7 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o extra-$(CONFIG_8xx) := head_8xx.o extra-y += vmlinux.lds -obj-$(CONFIG_RELOCATABLE_PPC32) += reloc_32.o +obj-$(CONFIG_RELOCATABLE) += reloc_$(CONFIG_WORD_SIZE).o obj-$(CONFIG_PPC32) += entry_32.o setup_32.o obj-$(CONFIG_PPC64) += dma-iommu.o iommu.o
arch/powerpc/kernel/vmlinux.lds.S +1 -1
@@ -165,7 +165,7 @@ SECTIONS . = ALIGN(8); .dynsym : AT(ADDR(.dynsym) - LOAD_OFFSET) { -#ifdef CONFIG_RELOCATABLE_PPC32 +#ifdef CONFIG_PPC32 __dynamic_symtab = .; #endif *(.dynsym)
arch/powerpc/mm/init_32.c +1 -1
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(memstart_addr);phys_addr_t kernstart_addr;EXPORT_SYMBOL (kernstart_addr); -#ifdef CONFIG_RELOCATABLE_PPC32 +#ifdef CONFIG_RELOCATABLE /* Used in __va()/__pa() */ long long virt_phys_offset;EXPORT_SYMBOL (virt_phys_offset);
Signature · 1 line
2.8.1