* [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries
@ 2010-07-14 15:32 Matthew McClintock
2010-07-14 15:32 ` [PATCH] Update uImage to support crash kernel and misc fixes Matthew McClintock
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Matthew McClintock @ 2010-07-14 15:32 UTC (permalink / raw)
To: kexec; +Cc: Matthew McClintock
On some actitectures the physical memory can be 64 bits, therefore
the code that reads proc entries needs to take into account it could
read either a 32 bit or 64bit value for the physical addresses.
Signed-off-by: Matthew McClintock <msm@freescale.com>
---
kexec/arch/ppc/kexec-elf-ppc.c | 1 -
kexec/arch/ppc/kexec-ppc.c | 210 ++++++++++++++++++++++++++++------------
kexec/arch/ppc/kexec-ppc.h | 1 +
3 files changed, 148 insertions(+), 64 deletions(-)
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
index d155bde..ab2d343 100644
--- a/kexec/arch/ppc/kexec-elf-ppc.c
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
@@ -32,7 +32,6 @@
static const int probe_debug = 0;
-unsigned long long initrd_base, initrd_size;
unsigned char reuse_initrd;
const char *ramdisk;
int create_flatten_tree(struct kexec_info *, unsigned char **, unsigned long *,
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
index c073f56..d7afad6 100644
--- a/kexec/arch/ppc/kexec-ppc.c
+++ b/kexec/arch/ppc/kexec-ppc.c
@@ -28,6 +28,8 @@
uint64_t rmo_top;
unsigned long long crash_base, crash_size;
+unsigned long long initrd_base, initrd_size;
+unsigned long long devicetree_base, devicetree_size;
unsigned int rtas_base, rtas_size;
int max_memory_ranges;
@@ -320,9 +322,7 @@ static int get_devtree_details(unsigned long kexec_flags)
DIR *dir, *cdir;
FILE *file;
struct dirent *dentry;
- struct stat fstat;
int n, i = 0;
- unsigned long tmp_long;
if ((dir = opendir(device_tree)) == NULL) {
perror(device_tree);
@@ -352,12 +352,18 @@ static int get_devtree_details(unsigned long kexec_flags)
perror(fname);
goto error_opencdir;
}
- if (fread(&tmp_long, sizeof(unsigned long), 1, file)
- != 1) {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
perror(fname);
goto error_openfile;
}
- kernel_end = tmp_long;
+ if (n == 4) {
+ kernel_end = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ kernel_end = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
fclose(file);
/* Add kernel memory to exclude_range */
@@ -375,12 +381,18 @@ static int get_devtree_details(unsigned long kexec_flags)
perror(fname);
goto error_opencdir;
}
- if (fread(&tmp_long, sizeof(unsigned long), 1,
- file) != 1) {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
perror(fname);
goto error_openfile;
}
- crash_base = tmp_long;
+ if (n == 4) {
+ crash_base = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ crash_base = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
fclose(file);
memset(fname, 0, sizeof(fname));
@@ -392,12 +404,19 @@ static int get_devtree_details(unsigned long kexec_flags)
perror(fname);
goto error_opencdir;
}
- if (fread(&tmp_long, sizeof(unsigned long), 1,
- file) != 1) {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
perror(fname);
goto error_openfile;
}
- crash_size = tmp_long;
+ if (n == 4) {
+ crash_size = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ crash_size = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
+ fclose(file);
if (crash_base > mem_min)
mem_min = crash_base;
@@ -408,6 +427,123 @@ static int get_devtree_details(unsigned long kexec_flags)
reserve(KDUMP_BACKUP_LIMIT,
crash_base-KDUMP_BACKUP_LIMIT);
}
+ /* reserve the initrd_start and end locations. */
+ memset(fname, 0, sizeof(fname));
+ strcpy(fname, device_tree);
+ strcat(fname, dentry->d_name);
+ strcat(fname, "/linux,initrd-start");
+ file = fopen(fname, "r");
+ if (!file) {
+ errno = 0;
+ initrd_start = 0;
+ } else {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
+ perror(fname);
+ goto error_openfile;
+ }
+ if (n == 4) {
+ initrd_start = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ initrd_start = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
+ fclose(file);
+ }
+
+ memset(fname, 0, sizeof(fname));
+ strcpy(fname, device_tree);
+ strcat(fname, dentry->d_name);
+ strcat(fname, "/linux,initrd-end");
+ file = fopen(fname, "r");
+ if (!file) {
+ errno = 0;
+ initrd_end = 0;
+ } else {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
+ perror(fname);
+ goto error_openfile;
+ }
+ if (n == 4) {
+ initrd_end = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ initrd_end = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
+ fclose(file);
+ }
+
+ if ((initrd_end - initrd_start) != 0 )
+ {
+ initrd_base = initrd_start;
+ initrd_size = initrd_end - initrd_start + 1;
+ }
+
+ if (reuse_initrd) {
+ /* Add initrd address to exclude_range */
+ exclude_range[i].start = initrd_start;
+ exclude_range[i].end = initrd_end;
+ i++;
+ if (i >= max_memory_ranges)
+ realloc_memory_ranges();
+ }
+
+ memset(fname, 0, sizeof(fname));
+ strcpy(fname, device_tree);
+ strcat(fname, dentry->d_name);
+ strcat(fname, "/linux,devicetree-start");
+ file = fopen(fname, "r");
+ if (!file) {
+ errno = 0;
+ devicetree_base = 0;
+ } else {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
+ perror(fname);
+ goto error_openfile;
+ }
+ if (n == 4) {
+ devicetree_base = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ devicetree_base = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
+ fclose(file);
+ }
+
+ memset(fname, 0, sizeof(fname));
+ strcpy(fname, device_tree);
+ strcat(fname, dentry->d_name);
+ strcat(fname, "/linux,devicetree-end");
+ file = fopen(fname, "r");
+ if (!file) {
+ errno = 0;
+ devicetree_size = 0;
+ } else {
+ if ((n = fread(buf, 1, MAXBYTES, file)) < 0) {
+ perror(fname);
+ goto error_openfile;
+ }
+ if (n == 4) {
+ devicetree_size = ((uint32_t *)buf)[0];
+ } else if (n == 8) {
+ devicetree_size = ((uint64_t *)buf)[0];
+ } else {
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
+ goto error_openfile;
+ }
+ fclose(file);
+ }
+
+ /* Fixup device tree size */
+ if (devicetree_size != 0)
+ devicetree_size -= devicetree_base;
+
+ /* HTAB */
memset(fname, 0, sizeof(fname));
strcpy(fname, device_tree);
strcat(fname, dentry->d_name);
@@ -449,59 +585,7 @@ static int get_devtree_details(unsigned long kexec_flags)
if (i >= max_memory_ranges)
realloc_memory_ranges();
- /* reserve the initrd_start and end locations. */
- if (reuse_initrd) {
- memset(fname, 0, sizeof(fname));
- strcpy(fname, device_tree);
- strcat(fname, dentry->d_name);
- strcat(fname, "/linux,initrd-start");
- file = fopen(fname, "r");
- if (!file) {
- perror(fname);
- goto error_opencdir;
- }
- /* check for 4 and 8 byte initrd offset sizes */
- if (stat(fname, &fstat) != 0) {
- perror(fname);
- goto error_openfile;
- }
- if (fread(&initrd_start, fstat.st_size, 1, file)
- != 1) {
- perror(fname);
- goto error_openfile;
- }
- fclose(file);
-
- memset(fname, 0, sizeof(fname));
- strcpy(fname, device_tree);
- strcat(fname, dentry->d_name);
- strcat(fname, "/linux,initrd-end");
- file = fopen(fname, "r");
- if (!file) {
- perror(fname);
- goto error_opencdir;
- }
- /* check for 4 and 8 byte initrd offset sizes */
- if (stat(fname, &fstat) != 0) {
- perror(fname);
- goto error_openfile;
- }
- if (fread(&initrd_end, fstat.st_size, 1, file)
- != 1) {
- perror(fname);
- goto error_openfile;
- }
- fclose(file);
-
- /* Add initrd address to exclude_range */
- exclude_range[i].start = initrd_start;
- exclude_range[i].end = initrd_end;
- i++;
- if (i >= max_memory_ranges)
- realloc_memory_ranges();
- }
} /* chosen */
-
if (strncmp(dentry->d_name, "rtas", 4) == 0) {
strcat(fname, "/linux,rtas-base");
if ((file = fopen(fname, "r")) == NULL) {
diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h
index fc0471f..aefdc6f 100644
--- a/kexec/arch/ppc/kexec-ppc.h
+++ b/kexec/arch/ppc/kexec-ppc.h
@@ -65,6 +65,7 @@ typedef struct mem_rgns {
extern mem_rgns_t usablemem_rgns;
extern int max_memory_ranges;
extern unsigned long long initrd_base, initrd_size;
+extern unsigned long long devicetree_base, devicetree_size;
extern unsigned char reuse_initrd;
#define COMMAND_LINE_SIZE 512 /* from kernel */
/*fs2dt*/
--
1.6.0.6
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH] Update uImage to support crash kernel and misc fixes 2010-07-14 15:32 [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock @ 2010-07-14 15:32 ` Matthew McClintock 2010-07-14 15:32 ` [PATCH] Update Elf-ppc " Matthew McClintock 2010-07-14 15:39 ` [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock 2010-07-14 15:49 ` [linuxppc-release] " Tabi Timur-B04825 2 siblings, 1 reply; 10+ messages in thread From: Matthew McClintock @ 2010-07-14 15:32 UTC (permalink / raw) To: kexec; +Cc: Matthew McClintock Use current command line if none given, specifically useful for when arguments are added causing the use of the current cmdline to not occur. We also try to load the dtb above the kernel, this is useful for relocatable kernels where they device tree needs to reside just above the kernel base address. Only allocate 1 MiB extra for bss space after kernel as it appears to be more than adequate. Signed-off-by: Matthew McClintock <msm@freescale.com> --- kexec/arch/ppc/kexec-uImage-ppc.c | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c index 4a8d28d..21a7c1b 100644 --- a/kexec/arch/ppc/kexec-uImage-ppc.c +++ b/kexec/arch/ppc/kexec-uImage-ppc.c @@ -10,6 +10,7 @@ #include <getopt.h> #include <arch/options.h> #include "../../kexec.h" +#include "../../kexec-syscall.h" #include "kexec-ppc.h" #include "fixup_dtb.h" #include <kexec-uImage.h> @@ -45,7 +46,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, off_t len, struct kexec_info *info, unsigned int load_addr, unsigned int ep) { - char *command_line; + char *command_line, *cmdline_buf; int command_line_len; char *dtb; unsigned int addr; @@ -56,6 +57,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, int opt; int ret; + cmdline_buf = NULL; command_line = NULL; dtb = NULL; @@ -89,24 +91,34 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, } command_line_len = 0; - if (command_line) + if (command_line) { + command_line_len = strlen(command_line) + 1; + } else { + command_line = get_command_line(); command_line_len = strlen(command_line) + 1; + } fixup_nodes[cur_fixup] = NULL; /* * len contains the length of the whole kernel image except the bss - * section. The 3 MiB should cover it. The purgatory and the dtb are + * section. The 1 MiB should cover it. The purgatory and the dtb are * allocated from memtop down towards zero so we should never get too * close to the bss :) */ - ret = valid_memory_range(info, load_addr, len + 3 * 1024 * 1024); + ret = valid_memory_range(info, load_addr, load_addr + (len + (1 * 1024 * 1024))); if (!ret) { printf("Can't add kernel to addr 0x%08x len %ld\n", - load_addr, len + 3 * 1024 * 1024); + load_addr, len + (1 * 1024 * 1024)); return -1; } - add_segment(info, buf, len, load_addr, len + 3 * 1024 * 1024); + add_segment(info, buf, len, load_addr, len + (1 * 1024 * 1024)); + + cmdline_buf = xmalloc(COMMAND_LINE_SIZE); + memset((void *)cmdline_buf, 0, COMMAND_LINE_SIZE); + if (command_line) + strncat(cmdline_buf, command_line, command_line_len); + if (dtb) { char *blob_buf; off_t blob_size = 0; @@ -115,10 +127,9 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, blob_buf = slurp_file(dtb, &blob_size); if (!blob_buf || !blob_size) die("Device tree seems to be an empty file.\n"); - blob_buf = fixup_dtb_nodes(blob_buf, &blob_size, fixup_nodes, command_line); - - dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, 0, - KERNEL_ACCESS_TOP, -1); + blob_buf = fixup_dtb_nodes(blob_buf, &blob_size, fixup_nodes, cmdline_buf); + dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, load_addr, + load_addr + KERNEL_ACCESS_TOP, -1); } else { dtb_addr = 0; } @@ -142,6 +153,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, addr = elf_rel_get_addr(&info->rhdr, "purgatory_start"); info->entry = (void *)addr; + return 0; } -- 1.6.0.6 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] Update Elf-ppc to support crash kernel and misc fixes 2010-07-14 15:32 ` [PATCH] Update uImage to support crash kernel and misc fixes Matthew McClintock @ 2010-07-14 15:32 ` Matthew McClintock 2010-07-14 15:32 ` [PATCH] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc Matthew McClintock 0 siblings, 1 reply; 10+ messages in thread From: Matthew McClintock @ 2010-07-14 15:32 UTC (permalink / raw) To: kexec; +Cc: Matthew McClintock Use current command line if none given, specifically useful for when arguments are added causing the use of the current cmdline to not occur We also try to load the dtb above the kernel, this is useful for relocatable kernels where they device tree needs to reside just above the kernel base address Set the kernel entry address in the relocatable purgatory code so we jump to the correct start address if not the default. Useful for relocatable kernels Signed-off-by: Matthew McClintock <msm@freescale.com> --- kexec/arch/ppc/kexec-elf-ppc.c | 26 ++++++++++++++------------ kexec/arch/ppc/kexec-ppc.c | 7 ++++--- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c index ab2d343..87e6507 100644 --- a/kexec/arch/ppc/kexec-elf-ppc.c +++ b/kexec/arch/ppc/kexec-elf-ppc.c @@ -182,6 +182,7 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, int target_is_gamecube = 0; unsigned int addr; unsigned long dtb_addr; + unsigned long kernel_addr; #endif #define FIXUP_ENTRYS (20) char *fixup_nodes[FIXUP_ENTRYS + 1]; @@ -228,6 +229,9 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, command_line_len = 0; if (command_line) { command_line_len = strlen(command_line) + 1; + } else { + command_line = get_command_line(); + command_line_len = strlen(command_line) + 1; } fixup_nodes[cur_fixup] = NULL; @@ -264,11 +268,11 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, if (size > phdr->p_memsz) size = phdr->p_memsz; - hole_addr = locate_hole(info, size, 0, 0, max_addr, 1); + kernel_addr = locate_hole(info, size, 0, 0, max_addr, 1); #ifdef CONFIG_PPC64 - ehdr.e_phdr[0].p_paddr = (Elf64_Addr)hole_addr; + ehdr.e_phdr[0].p_paddr = (Elf64_Addr)kernel_addr; #else - ehdr.e_phdr[0].p_paddr = hole_addr; + ehdr.e_phdr[0].p_paddr = kernel_addr; #endif /* Load the Elf data */ @@ -343,10 +347,11 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, blob_buf = slurp_file(dtb, &blob_size); if (!blob_buf || !blob_size) die("Device tree seems to be an empty file.\n"); + blob_buf = fixup_dtb_nodes(blob_buf, &blob_size, fixup_nodes, cmdline_buf); - dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, 0, - KERNEL_ACCESS_TOP, -1); + dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, kernel_addr, + kernel_addr + KERNEL_ACCESS_TOP, -1); } else { /* create from fs2dt */ seg_buf = NULL; @@ -364,19 +369,16 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, if (dtb) { - /* set various variables for the purgatory */ - addr = ehdr.e_entry; + /* set various variables for the purgatory ehdr.e_entry is a + * virtual address, we can use kernel_addr which + * should be the physical start address of the kernel */ + addr = kernel_addr; elf_rel_set_symbol(&info->rhdr, "kernel", &addr, sizeof(addr)); addr = dtb_addr; elf_rel_set_symbol(&info->rhdr, "dt_offset", &addr, sizeof(addr)); - addr = rmo_top; - - elf_rel_set_symbol(&info->rhdr, "mem_size", - &addr, sizeof(addr)); - #define PUL_STACK_SIZE (16 * 1024) addr = locate_hole(info, PUL_STACK_SIZE, 0, 0, elf_max_addr(&ehdr), 1); diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c index d7afad6..d9f1d05 100644 --- a/kexec/arch/ppc/kexec-ppc.c +++ b/kexec/arch/ppc/kexec-ppc.c @@ -27,9 +27,10 @@ #include "config.h" uint64_t rmo_top; -unsigned long long crash_base, crash_size; -unsigned long long initrd_base, initrd_size; -unsigned long long devicetree_base, devicetree_size; +unsigned long long crash_base = 0, crash_size = 0; +unsigned long long initrd_base = 0, initrd_size = 0; +unsigned long long ramdisk_base = 0, ramdisk_size = 0; +unsigned long long devicetree_base = 0, devicetree_size = 0; unsigned int rtas_base, rtas_size; int max_memory_ranges; -- 1.6.0.6 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc 2010-07-14 15:32 ` [PATCH] Update Elf-ppc " Matthew McClintock @ 2010-07-14 15:32 ` Matthew McClintock 2010-07-14 15:32 ` [PATCH] Add support for reworking flat device tree support Matthew McClintock 0 siblings, 1 reply; 10+ messages in thread From: Matthew McClintock @ 2010-07-14 15:32 UTC (permalink / raw) To: kexec; +Cc: Matthew McClintock This fixes --reuseinitrd and --ramdisk option for ppc32 on uImage-ppc and Elf. It works for normal kexec as well as for kdump. When using --reuseinitrd you need to specifify retain_initrd on the command line. Also, if you are doing kdump you need to make sure your initrd lives in the crashdump region otherwise the kdump kernel will not be able to access it. The --ramdisk option should always work. Signed-off-by: Matthew McClintock <msm@freescale.com> --- kexec/arch/ppc/Makefile | 1 + kexec/arch/ppc/include/arch/options.h | 3 + kexec/arch/ppc/kexec-elf-ppc.c | 44 ++++++++++++++++++++- kexec/arch/ppc/kexec-ppc.c | 6 +++ kexec/arch/ppc/kexec-ppc.h | 2 + kexec/arch/ppc/kexec-uImage-ppc.c | 68 +++++++++++++++++++++++++++++++- 6 files changed, 118 insertions(+), 6 deletions(-) diff --git a/kexec/arch/ppc/Makefile b/kexec/arch/ppc/Makefile index 5988213..c963175 100644 --- a/kexec/arch/ppc/Makefile +++ b/kexec/arch/ppc/Makefile @@ -21,6 +21,7 @@ libfdt_SRCS += $(LIBFDT_SRCS:%=kexec/arch/ppc/libfdt/%) CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/libfdt ppc_KEXEC_SRCS += $(libfdt_SRCS) +ppc_ARCH_REUSE_INITRD = dist += kexec/arch/ppc/Makefile $(ppc_KEXEC_SRCS) \ kexec/arch/ppc/kexec-ppc.h kexec/arch/ppc/ppc_asm.h \ diff --git a/kexec/arch/ppc/include/arch/options.h b/kexec/arch/ppc/include/arch/options.h index f646ccc..0c00ea7 100644 --- a/kexec/arch/ppc/include/arch/options.h +++ b/kexec/arch/ppc/include/arch/options.h @@ -8,6 +8,7 @@ #define OPT_GAMECUBE (OPT_ARCH_MAX+1) #define OPT_DTB (OPT_ARCH_MAX+2) #define OPT_NODES (OPT_ARCH_MAX+3) +#define OPT_RAMDISK (OPT_ARCH_MAX+4) /* Options relevant to the architecture (excluding loader-specific ones), * in this case none: @@ -35,6 +36,8 @@ KEXEC_ARCH_OPTIONS \ {"command-line", 1, 0, OPT_APPEND},\ {"append", 1, 0, OPT_APPEND},\ + {"ramdisk", 1, 0, OPT_APPEND},\ + {"initrd", 1, 0, OPT_APPEND},\ {"gamecube", 1, 0, OPT_GAMECUBE},\ {"dtb", 1, 0, OPT_DTB},\ {"reuse-node", 1, 0, OPT_NODES},\ diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c index 87e6507..58bba54 100644 --- a/kexec/arch/ppc/kexec-elf-ppc.c +++ b/kexec/arch/ppc/kexec-elf-ppc.c @@ -127,6 +127,8 @@ static const struct option options[] = { KEXEC_ARCH_OPTIONS {"command-line", 1, 0, OPT_APPEND}, {"append", 1, 0, OPT_APPEND}, + {"ramdisk", 1, 0, OPT_RAMDISK}, + {"initrd", 1, 0, OPT_RAMDISK}, {"gamecube", 1, 0, OPT_GAMECUBE}, {"dtb", 1, 0, OPT_DTB}, {"reuse-node", 1, 0, OPT_NODES}, @@ -139,10 +141,12 @@ void elf_ppc_usage(void) printf( " --command-line=STRING Set the kernel command line to STRING.\n" " --append=STRING Set the kernel command line to STRING.\n" + " --ramdisk=<filename> Initial RAM disk.\n" + " --initrd=<filename> same as --ramdisk\n" " --gamecube=1|0 Enable/disable support for ELFs with changed\n" " addresses suitable for the GameCube.\n" - " --dtb=<filename> Specify device tree blob file.\n" - " --reuse-node=node Specify nodes which should be taken from /proc/device-tree.\n" + " --dtb=<filename> Specify device tree blob file.\n" + " --reuse-node=node Specify nodes which should be taken from /proc/device-tree.\n" " Can be set multiple times.\n" ); } @@ -177,7 +181,7 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, unsigned long my_kernel, my_dt_offset; unsigned long my_stack, my_backup_start; unsigned int slave_code[256 / sizeof(unsigned int)], master_entry; - unsigned char *seg_buf = NULL; + char *seg_buf = NULL; off_t seg_size = 0; int target_is_gamecube = 0; unsigned int addr; @@ -193,6 +197,8 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, dtb = NULL; max_addr = LONG_MAX; hole_addr = 0; + kernel_addr = 0; + ramdisk = 0; while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { switch (opt) { @@ -207,6 +213,9 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, case OPT_APPEND: command_line = optarg; break; + case OPT_RAMDISK: + ramdisk = optarg; + break; case OPT_GAMECUBE: target_is_gamecube = atoi(optarg); break; @@ -234,6 +243,9 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, command_line_len = strlen(command_line) + 1; } + if (ramdisk && reuse_initrd) + die("Can't specify --ramdisk or --initrd with --reuseinitrd\n"); + fixup_nodes[cur_fixup] = NULL; /* Need to append some command line parameters internally in case of @@ -339,6 +351,32 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, elf_rel_build_load(info, &info->rhdr, (const char *)purgatory, purgatory_size, 0, elf_max_addr(&ehdr), 1, 0); + if (ramdisk) + { + seg_buf = slurp_file(ramdisk, &seg_size); + hole_addr = add_buffer(info, seg_buf, seg_size, seg_size, + 0, 0, max_addr, 1); + ramdisk_base = hole_addr; + ramdisk_size = seg_size; + } + if (reuse_initrd) + { + ramdisk_base = initrd_base; + ramdisk_size = initrd_size; + } + + if (info->kexec_flags & KEXEC_ON_CRASH && ramdisk_base != 0) { + if ( (ramdisk_base < crash_base) || + (ramdisk_base > crash_base + crash_size) ) + { + printf("WARNING: ramdisk is above crashkernel region!\n"); + } + else if (ramdisk_base + initrd_size > crash_base + crash_size) + { + printf("WARNING: ramdisk overflows crashkernel region!\n"); + } + } + if (dtb) { char *blob_buf; off_t blob_size = 0; diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c index d9f1d05..7adea2b 100644 --- a/kexec/arch/ppc/kexec-ppc.c +++ b/kexec/arch/ppc/kexec-ppc.c @@ -33,6 +33,12 @@ unsigned long long ramdisk_base = 0, ramdisk_size = 0; unsigned long long devicetree_base = 0, devicetree_size = 0; unsigned int rtas_base, rtas_size; int max_memory_ranges; +const char *ramdisk; + +void arch_reuse_initrd(void) +{ + reuse_initrd = 1; +} #ifdef WITH_GAMECUBE #define MAX_MEMORY_RANGES 64 diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h index aefdc6f..5ad3575 100644 --- a/kexec/arch/ppc/kexec-ppc.h +++ b/kexec/arch/ppc/kexec-ppc.h @@ -65,8 +65,10 @@ typedef struct mem_rgns { extern mem_rgns_t usablemem_rgns; extern int max_memory_ranges; extern unsigned long long initrd_base, initrd_size; +extern unsigned long long ramdisk_base, ramdisk_size; extern unsigned long long devicetree_base, devicetree_size; extern unsigned char reuse_initrd; +extern const char *ramdisk; #define COMMAND_LINE_SIZE 512 /* from kernel */ /*fs2dt*/ void reserve(unsigned long long where, unsigned long long length); diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c index 21a7c1b..310d6c3 100644 --- a/kexec/arch/ppc/kexec-uImage-ppc.c +++ b/kexec/arch/ppc/kexec-uImage-ppc.c @@ -14,12 +14,16 @@ #include "kexec-ppc.h" #include "fixup_dtb.h" #include <kexec-uImage.h> +#include "crashdump-powerpc.h" +#include <limits.h> /* See options.h -- add any more there, too. */ static const struct option options[] = { KEXEC_ARCH_OPTIONS {"command-line", 1, 0, OPT_APPEND}, {"append", 1, 0, OPT_APPEND}, + {"ramdisk", 1, 0, OPT_RAMDISK}, + {"initrd", 1, 0, OPT_RAMDISK}, {"dtb", 1, 0, OPT_DTB}, {"reuse-node", 1, 0, OPT_NODES}, {0, 0, 0, 0}, @@ -31,8 +35,10 @@ void uImage_ppc_usage(void) printf( " --command-line=STRING Set the kernel command line to STRING.\n" " --append=STRING Set the kernel command line to STRING.\n" - " --dtb=<filename> Specify device tree blob file.\n" - " --reuse-node=node Specify nodes which should be taken from /proc/device-tree.\n" + " --ramdisk=<filename> Initial RAM disk.\n" + " --initrd=<filename> same as --ramdisk\n" + " --dtb=<filename> Specify device tree blob file.\n" + " --reuse-node=node Specify nodes which should be taken from /proc/device-tree.\n" " Can be set multiple times.\n" ); } @@ -46,7 +52,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, off_t len, struct kexec_info *info, unsigned int load_addr, unsigned int ep) { - char *command_line, *cmdline_buf; + char *command_line, *cmdline_buf, *crash_cmdline; int command_line_len; char *dtb; unsigned int addr; @@ -56,10 +62,15 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, int cur_fixup = 0; int opt; int ret; + char *seg_buf = NULL; + off_t seg_size = 0; + unsigned long long hole_addr; + unsigned long max_addr; cmdline_buf = NULL; command_line = NULL; dtb = NULL; + max_addr = LONG_MAX; while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { switch (opt) { @@ -75,6 +86,10 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, command_line = optarg; break; + case OPT_RAMDISK: + ramdisk = optarg; + break; + case OPT_DTB: dtb = optarg; break; @@ -90,6 +105,9 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, } } + if (ramdisk && reuse_initrd) + die("Can't specify --ramdisk or --initrd with --reuseinitrd\n"); + command_line_len = 0; if (command_line) { command_line_len = strlen(command_line) + 1; @@ -114,10 +132,54 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, } add_segment(info, buf, len, load_addr, len + (1 * 1024 * 1024)); + if (info->kexec_flags & KEXEC_ON_CRASH) { + crash_cmdline = xmalloc(COMMAND_LINE_SIZE); + memset((void *)crash_cmdline, 0, COMMAND_LINE_SIZE); + } else + crash_cmdline = NULL; + + if (info->kexec_flags & KEXEC_ON_CRASH) { + ret = load_crashdump_segments(info, crash_cmdline, + max_addr, 0); + if (ret < 0) { + return -1; + } + } + cmdline_buf = xmalloc(COMMAND_LINE_SIZE); memset((void *)cmdline_buf, 0, COMMAND_LINE_SIZE); if (command_line) strncat(cmdline_buf, command_line, command_line_len); + if (crash_cmdline) + strncat(cmdline_buf, crash_cmdline, + sizeof(crash_cmdline) - + strlen(crash_cmdline) - 1); + + if (ramdisk) + { + seg_buf = slurp_file(ramdisk, &seg_size); + hole_addr = add_buffer(info, seg_buf, seg_size, seg_size, + 0, 0, max_addr, 1); + ramdisk_base = hole_addr; + ramdisk_size = seg_size; + } + if (reuse_initrd) + { + ramdisk_base = initrd_base; + ramdisk_size = initrd_size; + } + + if (info->kexec_flags & KEXEC_ON_CRASH && ramdisk_base != 0) { + if ( (ramdisk_base < crash_base) || + (ramdisk_base > crash_base + crash_size) ) + { + printf("WARNING: ramdisk is above crashkernel region!\n"); + } + else if (ramdisk_base + ramdisk_size > crash_base + crash_size) + { + printf("WARNING: ramdisk overflows crashkernel region!\n"); + } + } if (dtb) { char *blob_buf; -- 1.6.0.6 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] Add support for reworking flat device tree support 2010-07-14 15:32 ` [PATCH] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc Matthew McClintock @ 2010-07-14 15:32 ` Matthew McClintock 0 siblings, 0 replies; 10+ messages in thread From: Matthew McClintock @ 2010-07-14 15:32 UTC (permalink / raw) To: kexec; +Cc: Matthew McClintock Currently, the device tree is passed as is. You can optionally update the command line and specifically listed nodes but nothing is updated automatically. This patch updates the memreserve regions, memory node, initrd nodes and attempts to make the device tree look as it should. Some code is borrowed from the u-boot routines which do similiar things Signed-off-by: Matthew McClintock <msm@freescale.com> --- kexec/arch/ppc/fixup_dtb.c | 237 ++++++++++++++++++++++++++++++++++++- kexec/arch/ppc/fixup_dtb.h | 3 +- kexec/arch/ppc/kexec-elf-ppc.c | 5 +- kexec/arch/ppc/kexec-ppc.h | 1 + kexec/arch/ppc/kexec-uImage-ppc.c | 3 +- kexec/arch/ppc/ops.h | 1 - 6 files changed, 243 insertions(+), 7 deletions(-) diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c index 40e9350..3cb66cf 100644 --- a/kexec/arch/ppc/fixup_dtb.c +++ b/kexec/arch/ppc/fixup_dtb.c @@ -8,13 +8,34 @@ #include <sys/stat.h> #include "../../kexec.h" +#include "../../kexec-syscall.h" #include <libfdt.h> #include "ops.h" #include "page.h" #include "fixup_dtb.h" +#include "kexec-ppc.h" const char proc_dts[] = "/proc/device-tree"; +static void print_fdt_reserve_regions(char *blob_buf) +{ + int i, num; + + /* Print out a summary of the final reserve regions */ + num = fdt_num_mem_rsv(blob_buf); + printf ("reserve regions: %d\n", num); + for (i = 0; i < num; i++) + { + uint64_t offset, size; + + if (fdt_get_mem_rsv(blob_buf, i, &offset, &size) == 0) { + printf("%d: offset: %llx, size: %llx\n", i, offset, size); + } else { + printf("Error retreiving reserved region\n"); + } + } +} + static void fixup_nodes(char *nodes[]) { int index = 0; @@ -92,12 +113,226 @@ static void fixup_cmdline(const char *cmdline) return; } -char *fixup_dtb_nodes(char *blob_buf, off_t *blob_size, char *nodes[], char *cmdline) +#define EXPAND_GRANULARITY 1024 + +static char *expand_buf(int minexpand, char *blob_buf, off_t *blob_size) +{ + int size = fdt_totalsize(blob_buf); + int rc; + + size = _ALIGN(size + minexpand, EXPAND_GRANULARITY); + blob_buf = realloc(blob_buf, size); + if (!blob_buf) + fatal("Couldn't find %d bytes to expand device tree\n\r", size); + rc = fdt_open_into(blob_buf, blob_buf, size); + if (rc != 0) + fatal("Couldn't expand fdt into new buffer: %s\n\r", + fdt_strerror(rc)); + + *blob_size = fdt_totalsize(blob_buf); + + return blob_buf; +} + +static char *fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t *blob_size, + unsigned long hole_addr) +{ + int ret; + int i, num = fdt_num_mem_rsv(blob_buf); + unsigned long dtb_future_addr; + + /* Remove the existing reserve regions as they will no longer + * be valid after we reboot */ + for (i = num - 1; i >= 0; i--) + { + uint64_t address, size; + + ret = fdt_get_mem_rsv(blob_buf, i, &address, &size); + if (ret) { + printf("%s: Error getting old memory reserve regions %d\n", + fdt_strerror(ret), i); + } + + /* TODO: What else do we remove? */ + if ( (address == initrd_base && PAGE_ALIGN(size) == PAGE_ALIGN(initrd_size)) || + (address == devicetree_base && PAGE_ALIGN(size) == PAGE_ALIGN(devicetree_size)) ) { + ret = fdt_del_mem_rsv(blob_buf, i); + if (ret) { + printf("%s: Error deleting memory reserve region %d from device tree!\n", + fdt_strerror(ret), i); + } + } + } + + num = fdt_num_mem_rsv(blob_buf); + + /* Pack the FDT first, so we don't grow excessively if there is already free space */ + ret = fdt_pack(blob_buf); + if (ret) + printf("%s: Unable to pack flat device tree\n", fdt_strerror(ret)); + blob_buf = expand_buf(info->nr_segments, blob_buf, blob_size); + + if (info->kexec_flags & KEXEC_ON_CRASH) { + /* Add reserve regions for all segments since it's not too important to add + * extra stuff, we just need to make sure we get the elf headers reserved */ + for (i = 0; i < info->nr_segments; i++) + { + uint64_t address, size; + + address = (size_t)info->segment[i].mem; + size = info->segment[i].memsz; + + /* check for overlapping segments */ + while (((i + 1) < info->nr_segments) && + ((info->segment[i].mem + info->segment[i].memsz) == info->segment[i+1].mem)) + { + size += info->segment[i+1].memsz; + i++; /* skip next item as well */ + } + + ret = fdt_add_mem_rsv(blob_buf, address, size); + if (ret) + printf("%s: Unable to add new reserved memory\n", + fdt_strerror(ret)); + } + } + else { + /* Otherwise we just add back the ramdisk and device tree regions */ + ret = fdt_add_mem_rsv(blob_buf, ramdisk_base, ramdisk_size); + if (ret) { + printf("%s: Unable to add new reserved memory for initrd flat device tree\n", + fdt_strerror(ret)); + } + } + + /* add reserve region for *THIS* fdt */ + dtb_future_addr = locate_hole(info, PAGE_ALIGN(*blob_size), 0, + hole_addr, hole_addr+KERNEL_ACCESS_TOP, -1); + + ret = fdt_add_mem_rsv(blob_buf, dtb_future_addr, PAGE_ALIGN(*blob_size)); + if (ret) { + printf("%s: Unable to add new reserved memory for the flat device tree\n", + fdt_strerror(ret)); + } + +#if DEBUG + print_fdt_reserve_regions(blob_buf); +#endif + + return blob_buf; +} + +static void fixup_memory(struct kexec_info *info, char *blob_buf) +{ + if (info->kexec_flags & KEXEC_ON_CRASH) { + int nodeoffset, len = 0; + u8 tmp[16]; + const unsigned long *addrcell, *sizecell; + + nodeoffset = fdt_path_offset(blob_buf, "/memory"); + + if (nodeoffset < 0) + printf("Error searching for memory node!\n"); + + addrcell = fdt_getprop(blob_buf, 0, "#address-cells", NULL); + /* use shifts and mask to ensure endianness */ + if ((addrcell) && (*addrcell == 2)) { + tmp[0] = (crash_base >> 56) & 0xff; + tmp[1] = (crash_base >> 48) & 0xff; + tmp[2] = (crash_base >> 40) & 0xff; + tmp[3] = (crash_base >> 32) & 0xff; + tmp[4] = (crash_base >> 24) & 0xff; + tmp[5] = (crash_base >> 16) & 0xff; + tmp[6] = (crash_base >> 8) & 0xff; + tmp[7] = (crash_base ) & 0xff; + len = 8; + } else { + tmp[0] = (crash_base >> 24) & 0xff; + tmp[1] = (crash_base >> 16) & 0xff; + tmp[2] = (crash_base >> 8) & 0xff; + tmp[3] = (crash_base ) & 0xff; + len = 4; + } + + sizecell = fdt_getprop(blob_buf, 0, "#size-cells", NULL); + /* use shifts and mask to ensure endianness */ + if ((sizecell) && (*sizecell == 2)) { + tmp[0+len] = (crash_size >> 56) & 0xff; + tmp[1+len] = (crash_size >> 48) & 0xff; + tmp[2+len] = (crash_size >> 40) & 0xff; + tmp[3+len] = (crash_size >> 32) & 0xff; + tmp[4+len] = (crash_size >> 24) & 0xff; + tmp[5+len] = (crash_size >> 16) & 0xff; + tmp[6+len] = (crash_size >> 8) & 0xff; + tmp[7+len] = (crash_size ) & 0xff; + len += 8; + } else { + tmp[0+len] = (crash_size >> 24) & 0xff; + tmp[1+len] = (crash_size >> 16) & 0xff; + tmp[2+len] = (crash_size >> 8) & 0xff; + tmp[3+len] = (crash_size ) & 0xff; + len += 4; + } + + if (fdt_setprop(blob_buf, nodeoffset, "reg", tmp, len) != 0) { + printf ("Error setting memory node!\n"); + } + } +} + +/* remove the old chosen nodes if they exist and add correct chosen + * nodes if we have an initd + */ +static void fixup_initrd(char *blob_buf) +{ + int err, nodeoffset; + unsigned long tmp; + + nodeoffset = fdt_path_offset(blob_buf, "/chosen"); + + if ((reuse_initrd || ramdisk) && + ((ramdisk_base != 0) && (ramdisk_size != 0))) + { + if (nodeoffset < 0) + { + printf("fdt_initrd: %s\n", fdt_strerror(nodeoffset)); + return; + } + + tmp = ramdisk_base; + err = fdt_setprop(blob_buf, nodeoffset, + "linux,initrd-start", &tmp, sizeof(tmp)); + if (err < 0) { + printf("WARNING: " + "could not set linux,initrd-start %s.\n", + fdt_strerror(err)); + return; + } + + tmp = ramdisk_base + ramdisk_size + 1; + err = fdt_setprop(blob_buf, nodeoffset, + "linux,initrd-end", &tmp, sizeof(tmp)); + if (err < 0) { + printf("WARNING: could not set linux,initrd-end %s.\n", + fdt_strerror(err)); + return; + } + } else { + fdt_delprop(blob_buf, nodeoffset, "linux,initrd-start"); + fdt_delprop(blob_buf, nodeoffset, "linux,initrd-end"); + } +} + +char *fixup_dtb_nodes(struct kexec_info *info, char *blob_buf, off_t *blob_size, + char *nodes[], char *cmdline, unsigned long hole_addr) { fdt_init(blob_buf); fixup_nodes(nodes); fixup_cmdline(cmdline); + blob_buf = fixup_reserve_regions(info, blob_buf, blob_size, hole_addr); + fixup_memory(info, blob_buf); + fixup_initrd(blob_buf); blob_buf = (char *)dt_ops.finalize(); *blob_size = fdt_totalsize(blob_buf); diff --git a/kexec/arch/ppc/fixup_dtb.h b/kexec/arch/ppc/fixup_dtb.h index 0ff981e..5e3abc8 100644 --- a/kexec/arch/ppc/fixup_dtb.h +++ b/kexec/arch/ppc/fixup_dtb.h @@ -1,6 +1,7 @@ #ifndef __FIXUP_DTB_H #define __FIXUP_DTB_H -char *fixup_dtb_nodes(char *blob_buf, off_t *blob_size, char *nodes[], char *cmdline); +char *fixup_dtb_nodes(struct kexec_info *info, char *blob_buf, off_t *blob_size, + char *nodes[], char *cmdline, unsigned long hole_addr); #endif diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c index 58bba54..aa96475 100644 --- a/kexec/arch/ppc/kexec-elf-ppc.c +++ b/kexec/arch/ppc/kexec-elf-ppc.c @@ -385,9 +385,8 @@ int elf_ppc_load(int argc, char **argv, const char *buf, off_t len, blob_buf = slurp_file(dtb, &blob_size); if (!blob_buf || !blob_size) die("Device tree seems to be an empty file.\n"); - - blob_buf = fixup_dtb_nodes(blob_buf, &blob_size, fixup_nodes, - cmdline_buf); + blob_buf = fixup_dtb_nodes(info, blob_buf, &blob_size, fixup_nodes, + cmdline_buf, kernel_addr); dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, kernel_addr, kernel_addr + KERNEL_ACCESS_TOP, -1); } else { diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h index 5ad3575..029a656 100644 --- a/kexec/arch/ppc/kexec-ppc.h +++ b/kexec/arch/ppc/kexec-ppc.h @@ -64,6 +64,7 @@ typedef struct mem_rgns { } mem_rgns_t; extern mem_rgns_t usablemem_rgns; extern int max_memory_ranges; +extern unsigned long long crash_base, crash_size; extern unsigned long long initrd_base, initrd_size; extern unsigned long long ramdisk_base, ramdisk_size; extern unsigned long long devicetree_base, devicetree_size; diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c index 310d6c3..a70ebb7 100644 --- a/kexec/arch/ppc/kexec-uImage-ppc.c +++ b/kexec/arch/ppc/kexec-uImage-ppc.c @@ -189,7 +189,8 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf, blob_buf = slurp_file(dtb, &blob_size); if (!blob_buf || !blob_size) die("Device tree seems to be an empty file.\n"); - blob_buf = fixup_dtb_nodes(blob_buf, &blob_size, fixup_nodes, cmdline_buf); + blob_buf = fixup_dtb_nodes(info, blob_buf, &blob_size, fixup_nodes, cmdline_buf, + load_addr); dtb_addr = add_buffer(info, blob_buf, blob_size, blob_size, 0, load_addr, load_addr + KERNEL_ACCESS_TOP, -1); } else { diff --git a/kexec/arch/ppc/ops.h b/kexec/arch/ppc/ops.h index f33e941..a2eb140 100644 --- a/kexec/arch/ppc/ops.h +++ b/kexec/arch/ppc/ops.h @@ -147,5 +147,4 @@ static inline char *get_path(const void *phandle, char *buf, int len) #define fatal(args...) { printf(args); exit(1); } -char *fixup_dtb_nodes(char *blob_buf, off_t *blob_size, char *nodes[], char *cmdline); #endif /* _PPC_BOOT_OPS_H_ */ -- 1.6.0.6 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries 2010-07-14 15:32 [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock 2010-07-14 15:32 ` [PATCH] Update uImage to support crash kernel and misc fixes Matthew McClintock @ 2010-07-14 15:39 ` Matthew McClintock 2010-07-15 3:07 ` Simon Horman 2010-07-14 15:49 ` [linuxppc-release] " Tabi Timur-B04825 2 siblings, 1 reply; 10+ messages in thread From: Matthew McClintock @ 2010-07-14 15:39 UTC (permalink / raw) To: kexec On Wed, 2010-07-14 at 10:32 -0500, Matthew McClintock wrote: > On some actitectures the physical memory can be 64 bits, therefore > the code that reads proc entries needs to take into account it could > read either a 32 bit or 64bit value for the physical addresses. > These patches did not get numbered, shall I resubmit with numbered patches? 0001-Fix-case-where-phys_addr_t-unsigned-long-when-rea.patch 0002-Update-uImage-to-support-crash-kernel-and-misc-fixes.patch 0003-Update-Elf-ppc-to-support-crash-kernel-and-misc-fixe.patch 0004-Add-support-for-ramdisk-on-ppc32-for-uImage-ppc-and.patch 0005-Add-support-for-reworking-flat-device-tree-support.patch -M _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries 2010-07-14 15:39 ` [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock @ 2010-07-15 3:07 ` Simon Horman 2010-07-15 4:22 ` Matthew McClintock 0 siblings, 1 reply; 10+ messages in thread From: Simon Horman @ 2010-07-15 3:07 UTC (permalink / raw) To: Matthew McClintock; +Cc: kexec On Wed, Jul 14, 2010 at 10:39:18AM -0500, Matthew McClintock wrote: > On Wed, 2010-07-14 at 10:32 -0500, Matthew McClintock wrote: > > On some actitectures the physical memory can be 64 bits, therefore > > the code that reads proc entries needs to take into account it could > > read either a 32 bit or 64bit value for the physical addresses. > > > > These patches did not get numbered, shall I resubmit with numbered > patches? The list below is sufficient, but could you cc the patches to linuxppc-dev@lists.ozlabs.org? > 0001-Fix-case-where-phys_addr_t-unsigned-long-when-rea.patch > 0002-Update-uImage-to-support-crash-kernel-and-misc-fixes.patch > 0003-Update-Elf-ppc-to-support-crash-kernel-and-misc-fixe.patch > 0004-Add-support-for-ramdisk-on-ppc32-for-uImage-ppc-and.patch > 0005-Add-support-for-reworking-flat-device-tree-support.patch _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries 2010-07-15 3:07 ` Simon Horman @ 2010-07-15 4:22 ` Matthew McClintock 2010-07-15 5:47 ` Simon Horman 0 siblings, 1 reply; 10+ messages in thread From: Matthew McClintock @ 2010-07-15 4:22 UTC (permalink / raw) To: Simon Horman; +Cc: kexec On Thu, 2010-07-15 at 12:07 +0900, Simon Horman wrote: > The list below is sufficient, but could you cc the patches to > linuxppc-dev@lists.ozlabs.org? > Yes of course, I'm also trying to find some people to review/test these as well. -M _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries 2010-07-15 4:22 ` Matthew McClintock @ 2010-07-15 5:47 ` Simon Horman 0 siblings, 0 replies; 10+ messages in thread From: Simon Horman @ 2010-07-15 5:47 UTC (permalink / raw) To: Matthew McClintock; +Cc: kexec On Wed, Jul 14, 2010 at 11:22:45PM -0500, Matthew McClintock wrote: > On Thu, 2010-07-15 at 12:07 +0900, Simon Horman wrote: > > The list below is sufficient, but could you cc the patches to > > linuxppc-dev@lists.ozlabs.org? > > > > Yes of course, I'm also trying to find some people to review/test these > as well. Excellent, thanks. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [linuxppc-release] [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries 2010-07-14 15:32 [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock 2010-07-14 15:32 ` [PATCH] Update uImage to support crash kernel and misc fixes Matthew McClintock 2010-07-14 15:39 ` [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock @ 2010-07-14 15:49 ` Tabi Timur-B04825 2 siblings, 0 replies; 10+ messages in thread From: Tabi Timur-B04825 @ 2010-07-14 15:49 UTC (permalink / raw) To: McClintock Matthew-B29882; +Cc: kexec [-- Attachment #1.1: Type: text/plain, Size: 634 bytes --] Matthew McClintock wrote: > +unsigned long long initrd_base, initrd_size; > +unsigned long long devicetree_base, devicetree_size; These should be declared uint64_t, to match the code that assigns them. > + if (n == 4) { > + kernel_end = ((uint32_t *)buf)[0]; > + } else if (n == 8) { How about n == sizeof(uint32_t) and n == sizeof(uint64_t) ? + memset(fname, 0, sizeof(fname)); + strcpy(fname, device_tree); + strcat(fname, dentry->d_name); + strcat(fname, "/linux,initrd-start"); Why not use sprintf() instead of three strcxx calls? -- Timur Tabi Linux kernel developer [-- Attachment #1.2: Type: text/html, Size: 2321 bytes --] [-- Attachment #2: Type: text/plain, Size: 143 bytes --] _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-07-15 5:48 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-07-14 15:32 [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock 2010-07-14 15:32 ` [PATCH] Update uImage to support crash kernel and misc fixes Matthew McClintock 2010-07-14 15:32 ` [PATCH] Update Elf-ppc " Matthew McClintock 2010-07-14 15:32 ` [PATCH] Add support for ramdisk on ppc32 for uImage-ppc and Elf-ppc Matthew McClintock 2010-07-14 15:32 ` [PATCH] Add support for reworking flat device tree support Matthew McClintock 2010-07-14 15:39 ` [PATCH] Fix case where phys_addr_t != unsigned long when reading proc entries Matthew McClintock 2010-07-15 3:07 ` Simon Horman 2010-07-15 4:22 ` Matthew McClintock 2010-07-15 5:47 ` Simon Horman 2010-07-14 15:49 ` [linuxppc-release] " Tabi Timur-B04825
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox