Intention to merge mipsel into kexec-tools-testing
Subsystems (3)
cover Intention to merge mipsel into kexec-tools-testing
Hi,
Using qemu I have been able to satisfy myself that Francesco Chiechi's patch to add mipsel to kexec-tools works.
I have upported this patch and made various cosmetic changes too it, as per this series of patches. I intend to merge these patches.
One thing that clearly needs further work is the handling of the command line passed to the second kernel. In preamble to his patch Francesco makes mention that his patch uses elf boot nodes to pass the command line. Inspection of the code reflects this.
However in my limited understanding this only supports a subset of mipsel hardware. In particular, I notice that it does not use qemu. I wonder if ultimately kexec-tools will need a --machine or --boot-protocol parameter or something of that nature.
Signature · 6 lines
Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/12 kexec-tools: mipsel: mipsel port
From: Francesco Chiechi <[email protected]>
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.
---
Wed, 27 Feb 2008 19:25:00 +0900
* Simon Horman <[email protected]>
- Upported to 20080227 release
- Note the #ifdef __MIPSEL__ stuff needs to be moved into kexec/arch/mipsel
Thu, 06 Mar 2008 18:19:22 +0900
* Simon Horman <[email protected]>
- Use tabs for indentation
configure.ac | 2 kexec/arch/mipsel/Makefile | 7 + kexec/arch/mipsel/include/arch/options.h | 11 + kexec/arch/mipsel/kexec-elf-mipsel.c | 184 ++++++++++++++++++++++++++++++ kexec/arch/mipsel/kexec-elf-rel-mipsel.c | 42 ++++++ kexec/arch/mipsel/kexec-mipsel.c | 167 +++++++++++++++++++++++++++ kexec/arch/mipsel/kexec-mipsel.h | 17 ++ kexec/arch/mipsel/mipsel-setup-simple.S | 110 +++++++++++++++++ kexec/crashdump.c | 1 kexec/kexec-syscall.h | 3 kexec/kexec.c | 104 ++++++++++++++++ purgatory/arch/mipsel/Makefile | 7 + purgatory/arch/mipsel/console-mipsel.c | 5 purgatory/arch/mipsel/include/limits.h | 58 +++++++++ purgatory/arch/mipsel/include/stdint.h | 16 ++ purgatory/arch/mipsel/purgatory-mipsel.c | 7 + purgatory/arch/mipsel/purgatory-mipsel.h | 6 17 files changed, 746 insertions(+), 1 deletion(-)
configure.ac +1 -1
@@ -38,7 +38,7 @@ case $target_cpu in sh4|sh4a|sh3|sh ) ARCH="sh" ;; - ia64|x86_64|alpha ) + ia64|x86_64|alpha|mipsel ) ARCH="$target_cpu" ;; * )
kexec/arch/mipsel/Makefile new file +7 -0
@@ -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
kexec/arch/mipsel/include/arch/options.h new file +11 -0
@@ -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 */
kexec/arch/mipsel/kexec-elf-mipsel.c new file +184 -0
184 lines not on this page · raw message
kexec/arch/mipsel/kexec-elf-rel-mipsel.c new file +42 -0
42 lines not on this page · raw message
kexec/arch/mipsel/kexec-mipsel.c new file +167 -0
167 lines not on this page · raw message
kexec/arch/mipsel/kexec-mipsel.h new file +17 -0
@@ -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 */
kexec/arch/mipsel/mipsel-setup-simple.S new file +110 -0
110 lines not on this page · raw message
kexec/crashdump.c +1 -0
@@ -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>
kexec/kexec-syscall.h +3 -0
@@ -49,6 +49,9 @@#ifdef __arm__#define __NR_kexec_load __NR_SYSCALL_BASE + 347#endif +#ifdef __MIPSEL__ +#define __NR_kexec_load 4311 +#endif #ifndef __NR_kexec_load#error Unknown processor architecture. Needs a kexec_load syscall number.#endif
kexec/kexec.c +104 -0
134 lines not on this page · raw message
purgatory/arch/mipsel/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Purgatory mipsel +# + +PURGATORY_C_SRCS+= purgatory/arch/mipsel/purgatory-mipsel.c +PURGATORY_C_SRCS+= purgatory/arch/mipsel/console-mipsel.c +
purgatory/arch/mipsel/console-mipsel.c new file +5 -0
@@ -0,0 +1,5 @@ +#include <purgatory.h> +void putchar (int ch) +{ +/* Nothing for now */ +}
purgatory/arch/mipsel/include/limits.h new file +58 -0
58 lines not on this page · raw message
purgatory/arch/mipsel/include/stdint.h new file +16 -0
@@ -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 */
purgatory/arch/mipsel/purgatory-mipsel.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <purgatory.h> +#include "purgatory-mipsel.h" + +void setup_arch (void ) +{ +/* Nothing for now */ +}
purgatory/arch/mipsel/purgatory-mipsel.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef PURGATORY_MIPSEL_H +#define PURGATORY_MIPSEL_H + +/* nothing yet */ + +#endif /* PURGATORY_MIPSEL_H */
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/12 kexec-tools: mipsel: Remove purgatory/arch/mipsel/include/stdint.h
In reply to Simon HormanRemove purgatory/arch/mipsel/include/stdint.h as it just duplicates things found in system header files.
---
purgatory/arch/mipsel/include/stdint.h | 16 ---------------- 1 file changed, 16 deletions(-)
purgatory/arch/mipsel/include/stdint.h deleted +0 -16
@@ -1,16 +0,0 @@ -#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 */
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/12 kexec-tools: mipsel: Update mipsel port for recent build changes
In reply to Simon Horman---
kexec/Makefile | 1 + kexec/arch/mipsel/Makefile | 13 +++++++++---- purgatory/Makefile | 1 + purgatory/arch/mipsel/Makefile | 8 ++++++-- 4 files changed, 17 insertions(+), 6 deletions(-)
kexec/Makefile +1 -0
@@ -33,6 +33,7 @@ include $(srcdir)/kexec/arch/alpha/Makef include $(srcdir)/kexec/arch/arm/Makefile include $(srcdir)/kexec/arch/i386/Makefile include $(srcdir)/kexec/arch/ia64/Makefile +include $(srcdir)/kexec/arch/mipsel/Makefile include $(srcdir)/kexec/arch/ppc/Makefile include $(srcdir)/kexec/arch/ppc64/Makefile include $(srcdir)/kexec/arch/s390/Makefile
kexec/arch/mipsel/Makefile +9 -4
@@ -1,7 +1,12 @@ # # 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 +mipsel_KEXEC_SRCS = kexec/arch/mipsel/kexec-mipsel.c +mipsel_KEXEC_SRCS += kexec/arch/mipsel/kexec-elf-mipsel.c +mipsel_KEXEC_SRCS += kexec/arch/mipsel/kexec-elf-rel-mipsel.c +mipsel_KEXEC_SRCS += kexec/arch/mipsel/mipsel-setup-simple.S + +dist += kexec/arch/mipsel/Makefile $(mipsel_KEXEC_SRCS) \ + kexec/arch/mipsel/kexec-mipsel.h \ + kexec/arch/mipsel/include/arch/options.h +
purgatory/Makefile +1 -0
@@ -20,6 +20,7 @@ include $(srcdir)/purgatory/arch/alpha/M include $(srcdir)/purgatory/arch/arm/Makefile include $(srcdir)/purgatory/arch/i386/Makefile include $(srcdir)/purgatory/arch/ia64/Makefile +include $(srcdir)/purgatory/arch/mipsel/Makefile include $(srcdir)/purgatory/arch/ppc/Makefile include $(srcdir)/purgatory/arch/ppc64/Makefile include $(srcdir)/purgatory/arch/s390/Makefile
purgatory/arch/mipsel/Makefile +6 -2
@@ -2,6 +2,10 @@ # Purgatory mipsel # -PURGATORY_C_SRCS+= purgatory/arch/mipsel/purgatory-mipsel.c -PURGATORY_C_SRCS+= purgatory/arch/mipsel/console-mipsel.c +mipsel_PURGATORY_C_SRCS+= purgatory/arch/mipsel/purgatory-mipsel.c +mipsel_PURGATORY_C_SRCS+= purgatory/arch/mipsel/console-mipsel.c + +dist += purgatory/arch/mipsel/Makefile $(mipsel_PURGATORY_C_SRCS) \ + purgatory/arch/mipsel/include/limits.h \ + purgatory/arch/mipsel/purgatory-mipsel.h
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 4/12 kexec-tools: mipsel: Remove duplication declaration of BOOTLOADER_VERSION
In reply to Simon HormanBOOTLOADER_VERSION is defined in kexec.h
---
kexec/arch/mipsel/kexec-elf-mipsel.c | 1 - 1 file changed, 1 deletion(-)
kexec/arch/mipsel/kexec-elf-mipsel.c +0 -1
@@ -32,7 +32,6 @@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)
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 5/12 kexec-tools: mipsel: Remove #ifdef __MIPSEL__ from kexec/kexec.c
In reply to Simon HormanOn all architectures except mipsel add_buffer() expects add_segment() to work with the virtual address passed. On mipsel it is expected that add_segment() converts the virtual address to a physical address first. add_buffer_virt() is porvided on mipsel for the handful of cases that don't want the address to be converted.
This patch maintains that behaviour, but without the need for #ifdef __MIPSEL__ from kexec/kexec.c and much duplicated code.
---
kexec/arch/mipsel/kexec-mipsel.c | 26 +++++++ kexec/kexec.c | 137 +++++++++----------------------------- kexec/kexec.h | 9 ++ 3 files changed, 71 insertions(+), 101 deletions(-)
kexec/arch/mipsel/kexec-mipsel.c +26 -0
@@ -165,3 +165,29 @@ int is_crashkernel_mem_reserved(void)return 1 ; } +unsigned long virt_to_phys (unsigned long addr) +{ +return addr -0x80000000 ; +} + +/* +* add_segment() should convert base to a physical address on mipsel, +* while the default is just to work with base as is */ +void add_segment (struct kexec_info *info,const void *buf,size_t bufsz, +unsigned long base,size_t memsz) +{ +add_segment_phys_virt (info, buf, bufsz, base, memsz,1 ); +} + +/* +* add_buffer() should convert base to a physical address on mipsel, +* while the default is just to work with base as is */ +unsigned long add_buffer (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) +{ +return add_buffer_phys_virt (info, buf, bufsz, memsz, buf_align, + buf_min, buf_max, buf_end,1 ); +} +
kexec/kexec.c +36 -101
199 lines not on this page · raw message
kexec/kexec.h +12 -0
@@ -188,12 +188,24 @@ extern void *xrealloc(void *ptr, size_textern char *slurp_file (const char *filename,off_t *r_size);extern char *slurp_file_len (const char *filename,off_t size);extern char *slurp_decompress_file (const char *filename,off_t *r_size); +extern unsigned long virt_to_phys (unsigned long addr);extern void add_segment (struct kexec_info *info,const void *buf,size_t bufsz,unsigned long base,size_t memsz); +extern void add_segment_phys_virt (struct kexec_info *info, +const void *buf,size_t bufsz,unsigned long base,size_t memsz, +int phys);extern unsigned long add_buffer (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); +extern 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); +extern unsigned long add_buffer_phys_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,int phys);extern unsigned char purgatory[];extern size_t purgatory_size;
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 6/12 kexec-tools: mipsel: Remove unused variables from elf_mipsel_load
In reply to Simon Horman---
kexec/arch/mipsel/kexec-elf-mipsel.c | 2 -- 1 file changed, 2 deletions(-)
kexec/arch/mipsel/kexec-elf-mipsel.c +0 -2
@@ -116,9 +116,7 @@ int elf_mipsel_load(int argc, char **argint 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
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 7/12 kexec-tools: mipsel: Remove unused variables in arch_process_options()
In reply to Simon Horman---
kexec/arch/mipsel/kexec-mipsel.c | 2 -- 1 file changed, 2 deletions(-)
kexec/arch/mipsel/kexec-mipsel.c +0 -2
@@ -111,8 +111,6 @@ int arch_process_options(int argc, char };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 ) {
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 8/12 kexec-tools: mipsel: Remove unused arch_options global variable
In reply to Simon Horman---
kexec/arch/mipsel/kexec-mipsel.c | 3 --- 1 file changed, 3 deletions(-)
kexec/arch/mipsel/kexec-mipsel.c +0 -3
@@ -100,9 +100,6 @@ void arch_usage(void) { } -static struct { -} arch_options = { -};int arch_process_options (int argc,char **argv) {static const struct option options[] = {
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 9/12 kexec-tools: mipsel: Remove purgatory/arch/mipsel/include/limits.h
In reply to Simon HormanRemove purgatory/arch/mipsel/include/limits.h as it is not needed.
---
purgatory/arch/mipsel/include/limits.h | 58 -------------------------------- 1 file changed, 58 deletions(-)
purgatory/arch/mipsel/include/limits.h deleted +0 -58
@@ -1,58 +0,0 @@ -#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 */
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 10/12 kexec-tools: mipsel: Fit elf_mipsel_usage() into 80 columns
In reply to Simon Horman---
kexec/arch/mipsel/kexec-elf-mipsel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kexec/arch/mipsel/kexec-elf-mipsel.c +4 -4
@@ -97,10 +97,10 @@ int elf_mipsel_probe(const char *buf, ofvoid 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" ); +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,
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 11/12 kexec-tools: mipsel: Fit elf_mipsel_load() into 80 columns
In reply to Simon Horman---
kexec/arch/mipsel/kexec-elf-mipsel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kexec/arch/mipsel/kexec-elf-mipsel.c +2 -1
@@ -128,7 +128,8 @@ int elf_mipsel_load(int argc, char **argstatic const char short_options[] =KEXEC_ARCH_OPT_STR "d" ; command_line =0 ; -while ((opt =getopt_long (argc, argv, short_options, options,0 )) !=-1 ) { +while ((opt =getopt_long (argc, argv, short_options, + options,0 )) !=-1 ) {switch (opt) {default :/* Ignore core options */
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 12/12 kexec-tools: mipsel: Define OPT_APPEND outside of any function
In reply to Simon Horman---
kexec/arch/mipsel/kexec-elf-mipsel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kexec/arch/mipsel/kexec-elf-mipsel.c +2 -1
@@ -70,6 +70,8 @@ static struct boot_notes { }; +#define OPT_APPEND (OPT_ARCH_MAX+0) +int elf_mipsel_probe (const char *buf,off_t len) {
@@ -117,7 +119,6 @@ int elf_mipsel_load(int argc, char **argunsigned char *setup_start;uint32_t setup_size;int opt; -#define OPT_APPEND (OPT_ARCH_MAX+0)static const struct option options[] = {KEXEC_ARCH_OPTIONS {"command-line", 1, 0, OPT_APPEND},
Signature · 8 lines
-- Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec