All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec tools mipsel port
@ 2007-06-01 22:21 francesco chiechi
  2007-06-04  5:40 ` Horms
  0 siblings, 1 reply; 10+ messages in thread
From: francesco chiechi @ 2007-06-01 22:21 UTC (permalink / raw)
  To: kexec; +Cc: Alessandro Rubini

Hello,

We developed a patch to port kexec-tools to mips arch and included support for 
command line passing through elf boot notes.
We did it for a customer of ours on a specific platform derived from toshiba 
tx4938 (so we think it should work at least for tx4938 evaluation board also).
We would like to contribute it in case somebody else needs it or wants to 
improve it.
This patch works for us but the assembler part in particular, should be 
considered as a starting point because my assembly knowledge is not too deep.

As this is the first time I submit a patch I tried to guess reading tpp.txt if 
this is the right way to submit. Please let me know about any mistakes I may 
have made.

thanks

Francesco Chiechi

Index: kexec-tools-testing-20070330/configure
===================================================================
--- kexec-tools-testing-20070330.orig/configure 2007-03-30 06:35:13.000000000 
+0200
+++ kexec-tools-testing-20070330/configure      2007-05-15 11:47:03.000000000 
+0200
@@ -1850,7 +1850,7 @@
                ;;
 esac
 case $host_cpu in
-       i386|ppc|x86_64|alpha|ppc64|ia64|s390|sh)
+       i386|ppc|x86_64|alpha|ppc64|ia64|s390|sh|mipsel)
                ;;
        * )
                { { echo "$as_me:$LINENO: error:  unsupported architecture 
$host_cpu" >&5
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/include/arch/options.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/include/arch/options.h      
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,11 @@
+#ifndef KEXEC_ARCH_MIPS_OPTIONS_H
+#define KEXEC_ARCH_MIPS_OPTIONS_H
+
+#define OPT_ARCH_MAX   (OPT_MAX+0)
+
+#define KEXEC_ARCH_OPTIONS \
+       KEXEC_OPTIONS \
+
+#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
+
+#endif /* KEXEC_ARCH_MIPS_OPTIONS_H */
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-elf-mipsel.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-elf-mipsel.c   
2007-06-02 00:16:41.000000000 +0200
@@ -0,0 +1,184 @@
+/*
+ * kexec-elf-mipsel.c - kexec Elf loader for mips
+ * Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
+ * Copyright (C) 2007 Tvblob s.r.l.
+ *
+ * derived from ../ppc/kexec-elf-ppc.c
+ * Copyright (C) 2004 Albert Herranz
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2.  See the file COPYING for more details.
+*/
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <elf.h>
+#include <boot/elf_boot.h>
+#include <ip_checksum.h>
+#include "../../kexec.h"
+#include "../../kexec-elf.h"
+#include "kexec-mipsel.h"
+#include <arch/options.h>
+
+static const int probe_debug = 0;
+
+#define BOOTLOADER         "kexec"
+#define BOOTLOADER_VERSION VERSION
+#define MAX_COMMAND_LINE   256
+
+#define UPSZ(X) ((sizeof(X) + 3) & ~3)
+static struct boot_notes {
+       Elf_Bhdr hdr;
+       Elf_Nhdr bl_hdr;
+       unsigned char bl_desc[UPSZ(BOOTLOADER)];
+       Elf_Nhdr blv_hdr;
+       unsigned char blv_desc[UPSZ(BOOTLOADER_VERSION)];
+       Elf_Nhdr cmd_hdr;
+       unsigned char command_line[0];
+} elf_boot_notes = {
+       .hdr = {
+               .b_signature = 0x0E1FB007,
+               .b_size = sizeof(elf_boot_notes),
+               .b_checksum = 0,
+               .b_records = 3,
+       },
+       .bl_hdr = {
+               .n_namesz = 0,
+               .n_descsz = sizeof(BOOTLOADER),
+               .n_type = EBN_BOOTLOADER_NAME,
+       },
+       .bl_desc = BOOTLOADER,
+       .blv_hdr = {
+               .n_namesz = 0,
+               .n_descsz = sizeof(BOOTLOADER_VERSION),
+               .n_type = EBN_BOOTLOADER_VERSION,
+       },
+       .blv_desc = BOOTLOADER_VERSION,
+       .cmd_hdr = {
+               .n_namesz = 0,
+               .n_descsz = 0,
+               .n_type = EBN_COMMAND_LINE,
+       },
+};
+
+
+int elf_mipsel_probe(const char *buf, off_t len)
+{
+
+       struct mem_ehdr ehdr;
+       int result;
+       result = build_elf_exec_info(buf, len, &ehdr, 0);
+       if (result < 0) {
+               goto out;
+       }
+
+       /* Verify the architecuture specific bits */
+       if (ehdr.e_machine != EM_MIPS) {
+               /* for a different architecture */
+               if (probe_debug) {
+                       fprintf(stderr, "Not for this architecture.\n");
+               }
+               result = -1;
+               goto out;
+       }
+       result = 0;
+ out:
+       free_elf_info(&ehdr);
+       return result;
+}
+
+void elf_mipsel_usage(void)
+{
+       printf
+           (
+            "    --command-line=STRING Set the kernel command line to STRING.
\n"
+            "    --append=STRING       Set the kernel command line to STRING.
\n");
+}
+
+int elf_mipsel_load(int argc, char **argv, const char *buf, off_t len,
+       struct kexec_info *info)
+{
+       struct mem_ehdr ehdr;
+       char *arg_buf;
+       size_t arg_bytes;
+       unsigned long arg_base;
+       struct boot_notes *notes;
+       size_t note_bytes;
+       const char *command_line;
+       int command_line_len;
+       unsigned char *setup_start;
+       uint32_t setup_size;
+       int result;
+       int opt;
+       int i;
+#define OPT_APPEND     (OPT_ARCH_MAX+0)
+       static const struct option options[] = {
+               KEXEC_ARCH_OPTIONS
+               {"command-line", 1, 0, OPT_APPEND},
+               {"append",       1, 0, OPT_APPEND},
+               {0, 0, 0, 0},
+       };
+
+       static const char short_options[] = KEXEC_ARCH_OPT_STR "d";
+
+       command_line = 0;
+       while ((opt = getopt_long(argc, argv, short_options, options, 
0)) != -1) {
+               switch (opt) {
+               default:
+                       /* Ignore core options */
+                       if (opt < OPT_ARCH_MAX) {
+                               break;
+                       }
+               case '?':
+                       usage();
+                       return -1;
+               case OPT_APPEND:
+                       command_line = optarg;
+                       break;
+               }
+       }
+       command_line_len = 0;
+       setup_simple_regs.spr9 = 0;
+       if (command_line) {
+               command_line_len = strlen(command_line) + 1;
+               setup_simple_regs.spr9 = 2;
+       }
+
+        /* Load the ELF executable */
+        elf_exec_build_load(info, &ehdr, buf, len, 0);
+
+       setup_start = setup_simple_start;
+        setup_size = setup_simple_size;
+        setup_simple_regs.spr8 = ehdr.e_entry;
+
+        note_bytes = sizeof(elf_boot_notes) + ((command_line_len + 3) & ~3);
+        arg_bytes = note_bytes + ((setup_size + 3) & ~3);
+
+        arg_buf = xmalloc(arg_bytes);
+        arg_base = add_buffer_virt(info,
+                arg_buf, arg_bytes, arg_bytes, 4, 0, elf_max_addr(&ehdr), 1);
+
+        notes = (struct boot_notes *)(arg_buf + ((setup_size + 3) & ~3));
+
+        memcpy(arg_buf, setup_start, setup_size);
+        memcpy(notes, &elf_boot_notes, sizeof(elf_boot_notes));
+        memcpy(notes->command_line, command_line, command_line_len);
+
+        notes->hdr.b_size = note_bytes;
+        notes->cmd_hdr.n_descsz = command_line_len;
+        notes->hdr.b_checksum = compute_ip_checksum(notes, note_bytes);
+
+        info->entry = (void *)arg_base;
+
+       return 0;
+}
+
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-elf-rel-mipsel.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-elf-rel-mipsel.c      
2007-05-18 09:18:35.000000000 +0200
@@ -0,0 +1,42 @@
+/*
+ * kexec-elf-rel-mipsel.c - kexec Elf relocation routines
+ * Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
+ * Copyright (C) 2007 Tvblob s.r.l.
+ *
+ * derived from ../ppc/kexec-elf-rel-ppc.c
+ * Copyright (C) 2004 Albert Herranz
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2.  See the file COPYING for more details.
+*/
+
+#include <stdio.h>
+#include <elf.h>
+#include "../../kexec.h"
+#include "../../kexec-elf.h"
+
+int machine_verify_elf_rel(struct mem_ehdr *ehdr)
+{
+       if (ehdr->ei_data != ELFDATA2MSB) {
+               return 0;
+       }
+       if (ehdr->ei_class != ELFCLASS32) {
+               return 0;
+       }
+       if (ehdr->e_machine != EM_MIPS) {
+               return 0;
+       }
+       return 1;
+}
+
+void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
+       void *location, unsigned long address, unsigned long value)
+{
+       switch(r_type) {
+
+       default:
+               die("Unknown rela relocation: %lu\n", r_type);
+               break;
+       }
+       return;
+}
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-mipsel.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-mipsel.c       
2007-05-18 09:29:45.000000000 +0200
@@ -0,0 +1,167 @@
+/*
+ * kexec-mipsel.c - kexec for mips
+ * Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
+ * Copyright (C) 2007 Tvblob s.r.l.
+ *
+ * derived from ../ppc/kexec-mipsel.c
+ * Copyright (C) 2004, 2005 Albert Herranz
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2.  See the file COPYING for more details.
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+#include <string.h>
+#include <getopt.h>
+#include <sys/utsname.h>
+#include "../../kexec.h"
+#include "../../kexec-syscall.h"
+#include "kexec-mipsel.h"
+#include <arch/options.h>
+
+#define MAX_MEMORY_RANGES  64
+#define MAX_LINE          160
+static struct memory_range memory_range[MAX_MEMORY_RANGES];
+
+/* Return a sorted list of memory ranges. */
+int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long 
kexec_flags)
+{
+       int memory_ranges = 0;
+
+#if 1
+       /* this is valid for gemini2 platform based on tx4938
+        * in our case, /proc/iomem doesn't report ram space
+        */
+        memory_range[memory_ranges].start = 0x00000000;
+        memory_range[memory_ranges].end = 0x04000000;
+        memory_range[memory_ranges].type = RANGE_RAM;
+        memory_ranges++;
+#else
+#error Please, fix this for your platform
+       const char iomem[] = "/proc/iomem";
+       char line[MAX_LINE];
+       FILE *fp;
+       unsigned long long start, end;
+       char *str;
+       int type, consumed, count;
+
+       fp = fopen(iomem, "r");
+       if (!fp) {
+               fprintf(stderr, "Cannot open %s: %s\n", iomem, 
strerror(errno));
+               return -1;
+       }
+       while (fgets(line, sizeof(line), fp) != 0) {
+               if (memory_ranges >= MAX_MEMORY_RANGES)
+                       break;
+               count = sscanf(line, "%Lx-%Lx : %n", &start, &end, &consumed);
+               if (count != 2)
+                       continue;
+               str = line + consumed;
+               end = end + 1;
+#if 0
+               printf("%016Lx-%016Lx : %s\n", start, end, str);
+#endif
+               if (memcmp(str, "System RAM\n", 11) == 0) {
+                       type = RANGE_RAM;
+               } else if (memcmp(str, "reserved\n", 9) == 0) {
+                       type = RANGE_RESERVED;
+               } else if (memcmp(str, "ACPI Tables\n", 12) == 0) {
+                       type = RANGE_ACPI;
+               } else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 
0) {
+                       type = RANGE_ACPI_NVS;
+               } else {
+                       continue;
+               }
+               memory_range[memory_ranges].start = start;
+               memory_range[memory_ranges].end = end;
+               memory_range[memory_ranges].type = type;
+#if 0
+               printf("%016Lx-%016Lx : %x\n", start, end, type);
+#endif
+               memory_ranges++;
+       }
+       fclose(fp);
+#endif
+
+       *range = memory_range;
+       *ranges = memory_ranges;
+       return 0;
+}
+
+struct file_type file_type[] = {
+       {"elf-mipsel", elf_mipsel_probe, elf_mipsel_load, elf_mipsel_usage},
+};
+int file_types = sizeof(file_type) / sizeof(file_type[0]);
+
+void arch_usage(void)
+{
+}
+
+static struct {
+} arch_options = {
+};
+int arch_process_options(int argc, char **argv)
+{
+       static const struct option options[] = {
+               KEXEC_ARCH_OPTIONS
+               { 0,                    0, NULL, 0 },
+       };
+       static const char short_options[] = KEXEC_ARCH_OPT_STR;
+       int opt;
+       unsigned long value;
+       char *end;
+
+       opterr = 0; /* Don't complain about unrecognized options here */
+       while((opt = getopt_long(argc, argv, short_options, options, 
0)) != -1) {
+               switch(opt) {
+               default:
+                       break;
+               }
+       }
+       /* Reset getopt for the next pass; called in other source modules */
+       opterr = 1;
+       optind = 1;
+       return 0;
+}
+
+int arch_compat_trampoline(struct kexec_info *info)
+{
+       int result;
+       struct utsname utsname;
+       result = uname(&utsname);
+       if (result < 0) {
+               fprintf(stderr, "uname failed: %s\n",
+                       strerror(errno));
+               return -1;
+       }
+        if (strcmp(utsname.machine, "mips") == 0)
+        {
+                /* For compatibility with older patches
+                 * use KEXEC_ARCH_DEFAULT instead of KEXEC_ARCH_MIPS here.
+                 */
+               info->kexec_flags |= KEXEC_ARCH_DEFAULT;
+        }
+       else {
+               fprintf(stderr, "Unsupported machine type: %s\n",
+                       utsname.machine);
+               return -1;
+       }
+       return 0;
+}
+
+void arch_update_purgatory(struct kexec_info *info)
+{
+}
+
+/*
+ * Adding a dummy function, so that build on mipsel will not break.
+ * Need to implement the actual checking code
+ */
+int is_crashkernel_mem_reserved(void)
+{
+        return 1;
+}
+
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-mipsel.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/kexec-mipsel.h       
2007-06-01 21:13:01.000000000 +0200
@@ -0,0 +1,17 @@
+#ifndef KEXEC_MIPS_H
+#define KEXEC_MIPS_H
+
+extern unsigned char setup_simple_start[];
+extern uint32_t setup_simple_size;
+
+extern struct {
+       uint32_t spr8;
+       uint32_t spr9;
+} setup_simple_regs;
+
+int elf_mipsel_probe(const char *buf, off_t len);
+int elf_mipsel_load(int argc, char **argv, const char *buf, off_t len,
+       struct kexec_info *info);
+void elf_mipsel_usage(void);
+
+#endif /* KEXEC_MIPS_H */
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/Makefile
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/Makefile     2007-05-15 
12:12:17.000000000 +0200
@@ -0,0 +1,7 @@
+#
+# kexec mipsel (linux booting linux)
+#
+KEXEC_C_SRCS+= kexec/arch/mipsel/kexec-mipsel.c
+KEXEC_C_SRCS+= kexec/arch/mipsel/kexec-elf-mipsel.c
+KEXEC_C_SRCS+= kexec/arch/mipsel/kexec-elf-rel-mipsel.c
+KEXEC_S_SRCS+= kexec/arch/mipsel/mipsel-setup-simple.S
Index: kexec-tools-testing-20070330/kexec/arch/mipsel/mipsel-setup-simple.S
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/kexec/arch/mipsel/mipsel-setup-simple.S       
2007-06-01 23:34:19.000000000 +0200
@@ -0,0 +1,110 @@
+/*
+ * mipsel-setup-simple.S - code to execute before kernel to handle command 
line
+ * Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
+ * Copyright (C) 2007 Tvblob s.r.l.
+ *
+ * derived from Albert Herranz idea (ppc) adding command line support
+ * (boot_notes structure)
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2.  See the file COPYING for more details.
+ */
+
+/*
+ * Only suitable for platforms booting with MMU turned off.
+ * -- Albert Herranz
+ */
+#include "regdef.h"
+
+/* returns  t0 = relocated address of sym */
+/* modifies t1 t2 */
+/* sym must not be global or this will not work (at least AFAIK up to now) */
+#define RELOC_SYM(sym)                                                 \
+       move    t0,ra;          /* save ra */                           \
+       bal 1f;                                                         \
+1:                                                                     \
+       move    t1,ra;          /* now t1 is 1b (where we are now) */   \
+       move    ra,t0;          /* restore ra */                        \
+       lui     t2,%hi(1b);                                             \
+       ori     t2,t2,%lo(1b);                                          \
+       lui     t0,%hi(sym);                                            \
+       ori     t0,t0,%lo(sym);                                         \
+       sub     t0,t0,t2;       /* t0 = offset between sym and 1b */    \
+       add     t0,t1,t0;       /* t0 = actual address in memory */
+
+       .data
+       .globl setup_simple_start
+setup_simple_start:
+
+       /* should perform here any required setup */
+
+        /* Initialize GOT pointer (verify if needed) */
+        bal     1f
+        nop
+        .word   _GLOBAL_OFFSET_TABLE_
+        1:
+        move    gp, ra
+        lw      t1, 0(ra)
+        move    gp, t1
+
+       /* spr8 relocation */
+       RELOC_SYM(spr8)
+
+       move    t4,t0           // save pointer to kernel start addr
+       lw      t3,0(t0)        // save kernel start address
+
+       /* spr9 relocation */
+       RELOC_SYM(spr9)
+       lw      a0,0(t0)        // load argc
+
+       // this code is to be changed if boot_notes struct changes
+       lw      t2,12(t4)       // t2 is size of boot_notes struct
+       addi    t2,t2,3
+       srl     t2,t2,2
+       sll     v1,t2,2         // v1 = size of boot_notes struct
+                               // aligned to word boundary
+
+       addi    t0,t4,0x20      // t0 contains the address of "kexec" string
+       add     v0,t4,v1        // v0 points to last word of boot_notes
+       addi    v0,v0,8         // v0 points to address after boot_notes
+       sw      t0,0(v0)        // store pointer to "kexec" string there
+
+       lw      t2,-8(t0)       // t2 is size of "kexec" string in bytes
+       addi    t2,t2,3
+       srl     t2,t2,2
+       sll     v1,t2,2         // v1 = size of "kexec" string
+                               // aligned to word boundary
+       add     t2,t0,v1
+       addi    t0,t2,4         // t0 points to size of version string
+
+       lw      t2,0(t0)        // t2 is size of version string in bytes
+       addi    t2,t2,3
+       srl     t2,t2,2
+       sll     v1,t2,2         // v1 = size of version string
+                               // aligned to word boundary
+
+       addi    t0,t0,8         // t0 points to version string
+       add     t0,t0,v1        // t0 points to start of command_line record
+       addi    t0,t0,12        // t0 points command line
+
+       sw      t0,4(v0)        // store pointer to command line
+
+       move    a1,v0           // load argv
+       li      a2,0
+       li      a3,0
+
+       jr      t3
+       nop
+
+       .balign 4
+       .globl setup_simple_regs
+setup_simple_regs:
+spr8:   .long 0x00000000
+spr9:   .long 0x00000000
+
+setup_simple_end:
+
+       .globl setup_simple_size
+setup_simple_size:
+       .long setup_simple_end - setup_simple_start
+
Index: kexec-tools-testing-20070330/kexec/crashdump.c
===================================================================
--- kexec-tools-testing-20070330.orig/kexec/crashdump.c 2007-03-30 
06:34:36.000000000 +0200
+++ kexec-tools-testing-20070330/kexec/crashdump.c      2007-05-15 
11:47:03.000000000 +0200
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <errno.h>
 #include <limits.h>
+#include <linux/limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
Index: kexec-tools-testing-20070330/kexec/kexec.c
===================================================================
--- kexec-tools-testing-20070330.orig/kexec/kexec.c     2007-03-30 
06:34:36.000000000 +0200
+++ kexec-tools-testing-20070330/kexec/kexec.c  2007-05-18 10:53:49.000000000 
+0200
@@ -3,6 +3,8 @@
  *
  * Copyright (C) 2003-2005  Eric Biederman (ebiederm@xmission.com)
  *
+ * Modified (2007-05-15) by Francesco Chiechi to rudely handle mips platform
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation (version 2 of the License).
@@ -39,6 +41,10 @@
 #include "kexec-sha256.h"
 #include <arch/options.h>

+#ifdef __MIPSEL__
+#define virt_to_phys(X) ((X) - 0x80000000)
+#endif
+
 unsigned long long mem_min = 0;
 unsigned long long mem_max = ULONG_MAX;

@@ -286,6 +292,74 @@
        unsigned long last;
        size_t size;
        int pagesize;
+#ifdef __MIPSEL__
+       unsigned long base_phys;
+#endif
+
+       if (bufsz > memsz) {
+               bufsz = memsz;
+       }
+       /* Forget empty segments */
+       if (memsz == 0) {
+               return;
+       }
+
+       /* Round memsz up to a multiple of pagesize */
+       pagesize = getpagesize();
+       memsz = (memsz + (pagesize - 1)) & ~(pagesize - 1);
+
+#ifdef __MIPSEL__
+       base_phys=virt_to_phys(base);
+#endif
+       /* Verify base is pagesize aligned.
+        * Finding a way to cope with this problem
+        * is important but for now error so at least
+        * we are not surprised by the code doing the wrong
+        * thing.
+        */
+       if (base & (pagesize -1)) {
+               die("Base address: %x is not page aligned\n", base);
+       }
+
+#ifdef __MIPSEL__
+       last = base_phys + memsz -1;
+       if (!valid_memory_range(info, base_phys, last)) {
+               die("Invalid memory segment %p - %p\n",
+                       (void *)base_phys, (void *)last);
+       }
+#else
+       last = base + memsz -1;
+       if (!valid_memory_range(info, base, last)) {
+               die("Invalid memory segment %p - %p\n",
+                       (void *)base, (void *)last);
+       }
+#endif
+
+       size = (info->nr_segments + 1) * sizeof(info->segment[0]);
+       info->segment = xrealloc(info->segment, size);
+       info->segment[info->nr_segments].buf   = buf;
+       info->segment[info->nr_segments].bufsz = bufsz;
+#ifdef __MIPSEL__
+       info->segment[info->nr_segments].mem   = (void *)base_phys;
+#else
+       info->segment[info->nr_segments].mem   = (void *)base;
+#endif
+       info->segment[info->nr_segments].memsz = memsz;
+       info->nr_segments++;
+       if (info->nr_segments > KEXEC_MAX_SEGMENTS) {
+               fprintf(stderr, "Warning: kernel segment limit reached. "
+                       "This will likely fail\n");
+       }
+}
+
+#ifdef __MIPSEL__
+void add_segment_virt(struct kexec_info *info,
+       const void *buf, size_t bufsz,
+       unsigned long base, size_t memsz)
+{
+       unsigned long last;
+       size_t size;
+       int pagesize;

        if (bufsz > memsz) {
                bufsz = memsz;
@@ -327,6 +401,7 @@
                        "This will likely fail\n");
        }
 }
+#endif

 unsigned long add_buffer(struct kexec_info *info,
        const void *buf, unsigned long bufsz, unsigned long memsz,
@@ -355,6 +430,35 @@
        return base;
 }

+#ifdef __MIPSEL__
+unsigned long add_buffer_virt(struct kexec_info *info,
+       const void *buf, unsigned long bufsz, unsigned long memsz,
+       unsigned long buf_align, unsigned long buf_min, unsigned long buf_max,
+       int buf_end)
+{
+       unsigned long base;
+       int result;
+       int pagesize;
+
+       result = sort_segments(info);
+       if (result < 0) {
+               die("sort_segments failed\n");
+       }
+
+       /* Round memsz up to a multiple of pagesize */
+       pagesize = getpagesize();
+       memsz = (memsz + (pagesize - 1)) & ~(pagesize - 1);
+
+       base = locate_hole(info, memsz, buf_align, buf_min, buf_max, buf_end);
+       if (base == ULONG_MAX) {
+               die("locate_hole failed\n");
+       }
+
+       add_segment_virt(info, buf, bufsz, base, memsz);
+       return base;
+}
+#endif
+
 char *slurp_file(const char *filename, off_t *r_size)
 {
        int fd;
Index: kexec-tools-testing-20070330/kexec/kexec-syscall.h
===================================================================
--- kexec-tools-testing-20070330.orig/kexec/kexec-syscall.h     2007-03-30 
06:34:36.000000000 +0200
+++ kexec-tools-testing-20070330/kexec/kexec-syscall.h  2007-05-15 
11:47:03.000000000 +0200
@@ -46,6 +46,9 @@
 #ifdef __s390__
 #define __NR_kexec_load                277
 #endif
+#ifdef __MIPSEL__
+#define __NR_kexec_load                4311
+#endif
 #ifndef __NR_kexec_load
 #error Unknown processor architecture.  Needs a kexec_load syscall number.
 #endif
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/console-mipsel.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/console-mipsel.c 
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,5 @@
+#include <purgatory.h>
+void putchar(int ch)
+{
+       /* Nothing for now */
+}
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/include/limits.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/include/limits.h 
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,58 @@
+#ifndef LIMITS_H
+#define LIMITS_H       1
+
+
+/* Number of bits in a `char' */
+#define CHAR_BIT       8
+
+/* Minimum and maximum values a `signed char' can hold */
+#define SCHAR_MIN      (-128)
+#define SCHAR_MAX      127
+
+/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
+#define UCHAR_MAX      255
+
+/* Minimum and maximum values a `char' can hold */
+#define CHAR_MIN       SCHAR_MIN
+#define CHAR_MAX       SCHAR_MAX
+
+/* Minimum and maximum values a `signed short int' can hold */
+#define SHRT_MIN       (-32768)
+#define SHRT_MAX       32767
+
+/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
+#define USHRT_MAX      65535
+
+
+/* Minimum and maximum values a `signed int' can hold */
+#define INT_MIN                (-INT_MAX - 1)
+#define INT_MAX                2147483647
+
+/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
+#define UINT_MAX       4294967295U
+
+
+/* Minimum and maximum values a `signed int' can hold */
+#define INT_MIN                (-INT_MAX - 1)
+#define INT_MAX                2147483647
+
+/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
+#define UINT_MAX       4294967295U
+
+/* Minimum and maximum values a `signed long' can hold */
+#define LONG_MAX       2147483647L
+#define LONG_MIN       (-LONG_MAX - 1L)
+
+/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
+#define ULONG_MAX      4294967295UL
+
+/* Minimum and maximum values a `signed long long' can hold */
+#define LLONG_MAX      9223372036854775807LL
+#define LLONG_MIN      (-LONG_MAX - 1LL)
+
+
+/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
+#define ULLONG_MAX     18446744073709551615ULL
+
+
+#endif /* LIMITS_H */
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/include/stdint.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/include/stdint.h 
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,16 @@
+#ifndef STDINT_H
+#define STDINT_H
+
+typedef unsigned long      size_t;
+
+typedef unsigned char      uint8_t;
+typedef unsigned short     uint16_t;
+typedef unsigned int       uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char        int8_t;
+typedef signed short       int16_t;
+typedef signed int         int32_t;
+typedef signed long long   int64_t;
+
+#endif /* STDINT_H */
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/Makefile
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/Makefile 2007-05-18 
11:06:34.000000000 +0200
@@ -0,0 +1,7 @@
+#
+# Purgatory mipsel
+#
+
+PURGATORY_C_SRCS+= purgatory/arch/mipsel/purgatory-mipsel.c
+PURGATORY_C_SRCS+= purgatory/arch/mipsel/console-mipsel.c
+
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/purgatory-mipsel.c
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/purgatory-mipsel.c      
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,7 @@
+#include <purgatory.h>
+#include "purgatory-mipsel.h"
+
+void setup_arch(void)
+{
+       /* Nothing for now */
+}
Index: kexec-tools-testing-20070330/purgatory/arch/mipsel/purgatory-mipsel.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ kexec-tools-testing-20070330/purgatory/arch/mipsel/purgatory-mipsel.h      
2007-05-15 11:47:03.000000000 +0200
@@ -0,0 +1,6 @@
+#ifndef PURGATORY_MIPSEL_H
+#define PURGATORY_MIPSEL_H
+
+/* nothing yet */
+
+#endif /* PURGATORY_MIPSEL_H */

