The patch applys to ARM64 architecture and does not touch other arch code.

The attached patch increases KEXEC_SEGMENT_MAX from hardcoded value of 16 to 64. The patch was tested on an ARM64 (vm). This patch applies cleanly to 2.0.14-1 version of debian kexec-tools: https://pastebin.ubuntu.com/23969766/

[TESTING]
root@debian:/home/ubuntu/new# cat /proc/iomem
09000000-09000fff : /pl011@9000000
 09000000-09000fff : /pl011@9000000
09030000-09030fff : /pl061@9030000
0a003c00-0a003dff : a003c00.virtio_mmio
0a003e00-0a003fff : a003e00.virtio_mmio
10000000-3efeffff : /pcie@10000000
3f000000-3fffffff : PCI ECAM
40000000-ffffbfff : System RAM
 40080000-4094ffff : Kernel code
 40c80000-40e25fff : Kernel data
ffffc000-ffffffff : reserved
100000000-13858ffff : System RAM
138590000-13874ffff : reserved
138750000-13bc1ffff : System RAM
13bc20000-13bffffff : reserved
13c000000-13fffffff : System RAM
8000000000-ffffffffff : /pcie@10000000
root@debian:/home/ubuntu/new#

root@debian:/home/ubuntu/new# dpkg -l | grep kexec-tools
ii kexec-tools 1:2.0.14-1.1 arm64 tools to support fast kexec reboots
root@debian:/home/ubuntu/new#

root@debian:/home/ubuntu/new# kexec -d -l /boot/vmlinuz-4.9.0-1-arm64 --reuse-cmd --initrd=/boot/initrd.img-4.9.0-1-arm64 arch_process_options:141: command_line: root=UUID=010a5260-8c6d-444c-82cd-6cf9b0cbc120 ro quiet
arch_process_options:143: initrd: /boot/initrd.img-4.9.0-1-arm64
arch_process_options:144: dtb: (null)
Try gzip decompression.
kernel: 0xffff8201f010 kernel_size: 0xcffa00
get_memory_ranges_iomem_cb: 0000000040000000 - 00000000ffffbfff : System RAM get_memory_ranges_iomem_cb: 0000000100000000 - 000000013858ffff : System RAM get_memory_ranges_iomem_cb: 0000000138750000 - 000000013bc1ffff : System RAM get_memory_ranges_iomem_cb: 000000013c000000 - 000000013fffffff : System RAM
elf_arm64_probe: Not an ELF executable.
image_arm64_load: kernel_segment: 0000000040000000
image_arm64_load: text_offset:    0000000000080000
image_arm64_load: image_size:     0000000000da6000
image_arm64_load: phys_offset:    0000000040000000
image_arm64_load: vp_offset:      ffffffffffffffff
image_arm64_load: PE format:      yes
read_1st_dtb: found /sys/firmware/fdt

root@debian:/home/ubuntu/new# kexec -e

Message from syslogd@debian at Feb 10 17:42:22 ...
kernel:[  904.990897] kexec_core: Starting new kernel
[    0.464088] kvm [1]: HYP mode not available
/dev/vda2: recovering journal
/dev/vda2: clean, 45371/2342912 files, 556007/9368064 blocks

Debian GNU/Linux 9 debian ttyAMA0

debian login:


diff -Nru kexec-tools-2.0.14/debian/changelog kexec-tools-2.0.14/debian/changelog
--- kexec-tools-2.0.14/debian/changelog	2017-01-25 14:36:57.000000000 -0500
+++ kexec-tools-2.0.14/debian/changelog	2017-02-10 17:33:07.000000000 -0500
@@ -1,3 +1,9 @@
+kexec-tools (1:2.0.14-1.1) UNRELEASED; urgency=medium
+
+  * kexec: Increase the upper limit for RAM segments (Closes: #854826)
+
+ -- Manoj Iyer <manoj.i...@canonical.com>  Fri, 10 Feb 2017 17:33:07 -0500
+
 kexec-tools (1:2.0.14-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru kexec-tools-2.0.14/debian/patches/kexec-Increase-the-upper-limit-for-RAM-segments.patch kexec-tools-2.0.14/debian/patches/kexec-Increase-the-upper-limit-for-RAM-segments.patch
--- kexec-tools-2.0.14/debian/patches/kexec-Increase-the-upper-limit-for-RAM-segments.patch	1969-12-31 19:00:00.000000000 -0500
+++ kexec-tools-2.0.14/debian/patches/kexec-Increase-the-upper-limit-for-RAM-segments.patch	2017-02-10 17:32:40.000000000 -0500
@@ -0,0 +1,28 @@
+From 24aa2d93cac316657a2c20f28b8687bbf7e22991 Mon Sep 17 00:00:00 2001
+From: Sameer Goel <sg...@codeaurora.org>
+Date: Wed, 18 Jan 2017 16:15:12 -0700
+Subject: [PATCH] kexec: Increase the upper limit for RAM segments
+
+On a newer UEFI based Qualcomm target the number of system ram regions
+retrieved from /proc/iomem are ~40. So increasing the current hardcoded
+values to 64 from 16.
+
+Signed-off-by: Sameer Goel <sg...@codeaurora.org>
+Signed-off-by: Simon Horman <ho...@verge.net.au>
+---
+ kexec/arch/arm64/kexec-arm64.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: kexec-tools-2.0.14/kexec/arch/arm64/kexec-arm64.h
+===================================================================
+--- kexec-tools-2.0.14.orig/kexec/arch/arm64/kexec-arm64.h
++++ kexec-tools-2.0.14/kexec/arch/arm64/kexec-arm64.h
+@@ -11,7 +11,7 @@
+ #include "image-header.h"
+ #include "kexec.h"
+ 
+-#define KEXEC_SEGMENT_MAX 16
++#define KEXEC_SEGMENT_MAX 64
+ 
+ #define BOOT_BLOCK_VERSION 17
+ #define BOOT_BLOCK_LAST_COMP_VERSION 16
diff -Nru kexec-tools-2.0.14/debian/patches/series kexec-tools-2.0.14/debian/patches/series
--- kexec-tools-2.0.14/debian/patches/series	2017-01-25 14:36:57.000000000 -0500
+++ kexec-tools-2.0.14/debian/patches/series	2017-02-10 17:32:29.000000000 -0500
@@ -7,3 +7,4 @@
 const_string_warning.patch
 powerpcspe_support.patch
 arm64_build.patch
+kexec-Increase-the-upper-limit-for-RAM-segments.patch

Reply via email to