SHA256
1
0
forked from pool/kexec-tools
kexec-tools/kexec-tools-add-alignment-parameter.diff

159 lines
6.0 KiB
Diff

Subject: kexec-tools: Add alignment parameter to crash_create_XXX_headers
From: Simon Horman <horms@verge.net.au>
To: fastboot@lists.osdl.org, Linux-IA64 <linux-ia64@vger.kernel.org>
Cc: Cc: Bernhard Walle <bwalle@suse.de>,
Magnus Damm <magnus.damm@gmail.com>,
Zou, Nanhai <nanhai.zou@intel.com>
crash_create_XXX_headers assumes that all arhitectures need an alignment of
1024bytes. But on ia64 at least this is not true. This patch adds an
alignment parameter to crash_create_XXX_headers, and calls passes
a value of 1024 for all architectures except ia64, where EFI_PAGE_SIZE (4096)
is passed.
If there are problems with alignment on other architectures hopefully
this facility will work for them too.
Cc: Bernhard Walle <bwalle@suse.de>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Zou, Nanhai <nanhai.zou@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
kexec/arch/i386/crashdump-x86.c | 4 ++--
kexec/arch/ia64/crashdump-ia64.c | 5 +++--
kexec/arch/ppc64/crashdump-ppc64.c | 4 ++--
kexec/arch/x86_64/crashdump-x86_64.c | 2 +-
kexec/crashdump-elf.c | 11 ++---------
kexec/crashdump.h | 6 ++++--
6 files changed, 14 insertions(+), 18 deletions(-)
Index: kexec-tools-bw/kexec/arch/i386/crashdump-x86.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/i386/crashdump-x86.c 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/i386/crashdump-x86.c 2007-02-13 17:39:26.000000000 +0900
@@ -524,13 +524,13 @@
if (arch_options.core_header_type == CORE_TYPE_ELF64) {
if (crash_create_elf64_headers(info, &elf_info64,
crash_memory_range, nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz, 1024) < 0)
return -1;
}
else {
if (crash_create_elf32_headers(info, &elf_info32,
crash_memory_range, nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz, 1024) < 0)
return -1;
}
Index: kexec-tools-bw/kexec/arch/ia64/crashdump-ia64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/ia64/crashdump-ia64.c 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/ia64/crashdump-ia64.c 2007-02-13 18:09:44.000000000 +0900
@@ -232,13 +232,14 @@
if (crash_create_elf64_headers(info, &elf_info,
crash_memory_range,
nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz,
+ 4096) < 0)
return -1;
elfcorehdr = add_buffer(info, tmp, sz, sz, EFI_PAGE_SIZE, min_base,
max_addr, -1);
loaded_segments[loaded_segments_num].start = elfcorehdr;
- loaded_segments[loaded_segments_num].end = elfcorehdr + size;
+ loaded_segments[loaded_segments_num].end = elfcorehdr + sz;
loaded_segments[loaded_segments_num].reserved = 1;
loaded_segments_num++;
cmdline_add_elfcorehdr(cmdline, elfcorehdr);
Index: kexec-tools-bw/kexec/arch/ppc64/crashdump-ppc64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/ppc64/crashdump-ppc64.c 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/ppc64/crashdump-ppc64.c 2007-02-13 17:39:26.000000000 +0900
@@ -344,13 +344,13 @@
if (arch_options.core_header_type == CORE_TYPE_ELF64) {
if (crash_create_elf64_headers(info, &elf_info64,
crash_memory_range, nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz, 1024) < 0)
return -1;
}
else {
if (crash_create_elf32_headers(info, &elf_info32,
crash_memory_range, nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz, 1024) < 0)
return -1;
}
Index: kexec-tools-bw/kexec/arch/x86_64/crashdump-x86_64.c
===================================================================
--- kexec-tools-bw.orig/kexec/arch/x86_64/crashdump-x86_64.c 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/arch/x86_64/crashdump-x86_64.c 2007-02-13 17:39:26.000000000 +0900
@@ -607,7 +607,7 @@
/* Create elf header segment and store crash image data. */
if (crash_create_elf64_headers(info, &elf_info,
crash_memory_range, nr_ranges,
- &tmp, &sz) < 0)
+ &tmp, &sz, 1024) < 0)
return -1;
/* Hack: With some ld versions (GNU ld version 2.14.90.0.4 20030523),
Index: kexec-tools-bw/kexec/crashdump-elf.c
===================================================================
--- kexec-tools-bw.orig/kexec/crashdump-elf.c 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/crashdump-elf.c 2007-02-13 17:39:26.000000000 +0900
@@ -27,11 +27,11 @@
int FUNC(struct kexec_info *info,
struct crash_elf_info *elf_info,
struct memory_range *range, int ranges,
- void **buf, unsigned long *size)
+ void **buf, unsigned long *size, unsigned long align)
{
EHDR *elf;
PHDR *phdr;
- int i, sz, align;
+ int i, sz;
char *bufp;
long int nr_cpus = 0;
uint64_t notes_addr, notes_len;
@@ -72,13 +72,6 @@
sz += sizeof(PHDR);
}
- /*
- * The kernel command line option memmap= requires 1k granularity,
- * therefore we align the size to 1024 here.
- */
-
- align = 1024;
-
sz += align - 1;
sz &= ~(align - 1);
Index: kexec-tools-bw/kexec/crashdump.h
===================================================================
--- kexec-tools-bw.orig/kexec/crashdump.h 2007-02-13 17:39:18.000000000 +0900
+++ kexec-tools-bw/kexec/crashdump.h 2007-02-13 17:39:26.000000000 +0900
@@ -27,12 +27,14 @@
int crash_create_elf32_headers(struct kexec_info *info,
struct crash_elf_info *elf_info,
struct memory_range *range, int ranges,
- void **buf, unsigned long *size);
+ void **buf, unsigned long *size,
+ unsigned long align);
int crash_create_elf64_headers(struct kexec_info *info,
struct crash_elf_info *elf_info,
struct memory_range *range, int ranges,
- void **buf, unsigned long *size);
+ void **buf, unsigned long *size,
+ unsigned long align);
int xen_present(void);
int xen_get_nr_phys_cpus(void);