_______________________________________________
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] kexec tools mipsel port
  2007-06-01 22:21 francesco chiechi
@ 2007-06-04  5:40 ` Horms
  2007-06-21  7:52   ` francesco chiechi
  0 siblings, 1 reply; 10+ messages in thread
From: Horms @ 2007-06-04  5:40 UTC (permalink / raw)
  To: francesco chiechi; +Cc: Alessandro Rubini, kexec

On Sat, Jun 02, 2007 at 12:21:38AM +0200, francesco chiechi wrote:
> Hello,
> 
> We developed a patch to port kexec-tools to mips arch and included
> support for command line passing through elf boot notes.  We did it
> for a customer of ours on a specific platform derived from toshiba
> tx4938 (so we think it should work at least for tx4938 evaluation
> board also).  We would like to contribute it in case somebody else
> needs it or wants to improve it.  This patch works for us but the
> assembler part in particular, should be considered as a starting point
> because my assembly knowledge is not too deep.
> 
> As this is the first time I submit a patch I tried to guess reading
> tpp.txt if this is the right way to submit. Please let me know about
> any mistakes I may have made.

Hi Francesco,

thanks for the patch. Sending them to this list is indeed the right
thing to do. You can also CC me (who makes the commits) to be sure
to get my attention.

I'm curious to about all the #ifdef __MIPSEL__ stuff in kexec.c.
Is there no chance that couldn't be placed somewhere in /kexec/arch/mipsel
somehow? kexec is a bit hapazard in parts, but generally there
isn't much #ifdef ARCH foo in there and we try and keep
architecture-specific and generic code separated.

Two other minor things:

* please patch configure.ac, not configure

* please provide a signed-off-by line, which is described at 
  http://linux.yyz.us/patch-format.html amongst other places.

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
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] kexec tools mipsel port
  2007-06-04  5:40 ` Horms
@ 2007-06-21  7:52   ` francesco chiechi
  2007-06-26  5:31     ` Milton Miller
  0 siblings, 1 reply; 10+ messages in thread
From: francesco chiechi @ 2007-06-21  7:52 UTC (permalink / raw)
  To: kexec; +Cc: Alessandro Rubini, Horms

On Monday 04 June 2007 07:40, Horms wrote:
> On Sat, Jun 02, 2007 at 12:21:38AM +0200, francesco chiechi wrote:
> > Hello,
> >
> > We developed a patch to port kexec-tools to mips arch and included
> > support for command line passing through elf boot notes.  We did it
> > for a customer of ours on a specific platform derived from toshiba
> > tx4938 (so we think it should work at least for tx4938 evaluation
> > board also).  We would like to contribute it in case somebody else
> > needs it or wants to improve it.  This patch works for us but the
> > assembler part in particular, should be considered as a starting point
> > because my assembly knowledge is not too deep.
> >
> > As this is the first time I submit a patch I tried to guess reading
> > tpp.txt if this is the right way to submit. Please let me know about
> > any mistakes I may have made.
>
> Hi Francesco,

Hi Horms,

sorry about the long delay in my reply

> thanks for the patch. Sending them to this list is indeed the right
> thing to do. You can also CC me (who makes the commits) to be sure
> to get my attention.
>
> I'm curious to about all the #ifdef __MIPSEL__ stuff in kexec.c.
> Is there no chance that couldn't be placed somewhere in /kexec/arch/mipsel
> somehow? kexec is a bit hapazard in parts, but generally there
> isn't much #ifdef ARCH foo in there and we try and keep
> architecture-specific and generic code separated.

I am aware of this problem but I did not find a more appropriate way to solve 
this. This has something to to with the way mips handles virtual addresses.
I will retry to fix this as soon as I have some time

> Two other minor things:
>
> * please patch configure.ac, not configure
>
> * please provide a signed-off-by line, which is described at
>   http://linux.yyz.us/patch-format.html amongst other places.

should I resend the patch or you say these for future reference?

thank you again

Francesco

_______________________________________________
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] kexec tools mipsel port
  2007-06-21  7:52   ` francesco chiechi
@ 2007-06-26  5:31     ` Milton Miller
  0 siblings, 0 replies; 10+ messages in thread
From: Milton Miller @ 2007-06-26  5:31 UTC (permalink / raw)
  To: francesco chiechi; +Cc: Simon Horman, kexec

On Thu Jun 21 03:52:19 EDT 2007, francesco chiechi wrote:
> On Monday 04 June 2007 07:40, Horms wrote:
>> On Sat, Jun 02, 2007 at 12:21:38AM +0200, francesco chiechi wrote:
>>> Hello,
>>>
>>> We developed a patch to port kexec-tools to mips arch and included
>>> support for command line passing through elf boot notes.  We did it
>>> for a customer of ours on a specific platform derived from toshiba
>>> tx4938 (so we think it should work at least for tx4938 evaluation
>>> board also).  We would like to contribute it in case somebody else
>>> needs it or wants to improve it.  This patch works for us but the
>>> assembler part in particular, should be considered as a starting 
>>> point
>>> because my assembly knowledge is not too deep.
>>>
>>
>> I'm curious to about all the #ifdef __MIPSEL__ stuff in kexec.c.
>> Is there no chance that couldn't be placed somewhere in 
>> /kexec/arch/mipsel
>> somehow? kexec is a bit hapazard in parts, but generally there
>> isn't much #ifdef ARCH foo in there and we try and keep
>> architecture-specific and generic code separated.
>
> I am aware of this problem but I did not find a more appropriate way 
> to solve
> this. This has something to to with the way mips handles virtual 
> addresses.
> I will retry to fix this as soon as I have some time

Looking at your patch, you seem to use this _virt stuff to hold the 
argument buffers.

(1) Why do you need to allocate the buffer virtual in the generic code? 
   Just allocate the physical space, and do the translation from 
physical to virtual in the architecture code.

(2) Most ports enter purgatory with translation off.  I'm not familiar 
with MIPS, but did you consider doing this?  Your final kernel exit 
shouldn't be providing more environment than specified by the user 
code.  Don't assume the new code will be a Linux kernel.

The design of kexec is the kernel exit to userspace in a very basic 
state.  The system call provides for specifying memory contents to be 
placed at specified locations and an address to start execution.  In 
most ports, the kernel tuns off the mmu, copies the new kernel into 
place, and enters the user space supplied code in real mode.   This 
code, usually called relocate_new_kernel, is position independent (or 
is patched by the kernel exit), self-contained, and actually run from 
some address allocated in a hole of the user supplied code[1].  It is 
expected that  userspace (kexec-tools) will provide a trampoline to get 
from this basic machine state to and environment to run purgatory, then 
setup what the loaded code (new kernel) expects, including loading 
values or pointers in registers and performing any needed fixups to 
data structures.


[1]  64 bit powerpc is split somewhat differently because only a small 
fraction of memory is reachable in real mode.  We copy before killing 
the mmu.  This requires special considerations to keep the mmu alive 
during the copy.  I've written a few emails on this topic; I need to 
gather them and write a file for Documentation/).

milton


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] kexec tools mipsel port
@ 2008-02-16 11:50 Tomasz Chmielewski
  2008-02-16 16:33 ` Simon Horman
  0 siblings, 1 reply; 10+ messages in thread
From: Tomasz Chmielewski @ 2008-02-16 11:50 UTC (permalink / raw)
  To: Kexec Mailing List, Horms, francesco.chiechi

>> We developed a patch to port kexec-tools to mips arch and included
>> support for command line passing through elf boot notes.  We did it
>> for a customer of ours on a specific platform derived from toshiba
>> tx4938 (so we think it should work at least for tx4938 evaluation
>> board also).  We would like to contribute it in case somebody else
>> needs it or wants to improve it.  This patch works for us but the
>> assembler part in particular, should be considered as a starting point
>> because my assembly knowledge is not too deep.
>
> thanks for the patch. Sending them to this list is indeed the right
> thing to do. You can also CC me (who makes the commits) to be sure
> to get my attention.

Hi,

There was a thread about kexec-tools mipsel port on Kexec Mailing List 
in June 2007.

What's the current state of this patch?

Is it working, will be merged, will not be merged?


-- 
Tomasz Chmielewski
http://wpkg.org


_______________________________________________
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] kexec tools mipsel port
  2008-02-16 11:50 [PATCH] kexec tools mipsel port Tomasz Chmielewski
@ 2008-02-16 16:33 ` Simon Horman
  2008-02-16 20:31   ` Tomasz Chmielewski
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Horman @ 2008-02-16 16:33 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: francesco.chiechi, Kexec Mailing List

