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

sh: kexec: Add PHYSICAL_START

Add PHYSICAL_START kernel configuration parameter to set the address at
which the kernel should be loaded.

It has been observed on an sh7757lcr that simply modifying MEMORY_START
does not achieve this goal for 32bit sh. This is due to MEMORY_OFFSET in
arch/sh/kernel/vmlinux.lds.S bot being based on MEMORY_START on such
systems.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Simon Horman and committed by
Paul Mundt
e66ac3f2 d11584a0

+31 -8
+12 -1
arch/sh/Kconfig
··· 645 645 a specially reserved region and then later executed after 646 646 a crash by kdump/kexec. The crash dump kernel must be compiled 647 647 to a memory address not used by the main kernel using 648 - MEMORY_START. 648 + PHYSICAL_START. 649 649 650 650 For more details see Documentation/kdump/kdump.txt 651 651 ··· 655 655 help 656 656 Jump between original kernel and kexeced kernel and invoke 657 657 code via KEXEC 658 + 659 + config PHYSICAL_START 660 + hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP) 661 + default MEMORY_START 662 + ---help--- 663 + This gives the physical address where the kernel is loaded 664 + and is ordinarily the same as MEMORY_START. 665 + 666 + Different values are primarily used in the case of kexec on panic 667 + where the fail safe kernel needs to run at a different address 668 + than the panic-ed kernel. 658 669 659 670 config SECCOMP 660 671 bool "Enable seccomp to safely compute untrusted bytecode"
+4 -2
arch/sh/boot/Makefile
··· 19 19 CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 20 20 CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 21 21 CONFIG_ENTRY_OFFSET ?= 0x00001000 22 + CONFIG_PHYSICAL_START ?= $(CONFIG_MEMORY_START) 22 23 23 24 suffix-y := bin 24 25 suffix-$(CONFIG_KERNEL_GZIP) := gz ··· 49 48 $(Q)$(MAKE) $(build)=$(obj)/romimage $@ 50 49 51 50 KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \ 52 - $$[$(CONFIG_MEMORY_START) & 0x1fffffff]') 51 + $$[$(CONFIG_PHYSICAL_START) & 0x1fffffff]') 53 52 54 53 KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \ 55 54 $$[$(CONFIG_PAGE_OFFSET) + \ ··· 115 114 @echo ' Image $@ is ready' 116 115 117 116 export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \ 118 - CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY suffix-y 117 + CONFIG_PHYSICAL_START CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET \ 118 + KERNEL_MEMORY suffix-y
+10
arch/sh/include/asm/page.h
··· 113 113 #define __MEMORY_SIZE CONFIG_MEMORY_SIZE 114 114 115 115 /* 116 + * PHYSICAL_OFFSET is the offset in physical memory where the base 117 + * of the kernel is loaded. 118 + */ 119 + #ifdef CONFIG_PHYSICAL_START 120 + #define PHYSICAL_OFFSET (CONFIG_PHYSICAL_START - __MEMORY_START) 121 + #else 122 + #define PHYSICAL_OFFSET 0 123 + #endif 124 + 125 + /* 116 126 * PAGE_OFFSET is the virtual address of the start of kernel address 117 127 * space. 118 128 */
+1 -1
arch/sh/kernel/vmlinux.lds.S
··· 23 23 ENTRY(_start) 24 24 SECTIONS 25 25 { 26 - . = PAGE_OFFSET + MEMORY_OFFSET + CONFIG_ZERO_PAGE_OFFSET; 26 + . = PAGE_OFFSET + MEMORY_OFFSET + PHYSICAL_OFFSET + CONFIG_ZERO_PAGE_OFFSET; 27 27 28 28 _text = .; /* Text and read-only data */ 29 29
+4 -4
arch/sh/mm/init.c
··· 287 287 static void __init early_reserve_mem(void) 288 288 { 289 289 unsigned long start_pfn; 290 + u32 zero_base = (u32)__MEMORY_START + (u32)PHYSICAL_OFFSET; 291 + u32 start = zero_base + (u32)CONFIG_ZERO_PAGE_OFFSET; 290 292 291 293 /* 292 294 * Partially used pages are not usable - thus ··· 302 300 * this catches the (definitely buggy) case of us accidentally 303 301 * initializing the bootmem allocator with an invalid RAM area. 304 302 */ 305 - memblock_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, 306 - (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) - 307 - (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET)); 303 + memblock_reserve(start, (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) - start); 308 304 309 305 /* 310 306 * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. 311 307 */ 312 308 if (CONFIG_ZERO_PAGE_OFFSET != 0) 313 - memblock_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET); 309 + memblock_reserve(zero_base, CONFIG_ZERO_PAGE_OFFSET); 314 310 315 311 /* 316 312 * Handle additional early reservations