arm64 kexec-tools patches
Subsystems (2)
v2 cover arm64 kexec-tools patches
This series adds the core support for kexec re-boot on ARM64.
Linux kernel support for kexec reboot [1] has been merged to the ARM64 for-next/core branch with the expectation that it will be included in the v4.8 stable kernel release.
For ARM64 kdump support see Takahiro's patches [2].
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-June/438780.html
[2] http://lists.infradead.org/pipermail/kexec/2016-July/016642.html
Changes for v2 (July 26, 2016, 0m):
o Inline some small routines.
o Reformat some dbgprintf messages.
o Remove debug_brk from entry.S
o Change arm64_image_header.flags to uint64_t.
o Look in iomem then dt for mem info.
o Remove check_cpu_nodes.
o Remove purgatory printing.
First submission v1 (July 20, 2016).
-Geoff
The following changes since commit 8d614008609f6ad5d09263767ebc771e06a173f0:
arm: use zImage size from header (2016-07-15 13:12:28 +0900)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kexec-tools.git for-merge-arm64-v2
for you to fetch changes up to f352dcfc827a4cbb3878dd1043877a4154b1bd08:
arm64: Add support for binary image files (2016-07-26 11:48:01 -0700)
----------------------------------------------------------------
AKASHI Takahiro (1):
kexec: (bugfix) calc correct end address of memory ranges in device tree
Geoff Levand (2):
kexec: Add common device tree routines
arm64: Add arm64 kexec support
Pratyush Anand (1):
arm64: Add support for binary image files
configure.ac | 3 + kexec/Makefile | 5 + kexec/arch/arm64/Makefile | 40 ++ kexec/arch/arm64/crashdump-arm64.c | 21 + kexec/arch/arm64/crashdump-arm64.h | 12 + kexec/arch/arm64/image-header.h | 98 +++++ kexec/arch/arm64/include/arch/options.h | 39 ++ kexec/arch/arm64/kexec-arm64.c | 704 ++++++++++++++++++++++++++++++++ kexec/arch/arm64/kexec-arm64.h | 70 ++++ kexec/arch/arm64/kexec-elf-arm64.c | 130 ++++++ kexec/arch/arm64/kexec-image-arm64.c | 63 +++ kexec/dt-ops.c | 139 +++++++ kexec/dt-ops.h | 13 + kexec/fs2dt.c | 5 +- kexec/kexec-syscall.h | 8 +- purgatory/Makefile | 1 + purgatory/arch/arm64/Makefile | 18 + purgatory/arch/arm64/entry.S | 51 +++ purgatory/arch/arm64/purgatory-arm64.c | 19 + 19 files changed, 1435 insertions(+), 4 deletions(-) create mode 100644 kexec/arch/arm64/Makefile create mode 100644 kexec/arch/arm64/crashdump-arm64.c create mode 100644 kexec/arch/arm64/crashdump-arm64.h create mode 100644 kexec/arch/arm64/image-header.h create mode 100644 kexec/arch/arm64/include/arch/options.h create mode 100644 kexec/arch/arm64/kexec-arm64.c create mode 100644 kexec/arch/arm64/kexec-arm64.h create mode 100644 kexec/arch/arm64/kexec-elf-arm64.c create mode 100644 kexec/arch/arm64/kexec-image-arm64.c create mode 100644 kexec/dt-ops.c create mode 100644 kexec/dt-ops.h create mode 100644 purgatory/arch/arm64/Makefile create mode 100644 purgatory/arch/arm64/entry.S create mode 100644 purgatory/arch/arm64/purgatory-arm64.c
Signature · 7 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 1/4 kexec: (bugfix) calc correct end address of memory ranges in device tree
From: AKASHI Takahiro <[email protected]>
The end address of "reg" attribute in device tree's memory should be inclusive.
From: AKASHI Takahiro <[email protected]>
--- kexec/fs2dt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kexec/fs2dt.c +3 -2
@@ -236,7 +236,8 @@ static void add_dyn_reconf_usable_mem_property__(int fd) ranges_size*8); } ranges[rlen++] =cpu_to_be64 (loc_base); - ranges[rlen++] =cpu_to_be64 (loc_end - loc_base); + ranges[rlen++] =cpu_to_be64 (loc_end + - loc_base +1 ); rngs_cnt++; } }
@@ -350,7 +351,7 @@ static void add_usable_mem_property(int fd, size_t len) ranges_size*sizeof(*ranges)); } ranges[rlen++] =cpu_to_be64 (loc_base); - ranges[rlen++] =cpu_to_be64 (loc_end - loc_base); + ranges[rlen++] =cpu_to_be64 (loc_end - loc_base +1 ); } }
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 2/4 kexec: Add common device tree routines
In reply to Geoff LevandCommon device tree routines that can be shared between all arches that have device tree support.
--- kexec/Makefile | 4 ++ kexec/dt-ops.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ kexec/dt-ops.h | 13 ++++++ 3 files changed, 156 insertions(+) create mode 100644 kexec/dt-ops.c create mode 100644 kexec/dt-ops.h
kexec/Makefile +4 -0
@@ -73,6 +73,10 @@ dist += kexec/mem_regions.c kexec/mem_regions.h $(ARCH)_MEM_REGIONS = KEXEC_SRCS += $($(ARCH)_MEM_REGIONS) +dist += kexec/dt-ops.c kexec/dt-ops.h +$(ARCH)_DT_OPS = +KEXEC_SRCS += $($(ARCH)_DT_OPS) + include $(srcdir)/kexec/arch/alpha/Makefile include $(srcdir)/kexec/arch/arm/Makefile include $(srcdir)/kexec/arch/i386/Makefile
kexec/dt-ops.c new file +139 -0
139 lines not on this page · raw message
kexec/dt-ops.h new file +13 -0
@@ -0,0 +1,13 @@ +#if !defined(KEXEC_DT_OPS_H ) +#define KEXEC_DT_OPS_H + +#include <sys/types.h> + +int dtb_set_initrd (char **dtb,off_t *dtb_size,off_t start,off_t end); +int dtb_set_bootargs (char **dtb,off_t *dtb_size,const char *command_line); +int dtb_set_property (char **dtb,off_t *dtb_size,const char *node, +const char *prop,const void *value,int value_len); + +int dtb_delete_property (char *dtb,const char *node,const char *prop); + +#endif
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 3/4 arm64: Add arm64 kexec support
In reply to Geoff LevandAdd kexec reboot support for ARM64 platforms.
--- configure.ac | 3 + kexec/Makefile | 1 + kexec/arch/arm64/Makefile | 40 ++ kexec/arch/arm64/crashdump-arm64.c | 21 + kexec/arch/arm64/crashdump-arm64.h | 12 + kexec/arch/arm64/image-header.h | 98 +++++ kexec/arch/arm64/include/arch/options.h | 39 ++ kexec/arch/arm64/kexec-arm64.c | 704 ++++++++++++++++++++++++++++++++ kexec/arch/arm64/kexec-arm64.h | 70 ++++ kexec/arch/arm64/kexec-elf-arm64.c | 130 ++++++ kexec/arch/arm64/kexec-image-arm64.c | 44 ++ kexec/kexec-syscall.h | 8 +- purgatory/Makefile | 1 + purgatory/arch/arm64/Makefile | 18 + purgatory/arch/arm64/entry.S | 51 +++ purgatory/arch/arm64/purgatory-arm64.c | 19 + 16 files changed, 1257 insertions(+), 2 deletions(-) create mode 100644 kexec/arch/arm64/Makefile create mode 100644 kexec/arch/arm64/crashdump-arm64.c create mode 100644 kexec/arch/arm64/crashdump-arm64.h create mode 100644 kexec/arch/arm64/image-header.h create mode 100644 kexec/arch/arm64/include/arch/options.h create mode 100644 kexec/arch/arm64/kexec-arm64.c create mode 100644 kexec/arch/arm64/kexec-arm64.h create mode 100644 kexec/arch/arm64/kexec-elf-arm64.c create mode 100644 kexec/arch/arm64/kexec-image-arm64.c create mode 100644 purgatory/arch/arm64/Makefile create mode 100644 purgatory/arch/arm64/entry.S create mode 100644 purgatory/arch/arm64/purgatory-arm64.c
configure.ac +3 -0
@@ -34,6 +34,9 @@ case $target_cpu in ARCH="ppc64" SUBARCH="LE" ;; + aarch64* ) + ARCH="arm64" + ;; arm* ) ARCH="arm" ;;
kexec/Makefile +1 -0
@@ -79,6 +79,7 @@ KEXEC_SRCS += $($(ARCH)_DT_OPS) include $(srcdir)/kexec/arch/alpha/Makefile include $(srcdir)/kexec/arch/arm/Makefile +include $(srcdir)/kexec/arch/arm64/Makefile include $(srcdir)/kexec/arch/i386/Makefile include $(srcdir)/kexec/arch/ia64/Makefile include $(srcdir)/kexec/arch/m68k/Makefile
kexec/arch/arm64/Makefile new file +40 -0
@@ -0,0 +1,40 @@ + +arm64_FS2DT += kexec/fs2dt.c +arm64_FS2DT_INCLUDE += -include $(srcdir)/kexec/arch/arm64/kexec-arm64.h \ + -include $(srcdir)/kexec/arch/arm64/crashdump-arm64.h + +arm64_DT_OPS += kexec/dt-ops.c + +arm64_CPPFLAGS += -I $(srcdir)/kexec/ + +arm64_KEXEC_SRCS += \ + kexec/arch/arm64/kexec-arm64.c \ + kexec/arch/arm64/kexec-image-arm64.c \ + kexec/arch/arm64/kexec-elf-arm64.c \ + kexec/arch/arm64/crashdump-arm64.c + +arm64_ARCH_REUSE_INITRD = +arm64_ADD_SEGMENT = +arm64_VIRT_TO_PHYS = +arm64_PHYS_TO_VIRT = + +dist += $(arm64_KEXEC_SRCS) \ + kexec/arch/arm64/Makefile \ + kexec/arch/arm64/kexec-arm64.h \ + kexec/arch/arm64/crashdump-arm64.h + +ifdef HAVE_LIBFDT + +LIBS += -lfdt + +else + +include $(srcdir)/kexec/libfdt/Makefile.libfdt + +libfdt_SRCS += $(LIBFDT_SRCS:%=kexec/libfdt/%) + +arm64_CPPFLAGS += -I$(srcdir)/kexec/libfdt + +arm64_KEXEC_SRCS += $(libfdt_SRCS) + +endif
kexec/arch/arm64/crashdump-arm64.c new file +21 -0
@@ -0,0 +1,21 @@ +/* +* ARM64 crashdump. +*/ + +#define _GNU_SOURCE + +#include <errno.h> +#include <linux/elf.h> + +#include "kexec.h" +#include "crashdump.h" +#include "crashdump-arm64.h" +#include "kexec-arm64.h" +#include "kexec-elf.h" + +struct memory_ranges usablemem_rgns = {}; + +int is_crashkernel_mem_reserved (void ) +{ +return 0 ; +}
kexec/arch/arm64/crashdump-arm64.h new file +12 -0
@@ -0,0 +1,12 @@ +/* +* ARM64 crashdump. +*/ + +#if !defined(CRASHDUMP_ARM64_H ) +#define CRASHDUMP_ARM64_H + +#include "kexec.h" + +extern struct memory_ranges usablemem_rgns; + +#endif
kexec/arch/arm64/image-header.h new file +98 -0
98 lines not on this page · raw message
kexec/arch/arm64/include/arch/options.h new file +39 -0
@@ -0,0 +1,39 @@ +#if !defined(KEXEC_ARCH_ARM64_OPTIONS_H ) +#define KEXEC_ARCH_ARM64_OPTIONS_H + +#define OPT_APPEND ((OPT_MAX)+0) +#define OPT_DTB ((OPT_MAX)+1) +#define OPT_INITRD ((OPT_MAX)+2) +#define OPT_REUSE_CMDLINE ((OPT_MAX)+4) +#define OPT_ARCH_MAX ((OPT_MAX)+5) + +#define KEXEC_ARCH_OPTIONS \ + KEXEC_OPTIONS \ + { "append", 1, NULL, OPT_APPEND }, \ + { "command-line", 1, NULL, OPT_APPEND }, \ + { "dtb", 1, NULL, OPT_DTB }, \ + { "initrd", 1, NULL, OPT_INITRD }, \ + { "ramdisk", 1, NULL, OPT_INITRD }, \ + { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE }, \ + +#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR/* Only accept long arch options. */ +#define KEXEC_ALL_OPTIONS KEXEC_ARCH_OPTIONS +#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR + +static const char arm64_opts_usage[] __attribute__ ((unused)) = +" --append=STRING Set the kernel command line to STRING.\n" +" --command-line=STRING Set the kernel command line to STRING.\n" +" --dtb=FILE Use FILE as the device tree blob.\n" +" --initrd=FILE Use FILE as the kernel initial ramdisk.\n" +" --ramdisk=FILE Use FILE as the kernel initial ramdisk.\n" +" --reuse-cmdline Use kernel command line from running system.\n" ; + +struct arm64_opts { +const char *command_line; +const char *dtb; +const char *initrd; +}; + +extern struct arm64_opts arm64_opts; + +#endif
kexec/arch/arm64/kexec-arm64.c new file +704 -0
704 lines not on this page · raw message
kexec/arch/arm64/kexec-arm64.h new file +70 -0
70 lines not on this page · raw message
kexec/arch/arm64/kexec-elf-arm64.c new file +130 -0
130 lines not on this page · raw message
kexec/arch/arm64/kexec-image-arm64.c new file +44 -0
44 lines not on this page · raw message
kexec/kexec-syscall.h +6 -2
@@ -39,8 +39,8 @@#ifdef __s390__#define __NR_kexec_load 277#endif -#ifdef __arm__ -#define __NR_kexec_load __NR_SYSCALL_BASE + 347 +#if defined(__arm__) || defined(__arm64__) +#define __NR_kexec_load __NR_SYSCALL_BASE + 347#endif #if defined(__mips__)#define __NR_kexec_load 4311
@@ -108,6 +108,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,#define KEXEC_ARCH_PPC64 (21 << 16)#define KEXEC_ARCH_IA_64 (50 << 16)#define KEXEC_ARCH_ARM (40 << 16) +#define KEXEC_ARCH_ARM64 (183 << 16)#define KEXEC_ARCH_S390 (22 << 16)#define KEXEC_ARCH_SH (42 << 16)#define KEXEC_ARCH_MIPS_LE (10 << 16)
@@ -153,5 +154,8 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,#ifdef __m68k__#define KEXEC_ARCH_NATIVE KEXEC_ARCH_68K#endif +#if defined(__arm64__) +#define KEXEC_ARCH_NATIVE KEXEC_ARCH_ARM64 +#endif #endif /* KEXEC_SYSCALL_H */
purgatory/Makefile +1 -0
@@ -19,6 +19,7 @@ dist += purgatory/Makefile $(PURGATORY_SRCS) \ include $(srcdir)/purgatory/arch/alpha/Makefile include $(srcdir)/purgatory/arch/arm/Makefile +include $(srcdir)/purgatory/arch/arm64/Makefile include $(srcdir)/purgatory/arch/i386/Makefile include $(srcdir)/purgatory/arch/ia64/Makefile include $(srcdir)/purgatory/arch/mips/Makefile
purgatory/arch/arm64/Makefile new file +18 -0
@@ -0,0 +1,18 @@ + +arm64_PURGATORY_EXTRA_CFLAGS = \ + -mcmodel=large \ + -fno-stack-protector \ + -fno-asynchronous-unwind-tables \ + -Wundef \ + -Werror-implicit-function-declaration \ + -Wdeclaration-after-statement \ + -Werror=implicit-int \ + -Werror=strict-prototypes + +arm64_PURGATORY_SRCS += \ + purgatory/arch/arm64/entry.S \ + purgatory/arch/arm64/purgatory-arm64.c + +dist += \ + $(arm64_PURGATORY_SRCS) \ + purgatory/arch/arm64/Makefile
purgatory/arch/arm64/entry.S new file +51 -0
52 lines not on this page · raw message
purgatory/arch/arm64/purgatory-arm64.c new file +19 -0
@@ -0,0 +1,19 @@ +/* +* ARM64 purgatory. +*/ + +#include <stdint.h> +#include <purgatory.h> + +void putchar (int ch) +{ +/* Nothing for now */ +} + +void post_verification_setup_arch (void ) +{ +} + +void setup_arch (void ) +{ +}
Signature · 8 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 3/4] arm64: Add arm64 kexec support
Quoted 4 lines · Geoff Levand
Add kexec reboot support for ARM64 platforms.
Signed-off-by Geoff Levand <[email protected]>---
[...]
kexec/arch/arm64/include/arch/options.h line 7
Quoted 5 lines
kexec/arch/arm64/include/arch/options.h new file +5
-0+ +#define OPT_APPEND ((OPT_MAX)+0) +#define OPT_DTB ((OPT_MAX)+1) +#define OPT_INITRD ((OPT_MAX)+2) +#define OPT_REUSE_CMDLINE ((OPT_MAX)+4)
Option count 3 is missing.
Quoted 1 line
+#define
OPT_ARCH_MAX((OPT_MAX)+5)
~Pratyush
Re: [PATCH v2 3/4] arm64: Add arm64 kexec support
Quoted 8 lines · Pratyush Anand
Quoted 4 lines · Geoff Levand
Add kexec reboot support for ARM64 platforms.
Signed-off-by Geoff Levand <[email protected]>---
[...]
Quoted 7 lines
kexec/arch/arm64/include/arch/options.h line 7
Quoted 5 lines
kexec/arch/arm64/include/arch/options.h new file +5
-0+ +#define OPT_APPEND ((OPT_MAX)+0) +#define OPT_DTB ((OPT_MAX)+1) +#define OPT_INITRD ((OPT_MAX)+2) +#define OPT_REUSE_CMDLINE ((OPT_MAX)+4)Option count 3 is missing.
From the recently removed OPT_PORT.
Thanks for checking.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 4/4 arm64: Add support for binary image files
In reply to Geoff LevandFrom: Pratyush Anand <[email protected]>
--- kexec/arch/arm64/kexec-image-arm64.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)
kexec/arch/arm64/kexec-image-arm64.c +25 -6
@@ -24,21 +24,40 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)return -1 ; } -fprintf (stderr,"kexec: ARM64 binary image files are currently NOT SUPPORTED.\n" ); - -return -1 ; +return 0 ; }int image_arm64_load (int argc,char **argv,const char *kernel_buf,off_t kernel_size,struct kexec_info *info) { -return -EFAILED ; +const struct arm64_image_header *h; +unsigned long image_base; + + h = (const struct arm64_image_header *)(kernel_buf); + +if (arm64_process_image_header (h)) +return -EINVAL ; + +dbgprintf ("%s: text_offset: %016lx\n" , __func__, + arm64_mem.text_offset); +dbgprintf ("%s: image_size: %016lx\n" , __func__, + arm64_mem.image_size); +dbgprintf ("%s: phys_offset: %016lx\n" , __func__, + arm64_mem.phys_offset); +dbgprintf ("%s: PE format: %s\n" , __func__, + (arm64_header_check_pe_sig (h) ?"yes" :"no" )); + + image_base =get_phys_offset () + arm64_mem.text_offset; + +add_segment_phys_virt (info, kernel_buf, kernel_size, image_base, + arm64_mem.image_size,0 ); + +return arm64_load_other_segments (info, image_base); }void image_arm64_usage (void ) {printf (" An ARM64 binary image, compressed or not, big or little endian.\n" -" Typically an Image, Image.gz or Image.lzma file.\n" -" This file type is currently NOT SUPPORTED.\n\n" ); +" Typically an Image, Image.gz or Image.lzma file.\n\n" ); }
Signature · 7 lines
2.5.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Hi Geoff,
Quoted 4 lines · Geoff Levand
From: Pratyush Anand <[email protected]>
Signed-off-by Pratyush Anand <[email protected]>[Reworked and cleaned up]
You removed page_offset calculation in rework.
I am unable to understand that how arm64_mem.page_offset will be filled up now for binary image case.
I think, we still need to keep page_offset user input. You may take following two patches which does this, or you may leave binary image support patch which I will send after your patches are merged.
https://github.com/pratyushanand/kexec-tools/commit/5b7e49a75d1d6cd4ac846f50ff10275fd54cb545
https://github.com/pratyushanand/kexec-tools/commit/a0ce0ce673755c4061c1f081170a3a75dfa1d1fb
~Pratyush
Quoted 58 lines
Signed-off-by Geoff Levand <[email protected]>--- kexec/arch/arm64/kexec-image-arm64.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)kexec/arch/arm64/kexec-image-arm64.c +25
-6@@ -24,21 +24,40 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)return -1 ; } -fprintf (stderr,"kexec: ARM64 binary image files are currently NOT SUPPORTED.\n" ); - -return -1 ; +return 0 ; }int image_arm64_load (int argc,char **argv,const char *kernel_buf,off_t kernel_size,struct kexec_info *info) { -return -EFAILED ; +const struct arm64_image_header *h; +unsigned long image_base; + + h = (const struct arm64_image_header *)(kernel_buf); + +if (arm64_process_image_header (h)) +return -EINVAL ; + +dbgprintf ("%s: text_offset: %016lx\n" , __func__, + arm64_mem.text_offset); +dbgprintf ("%s: image_size: %016lx\n" , __func__, + arm64_mem.image_size); +dbgprintf ("%s: phys_offset: %016lx\n" , __func__, + arm64_mem.phys_offset); +dbgprintf ("%s: PE format: %s\n" , __func__, + (arm64_header_check_pe_sig (h) ?"yes" :"no" )); + + image_base =get_phys_offset () + arm64_mem.text_offset; + +add_segment_phys_virt (info, kernel_buf, kernel_size, image_base, + arm64_mem.image_size,0 ); + +return arm64_load_other_segments (info, image_base); }void image_arm64_usage (void ) {printf (" An ARM64 binary image, compressed or not, big or little endian.\n" -" Typically an Image, Image.gz or Image.lzma file.\n" -" This file type is currently NOT SUPPORTED.\n\n" ); +" Typically an Image, Image.gz or Image.lzma file.\n\n" ); }Signature · 1 line
2.5.0
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Hi Pratyush,
Quoted 7 lines · Pratyush Anand
On 26/07/2016:08:18:57 PM, Geoff Levand wrote:
You removed
page_offsetcalculation in rework.
I am unable to understand that how arm64_mem.page_offset will be filled up now for binary image case.I think, we still need to keep
page_offsetuser input.
The current kernel linker scripts are setup to output virtual address values to the vmlinux elf file.
To load the elf sections of vmlinux using the provided elf file loader, elf_exec_load(), we need to convert those elf header values to physical addresses since we work with physical addresses in the kernel's kimage structure.
That conversion is
p = v - page_offset + phys_offset;
We get phys_offset from the memory ranges, and we calculate page_offset from the elf header info.
As for the binary image file, we load that with add_segment_phys_virt(), which can put the binary data of the Image file into memory at a physical address we specify:
image_base = phys_offset + text_offset.
phys_offset is again from the memory ranges, and text_offset from the arm64 image header.
Quoted 5 lines
You may take following
two patches which does this, or you may leave binary image support patch which I will send after your patches are merged.https://github.com/pratyushanand/kexec-tools/commit/5b7e49a75d1d6cd4ac846f50ff10275fd54cb545
This one may be useful, for debugging if anything.
Quoted 1 line
https://github.com/pratyushanand/kexec-tools/commit/a0ce0ce673755c4061c1f081170a3a75dfa1d1fb
We do not need, nor want, a PAGE_OFFSET option.
-Geoff
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Hi Geoff,
Quoted 40 lines · Geoff Levand
Hi Pratyush,
Quoted 7 lines · Pratyush Anand
On 26/07/2016:08:18:57 PM, Geoff Levand wrote:
You removed
page_offsetcalculation in rework.
I am unable to understand that how arm64_mem.page_offset will be filled up now for binary image case.I think, we still need to keep
page_offsetuser input.The current kernel linker scripts are setup to output virtual address values to the vmlinux elf file.
To load the elf sections of vmlinux using the provided elf file loader,
elf_exec_load(), we need to convert those elf header values to physical addresses since we work with physical addresses in the kernel's kimage structure.That conversion is
p = v - page_offset + phys_offset;We get
phys_offsetfrom the memory ranges, and we calculatepage_offsetfrom the elf header info.As for the binary image file, we load that with
add_segment_phys_virt(), which can put the binary data of the Image file into memory at a physical address we specify:
image_base=phys_offset+text_offset.
phys_offsetis again from the memory ranges, andtext_offsetfrom the arm64 image header.Quoted 4 lines
You may take following
two patches which does this, or you may leave binary image support patch which I will send after your patches are merged.
Quoted 7 lines
Quoted 1 line
https://github.com/pratyushanand/kexec-tools/commit/5b7e49a75d1d6cd4ac846f50ff10275fd54cb545
This one may be useful, for debugging if anything.
Quoted 1 line
https://github.com/pratyushanand/kexec-tools/commit/a0ce0ce673755c4061c1f081170a3a75dfa1d1fb
We do not need, nor want, a
PAGE_OFFSEToption.
See kexec/crashdump-elf.c:FUNC()
We have:
223 phdr->p_vaddr = phys_to_virt(elf_info, mstart);
Now, if we do not have page_offset then we will not have correct p_vaddr, and then vmcore-dmesg/vmcore-dmesg.c:vaddr_to_offset() fails with
No program header covering vaddr 0xfffffc0008c312f0found kexec bug?
~Pratyush
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Quoted 4 lines · Pratyush Anand
See kexec/crashdump-elf.c:FUNC()
We have:
223phdr->p_vaddr=phys_to_virt(elf_info, mstart);
These patches don't support kdump.
-Geoff
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Hi Geoff,
Quoted 8 lines · Geoff Levand
Quoted 4 lines · Pratyush Anand
See kexec/crashdump-elf.c:FUNC()
We have:
223phdr->p_vaddr=phys_to_virt(elf_info, mstart);These patches don't support kdump.
OK, so you suggest that I should keep this patch as it is and add --page-offset in corresponding kdump patch. I can do that, no issue.
~Pratyush
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Quoted 11 lines · Pratyush Anand
Hi Geoff,
Quoted 8 lines · Geoff Levand
Quoted 5 lines · Pratyush Anand
See kexec/crashdump-elf.c:FUNC()
We have:
223phdr->p_vaddr= phys_to_virt(elf_info,
mstart);
Quoted 5 lines
Quoted 1 line
These patches don't support kdump.
OK, so you suggest that I should keep this patch as it is and add - -page-offset
in corresponding kdump patch. I can do that, no issue.
Yes, this is an issue related to kdump, so let's discuss it in that context.
-Geoff
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 4/4] arm64: Add support for binary image files
In reply to Pratyush AnandPratyush,
Quoted 10 lines · Pratyush Anand
Hi Geoff,
Quoted 7 lines · Geoff Levand
Quoted 4 lines · Pratyush Anand
See kexec/crashdump-elf.c:FUNC()
We have:
223phdr->p_vaddr=phys_to_virt(elf_info, mstart);
Quoted 4 lines
Quoted 1 line
These patches don't support kdump.
OK, so you suggest that I should keep this patch as it is and add --page-offset in corresponding kdump patch. I can do that, no issue.
I will add necessary hunks from your old patch when I submit a next version of patches for arm64, probably next Monday.
I hope that you don't mind.
Thanks,
-Takahiro AKASHI
Quoted 1 line
~Pratyush
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v2 4/4] arm64: Add support for binary image files
Hi Takahiro,
Quoted 15 lines · AKASHI Takahiro
Pratyush,
Quoted 12 lines · Pratyush Anand
Hi Geoff,
Quoted 8 lines · Geoff Levand
Quoted 4 lines · Pratyush Anand
See kexec/crashdump-elf.c:FUNC()
We have:
223phdr->p_vaddr=phys_to_virt(elf_info, mstart);These patches don't support kdump.
Quoted 7 lines
Quoted 2 lines
OK, so you suggest that I should keep this patch as it is and add --page-offset in corresponding kdump patch. I can do that, no issue.
I will add necessary hunks from your old patch when I submit a next version of patches for arm64, probably next Monday.
I hope that you don't mind.
Thanks, no issue.
May be you can just cherry-pick following two commits.
https://github.com/pratyushanand/kexec-tools/commit/1e4eea5798de312c7ac90043361a889516da0aaf
https://github.com/pratyushanand/kexec-tools/commit/fd19e4b9c1423d24fcd4355277835f0bf01c33e8
They are in upstream_arm64_devel branch of https://github.com/pratyushanand/kexec-tools.git
~Pratyush