On Sat, Feb 16, 2008 at 12:50:25PM +0100, Tomasz Chmielewski wrote:
>>> We developed a patch to port kexec-tools to mips arch and included
>>> support for command line passing through elf boot notes.  We did it
>>> for a customer of ours on a specific platform derived from toshiba
>>> tx4938 (so we think it should work at least for tx4938 evaluation
>>> board also).  We would like to contribute it in case somebody else
>>> needs it or wants to improve it.  This patch works for us but the
>>> assembler part in particular, should be considered as a starting point
>>> because my assembly knowledge is not too deep.
>>
>> thanks for the patch. Sending them to this list is indeed the right
>> thing to do. You can also CC me (who makes the commits) to be sure
>> to get my attention.
>
> Hi,
>
> There was a thread about kexec-tools mipsel port on Kexec Mailing List  
> in June 2007.
>
> What's the current state of this patch?
>
> Is it working, will be merged, will not be merged?

Its still very much in the state of needing someone to
nurse it into a merge.

-- 
Horms


_______________________________________________
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] kexec tools mipsel port
  2008-02-16 16:33 ` Simon Horman
@ 2008-02-16 20:31   ` Tomasz Chmielewski
  2008-02-17  1:41     ` Tomasz Chmielewski
  2008-02-17  4:56     ` Simon Horman
  0 siblings, 2 replies; 10+ messages in thread
