--- v10
+++ v5
@@ -1,27 +1,23 @@
-Hello,
-
-[ Andrew, you might want to wait until the kexec maintainers say whether
- they agree with patch 4 before picking up this version. ]
-
-v10 addresses two requests from Michael Ellerman: build the
-purgatory as a Position Independent Executable binary to reduce the
-number of relocation types that we have to deal with, and remove code
-that is not strictly necessary from the purgatory.
-
-The first objective is made possible by patch 4, which is new in this
-version and adds the support in generic code that arch-specific code
-needs if it wants to use a PIE purgatory. Now it's not necessary
-anymore to refactor code in module_64.c to reuse its implementation
-of the relocations.
-
-I also added a script which checks purgatory.ro and warns if it has
-a relocation type that is not supported.
-
-The second objective is met by removing code for printing messages
-to the console. Everything else that is in the purgatory is to implement
-the checksum verification of the kexec image.
-
-The gory details are in the detailed changelog at the end of this email.
+[ Andrew, since this series touches generic code, x86 and powerpc,
+ Michael Ellerman and Dave Young think it should go via your tree. ]
+
+The main differences in this version are (more detailed changelog at
+the end of this email):
+
+- The code which is not specific to loading ELF format kernels were
+ moved from kexec_elf_64.c to machine_kexec_64.c.
+
+- There is a new patch implementing support for receiving a device tree
+ blob from userspace, checking it against a whitelist of allowed nodes
+ and properties and copying it into the device tree for the next kernel.
+ This is the only patch that depends on the "extend kexec_file_load
+ system call" series. Everything else can be upstreamed independently
+ of that series.
+
+- Also, I realised that the patch "Add support for loading ELF kernels
+ with kexec_file_load." was too big, so I moved some changes to other
+ patches to facilitate review. Details of what went where are in the
+ changelog.
Original cover letter:
@@ -70,235 +66,169 @@
it to the kernel environment and facilities. Except the purgatory,
which only has minimal changes.
-Changes for v10:
-- Patch "kexec_file: Add support for purgatory built as PIE."
+Changes for v5:
+- Rebased series on v4.8-rc1 + the extend kexec_file_load series.
+- Patch "powerpc: Adapt elf64_apply_relocate_add for kexec_file_load."
+ - New patch. These changes were previously in patch 10.
+ The code itself is unchanged from v4.
+- Patch "powerpc: Implement kexec_file_load."
+ - Moved arch_kexec_walk_mem, arch_kexec_apply_relocations_add and
+ setup_purgatory from patch 10 to this patch.
+ - arch_kexec_apply_relocations_add is unchanged from v4.
+ - Fixed off-by-one error in arch_kexec_walk_mem when passing range
+ to func.
+ - Moved setup_purgatory from kexec_elf_64.c to machine_kexec_64.c,
+ and changed it to receive a pointer to the slave code directly
+ rather than a struct elf_info and getting the pointer from there.
+- Patch "powerpc: Add code to work with device trees in kexec_file_load."
+ - New patch. These changes were previously in patch 10.
+ - find_debug_console moved from kexec_elf_64.c to machine_kexec_64.c.
+ The code is unchanged from v4.
+ - setup_new_fdt is a new function factored out of elf64_load. The only
+ code change from v4 is to create /chosen if it doesn't exist yet.
+- Patch "powerpc: Add support for loading ELF kernels with kexec_file_load."
+ - This patch was too big, so moved some of its changes to other patches
+ to facilitate review.
+ - Allow loading ELF file type ET_DYN, which is what the BE kernel uses.
+ - The code adapting the device tree for booting the new kernel was moved
+ out of elf64_load to setup_new_fdt.
+- Patch "powerpc: Allow userspace to set device tree properties in kexec_file_load"
- New patch.
-- Patch "powerpc: Factor out relocation code in module_64.c"
- - Dropped patch from series.
-- Patch "powerpc: Implement kexec_file_load."
- - Made CONFIG_KEXEC_FILE select HAVE_KEXEC_FILE_PIE_PURGATORY.
- - Removed elf_my_r2 and elf_toc_section functions, they aren't necessary
- anymore.
- - Adapted arch_kexec_apply_relocations_add to the absolute addresses found
- in PIE binaries. Apply the relocations in this function instead of
- calling elf64_apply_relocate_add_item (which doesn't exist anymore).
- - No need to change module_64.c anymore.
- - Implemented R_PPC64_RELATIVE relocation.
-- Patch "powerpc: Add functions to read ELF files of any endianness."
- - Introduce <asm/elf_util.h> and elf_util.c in this patch.
-- Patch "powerpc: Add support for loading ELF kernels with kexec_file_load."
- - Define PURGATORY_ELF_TYPE macro in <asm/kexec.h>.
- - Removed debug argument from the setup_purgatory function.
- - Don't call find_debug_console in elf64_load anymore.
- - Removed function find_debug_console.
- - Find the TOC address by looking for the .got section in setup_purgatory.
- - Don't set the "debug" purgatory symbol (which doesn't exist anymore) in
- setup_purgatory.
-- Patch "powerpc: Add purgatory for kexec_file_load implementation."
- - Don't change boot/string.S.
- - Build purgatory as a PIE binary and suppress generation of the INTERP
- segment, which is not meaningful in this case.
- - Add check-purgatory-relocs.sh and call it after building purgatory.ro.
- - Removed console-ppc64.c, hvCall.S, ppc64_asm.h and printf.c.
- - Moved inclusion of <linux/compiler.h> from purgatory.h to
- purgatory-ppc64.c.
- - Removed "debug" global variable from purgatory-ppc64.c.
- - Removed inclusion of "../boot/string.h" from purgatory.c.
- - Removed printf calls from purgatory.c.
- - Included <linux/types.h>, added prototype for memcmp and removed
- prototypes for putchar, sprintf and printf in purgatory.h.
- - Added string.c with code copied from lib/string.c.
- - Removed inclusion of "ppc64_asm.h" and use of DOTSYM macro from v2wrap.S.
-
-Changes for v9:
-- Rebased on top of v4.9-rc1
-- Patch "powerpc: Change places using CONFIG_KEXEC to use CONFIG_KEXEC_CORE instead."
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
-- Patch "powerpc: Factor out relocation code from module_64.c to elf_util_64.c."
- - Retitled to "powerpc: Factor out relocation code in module_64.c"
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
- - Put relocation code in function elf64_apply_relocate_add_item in
- module_64.c itself instead of moving it to elf_util_64.c.
- - Only factored out the switch statement to apply the relocations
- instead of the whole logic to iterate through all of the relocations.
- - There's no elf_util_64.c anymore.
- - Doesn't change <asm/module.h> anymore.
- - Doesn't change arch/powerpc/kernel/Makefile anymore.
- - Moved creation of <asm/elf_util.h> to patch "Implement kexec_file_load."
-- Patch "powerpc: Generalize elf64_apply_relocate_add."
- - Dropped patch from series.
- - Moved changes adding address variable to patch "powerpc: Implement
- kexec_file_load."
-- Patch "powerpc: Adapt elf64_apply_relocate_add for kexec_file_load."
- - Dropped patch from series.
- - Moved new relocs needed by the purgatory to patch "powerpc: Implement
- kexec_file_load."
-- Patch "powerpc: Implement kexec_file_load."
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
- - Put code in a new file machine_kexec_file_64.c instead of adding it to
- machine_kexec_64.c.
- - arch_kexec_apply_relocations_add now has the for loop which was
- previously factored out in elf64_apply_relocate_add.
- - Moved definition of setup_purgatory to "powerpc: Add support for
- loading ELF kernels with kexec_file_load.".
- - Introduce <asm/elf_util.h> and elf_util.c in this patch.
- - Only build elf_util.c if CONFIG_KEXEC_FILE=y.
- - Renamed my_r2 to elf_my_r2 and changed it to receive a pointer to
- struct elf_shdr instead of struct elf_info.
- - Added toc_section function.
- - Removed elf_init_elf_info function.
-- Patch "powerpc: Add functions to read ELF files of any endianness."
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
- - Introduce struct elf_info in this patch.
- - Removed stubs_section and toc_section from struct elf_info.
- - Doesn't change arch/powerpc/kernel/Makefile anymore.
-- Patch "powerpc: Add code to work with device trees in kexec_file_load."
- - Squashed into "powerpc: Add support for loading ELF kernels with
- kexec_file_load.". The code is unchanged.
-- Patch "powerpc: Add support for loading ELF kernels with kexec_file_load."
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
- - Fixed uninitialized variable warning when building with GCC 4.6.3.
- - Don't create <asm/kexec_elf_64.h> anymore, put declaration of
- kexec_el_64_ops in <asm/kexec.h> instead.
- - Removed unused extern declaration of kexec_purgatory_size.
- - Made elf64_load static.
- - Factor out delete_fdt_mem_rsv from setup_new_fdt. This change was in
- the patch series for preserving IMA measurements accross kexec.
-- Patch "powerpc: Add purgatory for kexec_file_load implementation."
- - Fixed conflict with patch renaming CONFIG_WORD_SIZE to BITS.
- - Changed purgatory Makefile to use the kernel KBUILD_CFLAGS, filtering
- out the flags for ftrace. (Michael Ellerman)
- - Added extern declaration of the debug global variable to purgatory.h and
- included it in console-ppc64.c to fix checkpatch.pl warning.
- - Added __section attribute to global variables in purgatory-ppc64.c and
- don't initialize them to zero, to fix checkpatch.pl warning.
- - Fixed type of debug global variable to int instead of unsigned int.
- - Included <linux/compiler.h> in purgatory.h and use __printf macro to
- fix checkpatch.pl warning.
- - Removed crashdump-ppc64.h, crashdump_backup.c and purgatory-ppc64.h.
-
-Changes for v8:
-- Rebased on top of v4.8-rc5.
-- Patch "powerpc: Add purgatory for kexec_file_load implementation."
- - Fix cross build from ppc64 LE to BE and vice-versa.
- - Don't build the purgatory during archprepare.
-
-Changes for v7:
-- Rebased on top of v4.8-rc4.
-- Patch "powerpc: Change places using CONFIG_KEXEC to use CONFIG_KEXEC_CORE
- instead."
- - New patch. Fixes build when CONFIG_KEXEC=n and CONFIG_KEXEC_FILE=y.
-- Patch "powerpc: Adapt elf64_apply_relocate_add for kexec_file_load."
- - Fixed checkpatch warning "else is not generally useful after a break
- or return".
- - Fixed checkpatch warnings about line length. (Andrew Morton)
-- Patch "powerpc: Add code to work with device trees in kexec_file_load."
- - Remove space before tabs in doc comment for setup_new_fdt. (Andrew Morton)
- - Fixed checkpatch warnings about line length.
-- Patch "powerpc: Add support for loading ELF kernels with kexec_file_load."
- - Removed duplicate #include <linux/kexec.h>.
-
-Changes for v6:
-- Based directly on top of v4.8-rc1.
-- Patch "powerpc: Adapt elf64_apply_relocate_add for kexec_file_load."
- - Allow undefined symbols if they are relocations for the TOC in the
- big endian ABI.
- - Fixed build error in this patch by adding the ehdr member to elf_info
- here instead of in the next patch.
- - Initialize elf_info.ehdr in module_64.c:module_frob_arch_sections.
-- Patch "powerpc: Add code to work with device trees in kexec_file_load."
- - Changed find_debug_console to look for /chosen instead of receiving
- its offset as an argument.
- - setup_new_fdt: no need to find /chosen again after deleting the memory
- reservation for initrd.
-- Patch "powerpc: Add support for loading ELF kernels with kexec_file_load."
- - Don't pass the offset to /chosen to find_debug_console.
-- Patch "powerpc: Allow userspace to set device tree properties in kexec_file_load"
- - Dropped patch.
-- Patch "powerpc: Add purgatory for kexec_file_load implementation."
- - Make boot/string.S use the DOTSYM macro so that it can be
- used by the ppc64 big endian purgatory.
- - Use -mcall-aixdesc to compile the purgatory on big endian ppc64.
-
-Thiago Jung Bauermann (10):
+ - The code in this patch didn't exist in v4.
+ - This is the only patch that depends on the extend kexec_file_load series.
+- Patch "powerpc: Enable CONFIG_KEXEC_FILE in powerpc server defconfigs."
+ - New patch.
+
+Changes for v4:
+- Rebased series on today's powerpc/next.
+- Patch "kexec_file: Remove unused members from struct kexec_buf.":
+ - Dropped from the series.
+- Patch "kexec_file: Allow arch-specific memory walking function for
+ kexec_add_buffer":
+ - Changed subject line to be more specific. Was: "kexec_file: Generalize
+ kexec_add_buffer.".
+ - Changed description to refer to x86 arch instead of Intel arch.
+ - Moved documentation comments for struct kexec_buf to this patch.
+- Patch "kexec_file: Change kexec_add_buffer to take kexec_buf as argument.":
+ - New patch.
+- Patch "kexec_file: Factor out kexec_locate_mem_hole from kexec_add_buffer.":
+ - Changed kexec_locate_mem_hole to take kexec_buf as argument.
+ - Improved description of kexec_locate_mem_hole in documentation comment.
+
+Changes for v3:
+- Rebased series on today's powerpc/next.
+- Patch "kexec_file: Generalize kexec_add_buffer.":
+ - Removed most arguments from arch_kexec_walk_mem and pass kbuf
+ explicitly.
+- Patch "powerpc: Add functions to read ELF files of any endianness.":
+ - Fixed whitespace issues found by checkpatch.pl.
+- Patch "powerpc: Factor out relocation code from module_64.c to
+ elf_util_64.c.":
+ - Changed to use the new PPC64_ELF_ABI_v2 macro.
+- Patch "powerpc: Add support for loading ELF kernels with
+ kexec_file_load.":
+ - Adapted arch_kexec_walk_mem implementation to changes in its
+ argument list.
+ - Fixed whitespace and GPL header issues found by checkpatch.pl.
+- Patch "powerpc: Add purgatory for kexec_file_load implementation.":
+ - Fixed whitespace and GPL header issues found by checkpatch.pl.
+ - Changed to use the new PPC64_ELF_ABI_v2 macro.
+
+Changes for v2:
+- All patches: forgot to add Signed-off-by lines in v1, so added them now.
+- Patch "kexec_file: Generalize kexec_add_buffer.": broke in two, one
+ adding arch_kexec_walk_mem and the other adding kexec_locate_mem_hole.
+- Patch "powerpc: Implement kexec_file_load.":
+ - Moved relocation changes and the arch_kexec_walk_mem implementation
+ to the next patch in the series.
+ - Removed pr_fmt from machine_kexec_64.c, since the patch doesn't add
+ any call to pr_debug in that file.
+ - Changed arch_kexec_kernel_image_probe to reject crash kernels.
+
+
+Thiago Jung Bauermann (13):
kexec_file: Allow arch-specific memory walking for kexec_add_buffer
kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
kexec_file: Factor out kexec_locate_mem_hole from kexec_add_buffer.
- kexec_file: Add support for purgatory built as PIE.
- powerpc: Change places using CONFIG_KEXEC to use CONFIG_KEXEC_CORE
- instead.
+ powerpc: Factor out relocation code from module_64.c to elf_util_64.c.
+ powerpc: Generalize elf64_apply_relocate_add.
+ powerpc: Adapt elf64_apply_relocate_add for kexec_file_load.
+ powerpc: Add functions to read ELF files of any endianness.
powerpc: Implement kexec_file_load.
- powerpc: Add functions to read ELF files of any endianness.
+ powerpc: Add code to work with device trees in kexec_file_load.
powerpc: Add support for loading ELF kernels with kexec_file_load.
+ powerpc: Allow userspace to set device tree properties in
+ kexec_file_load
powerpc: Add purgatory for kexec_file_load implementation.
powerpc: Enable CONFIG_KEXEC_FILE in powerpc server defconfigs.
- arch/Kconfig | 11 +
- arch/powerpc/Kconfig | 16 +-
- arch/powerpc/Makefile | 1 +
- arch/powerpc/configs/powernv_defconfig | 2 +
- arch/powerpc/configs/ppc64_defconfig | 2 +
- arch/powerpc/configs/pseries_defconfig | 2 +
- arch/powerpc/include/asm/debug.h | 2 +-
- arch/powerpc/include/asm/elf_util.h | 43 ++
- arch/powerpc/include/asm/kexec.h | 18 +-
- arch/powerpc/include/asm/machdep.h | 4 +-
- arch/powerpc/include/asm/smp.h | 2 +-
- arch/powerpc/include/asm/systbl.h | 1 +
- arch/powerpc/include/asm/unistd.h | 2 +-
- arch/powerpc/include/uapi/asm/unistd.h | 1 +
- arch/powerpc/kernel/Makefile | 6 +-
- arch/powerpc/kernel/elf_util.c | 437 +++++++++++++++++++
- arch/powerpc/kernel/head_64.S | 2 +-
- arch/powerpc/kernel/kexec_elf_64.c | 279 ++++++++++++
- arch/powerpc/kernel/machine_kexec_file_64.c | 578 +++++++++++++++++++++++++
- arch/powerpc/kernel/misc_32.S | 2 +-
- arch/powerpc/kernel/misc_64.S | 6 +-
- arch/powerpc/kernel/prom.c | 2 +-
- arch/powerpc/kernel/setup_64.c | 4 +-
- arch/powerpc/kernel/smp.c | 6 +-
- arch/powerpc/kernel/traps.c | 2 +-
- arch/powerpc/platforms/85xx/corenet_generic.c | 2 +-
- arch/powerpc/platforms/85xx/smp.c | 8 +-
- arch/powerpc/platforms/cell/spu_base.c | 2 +-
- arch/powerpc/platforms/powernv/setup.c | 6 +-
- arch/powerpc/platforms/ps3/setup.c | 4 +-
- arch/powerpc/platforms/pseries/Makefile | 2 +-
- arch/powerpc/platforms/pseries/setup.c | 4 +-
- arch/powerpc/purgatory/.gitignore | 2 +
- arch/powerpc/purgatory/Makefile | 40 ++
- arch/powerpc/purgatory/crtsavres.S | 5 +
- arch/powerpc/purgatory/kexec-sha256.h | 11 +
- arch/powerpc/purgatory/purgatory-ppc64.c | 36 ++
- arch/powerpc/purgatory/purgatory.c | 48 ++
- arch/powerpc/purgatory/purgatory.h | 10 +
- arch/powerpc/purgatory/sha256.c | 6 +
- arch/powerpc/purgatory/sha256.h | 1 +
- arch/powerpc/purgatory/string.c | 60 +++
- arch/powerpc/purgatory/v2wrap.S | 132 ++++++
- arch/powerpc/scripts/check-purgatory-relocs.sh | 47 ++
- arch/x86/kernel/crash.c | 37 +-
- arch/x86/kernel/kexec-bzimage64.c | 48 +-
- include/linux/kexec.h | 40 +-
- kernel/kexec_file.c | 413 +++++++++++++-----
- kernel/kexec_internal.h | 16 -
- 49 files changed, 2197 insertions(+), 214 deletions(-)
+ arch/powerpc/Kconfig | 13 +
+ arch/powerpc/Makefile | 4 +
+ arch/powerpc/configs/powernv_defconfig | 2 +
+ arch/powerpc/configs/ppc64_defconfig | 2 +
+ arch/powerpc/configs/pseries_defconfig | 2 +
+ arch/powerpc/include/asm/elf_util.h | 92 ++++
+ arch/powerpc/include/asm/kexec.h | 11 +
+ arch/powerpc/include/asm/kexec_elf_64.h | 10 +
+ arch/powerpc/include/asm/module.h | 14 +-
+ arch/powerpc/include/asm/systbl.h | 1 +
+ arch/powerpc/include/asm/unistd.h | 2 +-
+ arch/powerpc/include/uapi/asm/unistd.h | 1 +
+ arch/powerpc/kernel/Makefile | 7 +
+ arch/powerpc/kernel/elf_util.c | 476 ++++++++++++++++++++
+ arch/powerpc/kernel/elf_util_64.c | 374 ++++++++++++++++
+ arch/powerpc/kernel/kexec_elf_64.c | 291 ++++++++++++
+ arch/powerpc/kernel/machine_kexec_64.c | 719 ++++++++++++++++++++++++++++++
+ arch/powerpc/kernel/module_64.c | 328 ++------------
+ arch/powerpc/purgatory/.gitignore | 2 +
+ arch/powerpc/purgatory/Makefile | 36 ++
+ arch/powerpc/purgatory/console-ppc64.c | 38 ++
+ arch/powerpc/purgatory/crashdump-ppc64.h | 42 ++
+ arch/powerpc/purgatory/crashdump_backup.c | 36 ++
+ arch/powerpc/purgatory/crtsavres.S | 5 +
+ arch/powerpc/purgatory/hvCall.S | 27 ++
+ arch/powerpc/purgatory/hvCall.h | 8 +
+ arch/powerpc/purgatory/kexec-sha256.h | 11 +
+ arch/powerpc/purgatory/ppc64_asm.h | 20 +
+ arch/powerpc/purgatory/printf.c | 164 +++++++
+ arch/powerpc/purgatory/purgatory-ppc64.c | 41 ++
+ arch/powerpc/purgatory/purgatory-ppc64.h | 6 +
+ arch/powerpc/purgatory/purgatory.c | 62 +++
+ arch/powerpc/purgatory/purgatory.h | 11 +
+ arch/powerpc/purgatory/sha256.c | 6 +
+ arch/powerpc/purgatory/sha256.h | 1 +
+ arch/powerpc/purgatory/string.S | 1 +
+ arch/powerpc/purgatory/v2wrap.S | 134 ++++++
+ arch/x86/kernel/crash.c | 37 +-
+ arch/x86/kernel/kexec-bzimage64.c | 48 +-
+ include/linux/kexec.h | 33 +-
+ kernel/kexec_file.c | 141 +++---
+ kernel/kexec_internal.h | 16 -
+ 42 files changed, 2869 insertions(+), 406 deletions(-)
create mode 100644 arch/powerpc/include/asm/elf_util.h
+ create mode 100644 arch/powerpc/include/asm/kexec_elf_64.h
create mode 100644 arch/powerpc/kernel/elf_util.c
+ create mode 100644 arch/powerpc/kernel/elf_util_64.c
create mode 100644 arch/powerpc/kernel/kexec_elf_64.c
- create mode 100644 arch/powerpc/kernel/machine_kexec_file_64.c
create mode 100644 arch/powerpc/purgatory/.gitignore
create mode 100644 arch/powerpc/purgatory/Makefile
+ create mode 100644 arch/powerpc/purgatory/console-ppc64.c
+ create mode 100644 arch/powerpc/purgatory/crashdump-ppc64.h
+ create mode 100644 arch/powerpc/purgatory/crashdump_backup.c
create mode 100644 arch/powerpc/purgatory/crtsavres.S
+ create mode 100644 arch/powerpc/purgatory/hvCall.S
+ create mode 100644 arch/powerpc/purgatory/hvCall.h
create mode 100644 arch/powerpc/purgatory/kexec-sha256.h
+ create mode 100644 arch/powerpc/purgatory/ppc64_asm.h
+ create mode 100644 arch/powerpc/purgatory/printf.c
create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.c
+ create mode 100644 arch/powerpc/purgatory/purgatory-ppc64.h
create mode 100644 arch/powerpc/purgatory/purgatory.c
create mode 100644 arch/powerpc/purgatory/purgatory.h
create mode 100644 arch/powerpc/purgatory/sha256.c
create mode 100644 arch/powerpc/purgatory/sha256.h
- create mode 100644 arch/powerpc/purgatory/string.c
+ create mode 100644 arch/powerpc/purgatory/string.S
create mode 100644 arch/powerpc/purgatory/v2wrap.S
- create mode 100755 arch/powerpc/scripts/check-purgatory-relocs.sh
--
-2.7.4
+1.9.1