From: Tomasz Chmielewski @ 2008-02-16 20:31 UTC (permalink / raw)
  To: Simon Horman; +Cc: francesco.chiechi, Kexec Mailing List

Simon Horman schrieb:
> On Sat, Feb 16, 2008 at 12:50:25PM +0100, Tomasz Chmielewski wrote:
>>>> We developed a patch to port kexec-tools to mips arch and included
>>>> support for command line passing through elf boot notes.  We did it

(...)

>> There was a thread about kexec-tools mipsel port on Kexec Mailing List  
>> in June 2007.
>>
>> What's the current state of this patch?
>>
>> Is it working, will be merged, will not be merged?
> 
> Its still very much in the state of needing someone to
> nurse it into a merge.

Funny thing is, kernel supports kexec, but there is no userland support 
for it (well, unless you patch kexec-tools with the patches you found 
somewhere on the internet).

I'll try to see if the old patches posted to this list work for me.


-- 
Tomasz Chmielewski
http://wpkg.org

_______________________________________________
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] kexec tools mipsel port
  2008-02-16 20:31   ` Tomasz Chmielewski
@ 2008-02-17  1:41     ` Tomasz Chmielewski
  2008-02-17  4:56     ` Simon Horman
  1 sibling, 0 replies; 10+ messages in thread
From: Tomasz Chmielewski @ 2008-02-17  1:41 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: francesco.chiechi, Simon Horman, Kexec Mailing List

Tomasz Chmielewski schrieb:

(...)

>>> There was a thread about kexec-tools mipsel port on Kexec Mailing 
>>> List  in June 2007.
>>>
>>> What's the current state of this patch?
>>>
>>> Is it working, will be merged, will not be merged?
>>
>> Its still very much in the state of needing someone to
>> nurse it into a merge.
> 
> Funny thing is, kernel supports kexec, but there is no userland support 
> for it (well, unless you patch kexec-tools with the patches you found 
> somewhere on the internet).
> 
> I'll try to see if the old patches posted to this list work for me.

Well, it's not very encouraging:


# kexec -l vmlinux-2.6.23.1
# kexec -e
Starting new kernel
Will call new kernel at 002ca000
Bye ...


And that's about it.

Do I need to specify mem-min and/or mem-max on mipsel?



-- 
Tomasz Chmielewski
http://wpkg.org

_______________________________________________
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] kexec tools mipsel port
  2008-02-16 20:31   ` Tomasz Chmielewski
  2008-02-17  1:41     ` Tomasz Chmielewski
@ 2008-02-17  4:56     ` Simon Horman
  2008-02-17 22:05       ` Francesco Chiechi
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Horman @ 2008-02-17  4:56 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: francesco.chiechi, Kexec Mailing List

On Sat, Feb 16, 2008 at 09:31:34PM +0100, Tomasz Chmielewski wrote:
> Simon Horman schrieb:
>> On Sat, Feb 16, 2008 at 12:50:25PM +0100, Tomasz Chmielewski wrote:
>>>>> We developed a patch to port kexec-tools to mips arch and included
>>>>> support for command line passing through elf boot notes.  We did it
>
> (...)
>
>>> There was a thread about kexec-tools mipsel port on Kexec Mailing 
>>> List  in June 2007.
>>>
>>> What's the current state of this patch?
>>>
>>> Is it working, will be merged, will not be merged?
>>
>> Its still very much in the state of needing someone to
>> nurse it into a merge.
>
> Funny thing is, kernel supports kexec, but there is no userland support  
> for it (well, unless you patch kexec-tools with the patches you found  
> somewhere on the internet).
>
> I'll try to see if the old patches posted to this list work for me.

I'm quite happy to accept patches to add mipsel to kexec-tools
(for the kexec-tools-testing tree that I maintain) and include
it in the next release.

The problem is that I'm not sure what state the patches are in.

-- 
Horms


_______________________________________________
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] kexec tools mipsel port
  2008-02-17  4:56     ` Simon Horman
@ 2008-02-17 22:05       ` Francesco Chiechi
  0 siblings, 0 replies; 10+ messages in thread
From: Francesco Chiechi @ 2008-02-17 22:05 UTC (permalink / raw)
  To: kexec; +Cc: Simon Horman, Tomasz Chmielewski

On Sunday 17 February 2008 05:56:36 Simon Horman wrote:
> On Sat, Feb 16, 2008 at 09:31:34PM +0100, Tomasz Chmielewski wrote:
> > Simon Horman schrieb:
> >> On Sat, Feb 16, 2008 at 12:50:25PM +0100, Tomasz Chmielewski wrote:
> >>>>> We developed a patch to port kexec-tools to mips arch and included
> >>>>> support for command line passing through elf boot notes.  We did it
> >
> > (...)
> >
> >>> There was a thread about kexec-tools mipsel port on Kexec Mailing
> >>> List  in June 2007.
> >>>
> >>> What's the current state of this patch?
> >>>
> >>> Is it working, will be merged, will not be merged?
> >>
> >> Its still very much in the state of needing someone to
> >> nurse it into a merge.
> >
> > Funny thing is, kernel supports kexec, but there is no userland support
> > for it (well, unless you patch kexec-tools with the patches you found
> > somewhere on the internet).
> >
> > I'll try to see if the old patches posted to this list work for me.
>
> I'm quite happy to accept patches to add mipsel to kexec-tools
> (for the kexec-tools-testing tree that I maintain) and include
> it in the next release.
>
> The problem is that I'm not sure what state the patches are in.

Hi,

I'm really sorry because I did not have time to work again on the patch, which 
I confirm is working for the application we developed it for.

There were surely a couple of problems that made it difficult to be for 
general use:

the first (probably simple to solve) is about physical/virtual mapping, Simon 
suggestion was about removing #ifdef __MIPSEL__ stuff in kexec.c

the second, a bit harder (for me at least), is that I had to insert cache 
flushing code in kexec tools assembly part because leaving the job to the 
kernel did not work

I don't know if I will have time for it in the near future because it implies 
quite a bit of studying for me... anyway I'll keep an eye on it but I cannot 
promise

bye

Francesco


_______________________________________________
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:[~2008-02-17 22:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-16 11:50 [PATCH] kexec tools mipsel port Tomasz Chmielewski
2008-02-16 16:33 ` Simon Horman
2008-02-16 20:31   ` Tomasz Chmielewski
2008-02-17  1:41     ` Tomasz Chmielewski
2008-02-17  4:56     ` Simon Horman
2008-02-17 22:05       ` Francesco Chiechi
  -- strict thread matches above, loose matches on Subject: below --
2007-06-01 22:21 francesco chiechi
2007-06-04  5:40 ` Horms
2007-06-21  7:52   ` francesco chiechi
2007-06-26  5:31     ` Milton Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.