Skip to contentSkip to conversation

crash utility - add ARM support

PATCH New Mika Westerberg 1 participant 7 messages Aug 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover crash utility - add ARM support

Hi Dave,

This series brings ARM support for the crash utility. This is the result of collaboration work with Nokia and SonyEricsson. Basically we combined our versions of the code. Previous version of the patches can be found here:

	http://lists.infradead.org/pipermail/linux-arm-kernel/2010-June/019188.html

We tried to keep any ARM specific changes isolated with #ifdefs and similar so that it should not cause any problems with other archs.

In this series:
o crash can be build as native ARM binary or "cross" version running on x86 host (make target=ARM to build "cross" version)
o supports kdump, diskdump and /dev/mem (live system)
o stack unwinding with both framepointers and ARM unwind tables
o most of the arch specific code is implemented

The patches apply on top of crash 5.0.6 sources.

Best regards,
MW

Jan Karlsson (1):
crash: update IRQ flags

Mika Westerberg (5):
configure/Makefile: add support for ARM targets
crash: add support for ARM kernel image
crash/diskdump: add ARM support
crash/kdump: add ARM support
crash: add ARM crashdump support

 Makefile            |   30 +-
 arm.c               | 1741 +++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.c         |   32 +-
 defs.h              |  245 +++++++-
 diskdump.c          |   42 ++-
 kernel.c            |    3 +-
 lkcd_vmdump_v2_v3.h |    4 +-
 netdump.c           |  115 ++++
 symbols.c           |   15 +-
 unwind_arm.c        |  697 +++++++++++++++++++++
 10 files changed, 2902 insertions(+), 22 deletions(-)
 create mode 100644 arm.c
 create mode 100644 unwind_arm.c

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw

PATCH v2 1/6 crash: update IRQ flags

From: Jan Karlsson <[email protected]>

There was a change in IRQ flags starting from 2.6.17. This change updates crash to use those depending on kernel version.

---
 defs.h |  105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 97 insertions(+), 8 deletions(-)
defs.h +97 -8
index 65cb429..3d34b8e 100755
@@ -2872,15 +2872,104 @@ struct efi_memory_desc_t {
 
 /*
  * IRQ line status.
+ * For kernels up to and including 2.6.17
  */
-#define IRQ_INPROGRESS  1       /* IRQ handler active - do not enter! */
-#define IRQ_DISABLED    2       /* IRQ disabled - do not enter! */
-#define IRQ_PENDING     4       /* IRQ pending - replay on enable */
-#define IRQ_REPLAY      8       /* IRQ has been replayed but not acked yet */
-#define IRQ_AUTODETECT  16      /* IRQ is being autodetected */
-#define IRQ_WAITING     32      /* IRQ not yet seen - for autodetection */
-#define IRQ_LEVEL       64      /* IRQ level triggered */
-#define IRQ_MASKED      128     /* IRQ masked - shouldn't be seen again */
+#define IRQ_INPROGRESS_2_6_17  1       /* IRQ handler active - do not enter! */
+#define IRQ_DISABLED_2_6_17    2       /* IRQ disabled - do not enter! */
+#define IRQ_PENDING_2_6_17     4       /* IRQ pending - replay on enable */
+#define IRQ_REPLAY_2_6_17      8       /* IRQ has been replayed but not acked yet */
+#define IRQ_AUTODETECT_2_6_17  16      /* IRQ is being autodetected */
+#define IRQ_WAITING_2_6_17     32      /* IRQ not yet seen - for autodetection */
+#define IRQ_LEVEL_2_6_17       64      /* IRQ level triggered */
+#define IRQ_MASKED_2_6_17      128     /* IRQ masked - shouldn't be seen again */
+
+/*
+ * For kernel 2.6.21 and later
+ */
+#define IRQ_TYPE_NONE_2_6_21		0x00000000	/* Default, unspecified type */
+#define IRQ_TYPE_EDGE_RISING_2_6_21	0x00000001	/* Edge rising type */
+#define IRQ_TYPE_EDGE_FALLING_2_6_21	0x00000002	/* Edge falling type */
+#define IRQ_TYPE_EDGE_BOTH_2_6_21 	(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
+#define IRQ_TYPE_LEVEL_HIGH_2_6_21	0x00000004	/* Level high type */
+#define IRQ_TYPE_LEVEL_LOW_2_6_21	0x00000008	/* Level low type */
+#define IRQ_TYPE_SENSE_MASK_2_6_21	0x0000000f	/* Mask of the above */
+#define IRQ_TYPE_PROBE_2_6_21		0x00000010	/* Probing in progress */
+
+#define IRQ_INPROGRESS_2_6_21		0x00000100	/* IRQ handler active - do not enter! */
+#define IRQ_DISABLED_2_6_21		0x00000200	/* IRQ disabled - do not enter! */
+#define IRQ_PENDING_2_6_21		0x00000400	/* IRQ pending - replay on enable */
+#define IRQ_REPLAY_2_6_21		0x00000800	/* IRQ has been replayed but not acked yet */
+#define IRQ_AUTODETECT_2_6_21		0x00001000	/* IRQ is being autodetected */
+#define IRQ_WAITING_2_6_21		0x00002000	/* IRQ not yet seen - for autodetection */
+#define IRQ_LEVEL_2_6_21		0x00004000	/* IRQ level triggered */
+#define IRQ_MASKED_2_6_21		0x00008000	/* IRQ masked - shouldn't be seen again */
+#define IRQ_PER_CPU_2_6_21		0x00010000	/* IRQ is per CPU */
+#define IRQ_NOPROBE_2_6_21		0x00020000	/* IRQ is not valid for probing */
+#define IRQ_NOREQUEST_2_6_21		0x00040000	/* IRQ cannot be requested */
+#define IRQ_NOAUTOEN_2_6_21		0x00080000	/* IRQ will not be enabled on request irq */
+#define IRQ_WAKEUP_2_6_21		0x00100000	/* IRQ triggers system wakeup */
+#define IRQ_MOVE_PENDING_2_6_21		0x00200000	/* need to re-target IRQ destination */
+#define IRQ_NO_BALANCING_2_6_21		0x00400000	/* IRQ is excluded from balancing */
+#define IRQ_SPURIOUS_DISABLED_2_6_21	0x00800000	/* IRQ was disabled by the spurious trap */
+#define IRQ_MOVE_PCNTXT_2_6_21		0x01000000	/* IRQ migration from process context */
+#define IRQ_AFFINITY_SET_2_6_21		0x02000000	/* IRQ affinity was set from userspace*/
+
+/*
+ * Select proper IRQ value depending on kernel version
+ */
+#define IRQ_TYPE_NONE		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_NONE_2_6_21 : 0)
+#define IRQ_TYPE_EDGE_RISING	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_RISING_2_6_21 : 0)
+#define IRQ_TYPE_EDGE_FALLING	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_FALLING_2_6_21 : 0)
+#define IRQ_TYPE_EDGE_BOTH	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_EDGE_BOTH_2_6_21 : 0)
+#define IRQ_TYPE_LEVEL_HIGH	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_LEVEL_HIGH_2_6_21 : 0)
+#define IRQ_TYPE_LEVEL_LOW	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_LEVEL_LOW_2_6_21 : 0)
+#define IRQ_TYPE_SENSE_MASK	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_SENSE_MASK_2_6_21 : 0)
+#define IRQ_TYPE_PROBE		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_TYPE_PROBE_2_6_21 : 0)
+
+#define IRQ_INPROGRESS		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_INPROGRESS_2_6_21 : IRQ_INPROGRESS_2_6_17)
+#define IRQ_DISABLED		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_DISABLED_2_6_21 : IRQ_DISABLED_2_6_17)
+#define IRQ_PENDING		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_PENDING_2_6_21 : IRQ_PENDING_2_6_17)
+#define IRQ_REPLAY		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_REPLAY_2_6_21 : IRQ_REPLAY_2_6_17)
+#define IRQ_AUTODETECT		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_AUTODETECT_2_6_21 : IRQ_AUTODETECT_2_6_17)
+#define IRQ_WAITING		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_WAITING_2_6_21 : IRQ_WAITING_2_6_17)
+#define IRQ_LEVEL		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_LEVEL_2_6_21 : IRQ_LEVEL_2_6_17)
+#define IRQ_MASKED		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MASKED_2_6_21 : IRQ_MASKED_2_6_17)
+#define IRQ_PER_CPU		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_PER_CPU_2_6_21 : 0)
+#define IRQ_NOPROBE		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOPROBE_2_6_21 : 0)
+#define IRQ_NOREQUEST		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOREQUEST_2_6_21 : 0)
+#define IRQ_NOAUTOEN		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NOAUTOEN_2_6_21 : 0)
+#define IRQ_WAKEUP		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_WAKEUP_2_6_21 : 0)
+#define IRQ_MOVE_PENDING	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MOVE_PENDING_2_6_21 : 0)
+#define IRQ_NO_BALANCING	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_NO_BALANCING_2_6_21 : 0)
+#define IRQ_SPURIOUS_DISABLED	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_SPURIOUS_DISABLED_2_6_21 : 0)
+#define IRQ_MOVE_PCNTXT		\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_MOVE_PCNTXT_2_6_21 : 0)
+#define IRQ_AFFINITY_SET	\
+	(THIS_KERNEL_VERSION >= LINUX(2,6,21) ? IRQ_AFFINITY_SET_2_6_21 : 0)
 
 #ifdef X86
 #define SA_PROBE                SA_ONESHOT
Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

PATCH v2 2/6 configure/Makefile: add support for ARM targets

In reply to Mika Westerberg

Add support to build for ARM targets. This includes native ARM build, and also ARM on x86 (which works because of the same word size and endianness).

---
 Makefile    |   18 +++++++++++++++---
 configure.c |   32 +++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 4 deletions(-)
Makefile +15 -3
index c2a2ac0..038c887 100644
@@ -32,6 +32,12 @@ ifeq ($(ARCH), ppc64)
 CONF_FLAGS = -m64
 endif
 
+ifeq ($(TARGET), ARM)
+ifeq ($(ARCH), i386)
+GDB_CONF_FLAGS = --target=arm-elf-linux
+endif
+endif
+
 #
 # GDB, GDB_FILES, GDB_OFILES and GDB_PATCH_FILES will be configured automatically by configure 
 #
@@ -240,11 +246,17 @@ GDB_INCLUDE_DIRECTORY=./${GDB}/include
 
 REDHATFLAGS=-DREDHAT
 
+# target could be set on command line when invoking make. Like: make target=ARM
+# otherwise target will be the same as the host
+ifneq ($(target),)
+CONF_TARGET_FLAG="-t$(target)"
+endif
+
 # To build the extensions library by default, uncomment the third command
 # line below.  Otherwise they can be built by entering "make extensions".
 
 all: make_configure
-	@./configure -p "RPMPKG=${RPMPKG}" -b
+	@./configure ${CONF_TARGET_FLAG} -p "RPMPKG=${RPMPKG}" -b
 	@make --no-print-directory gdb_merge
 #	@make --no-print-directory extensions
 
@@ -254,7 +266,7 @@ gdb_merge: force
 	@echo "${LDFLAGS} -lz -ldl -rdynamic" > ${GDB}/gdb/mergelibs
 	@echo "../../${PROGRAM} ../../${PROGRAM}lib.a" > ${GDB}/gdb/mergeobj
 	@if [ ! -f ${GDB}/config.status ]; then \
-	  (cd ${GDB}; ./configure --with-separate-debug-dir=/usr/lib/debug \
+	  (cd ${GDB}; ./configure ${GDB_CONF_FLAGS} --with-separate-debug-dir=/usr/lib/debug \
 	    --with-bugurl="" --with-expat=no --with-python=no; \
 	  make --no-print-directory;) \
 	else (cd ${GDB}/gdb; make --no-print-directory;); fi
@@ -591,7 +603,7 @@ dis:
 	objdump --disassemble --line-numbers ${PROGRAM} > ${PROGRAM}.dis
 
 extensions: make_configure
-	@./configure -q -b
+	@./configure ${CONF_TARGET_FLAG} -q -b
 	@make --no-print-directory do_extensions
 
 do_extensions:
configure.c +31 -1
index 627bb83..a4b3a0e 100755
@@ -90,6 +90,7 @@ void make_spec_file(struct supported_gdb_version *);
 #undef S390X
 #undef PPC64
 #undef X86_64
+#undef ARM
 
 #define X86     1
 #define ALPHA   2
@@ -99,6 +100,7 @@ void make_spec_file(struct supported_gdb_version *);
 #define S390X   6
 #define PPC64   7
 #define X86_64  8
+#define ARM	9
 
 #define TARGET_X86    "TARGET=X86"
 #define TARGET_ALPHA  "TARGET=ALPHA"
@@ -108,6 +110,7 @@ void make_spec_file(struct supported_gdb_version *);
 #define TARGET_S390X  "TARGET=S390X"
 #define TARGET_PPC64  "TARGET=PPC64"
 #define TARGET_X86_64 "TARGET=X86_64"
+#define TARGET_ARM    "TARGET=ARM"
 
 #define TARGET_CFLAGS_X86    "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
 #define TARGET_CFLAGS_ALPHA  "TARGET_CFLAGS="
@@ -117,6 +120,7 @@ void make_spec_file(struct supported_gdb_version *);
 #define TARGET_CFLAGS_S390X  "TARGET_CFLAGS="
 #define TARGET_CFLAGS_PPC64  "TARGET_CFLAGS=-m64"
 #define TARGET_CFLAGS_X86_64 "TARGET_CFLAGS="
+#define TARGET_CFLAGS_ARM    "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
 
 /*
  *  The original plan was to allow the use of a particular version
@@ -193,6 +197,7 @@ struct target_data {
 	char gdb_version[MAXSTRLEN];
 	char release[MAXSTRLEN];
 	struct stat statbuf;
+	const char *target_as_param;
 } target_data = { 0 }; 
 
 int
@@ -203,7 +208,7 @@ main(int argc, char **argv)
 
 	sp = setup_gdb_defaults();
 
-	while ((c = getopt(argc, argv, "gsqnWwubdr:p:P:")) > 0) {
+	while ((c = getopt(argc, argv, "gsqnWwubdr:p:P:t:")) > 0) {
 		switch (c) {
 		case 'q':
 			target_data.flags |= QUIET;
@@ -236,6 +241,9 @@ main(int argc, char **argv)
 		case 'g':
 			gdb_configure(sp);
 			break;
+		case 't':
+			target_data.target_as_param = optarg;
+			break;
 		}
 	}
 
@@ -274,6 +282,21 @@ get_current_configuration(void)
 #ifdef __x86_64__
         target_data.target = X86_64;
 #endif
+#ifdef __arm__
+        target_data.target = ARM;
+#endif
+        /* override target if specified on command line */
+	if (target_data.target_as_param != 0) {
+		if (target_data.target == X86 &&
+		    strcmp(target_data.target_as_param, "ARM") == 0) {
+			/* debugging of ARM core files only supported on X86 */
+			target_data.target = ARM;
+		} else {
+			fprintf(stderr,
+				"target \"%s\" is not supported on this architecture\n",
+				target_data.target_as_param);
+		}
+        }
 
         if ((fp = fopen("Makefile", "r")) == NULL) {
 		perror("Makefile");
@@ -374,6 +397,9 @@ show_configuration(void)
 	case X86_64:
 		printf("TARGET: X86_64\n");
 		break;
+	case ARM:
+		printf("TARGET: ARM\n");
+		break;
 	}
 
 	if (strlen(target_data.program)) {
@@ -437,6 +463,10 @@ build_configure(struct supported_gdb_version *sp)
                 target = TARGET_X86_64;
                 target_CFLAGS = TARGET_CFLAGS_X86_64;
                 break;
+	case ARM:
+                target = TARGET_ARM;
+                target_CFLAGS = TARGET_CFLAGS_ARM;
+                break;
 	}
 
 	makefile_setup(&fp1, &fp2);
Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw

PATCH v2 3/6 crash: add support for ARM kernel image

In reply to Mika Westerberg

ARM kernel image is slightly different than the currently supported images so implement necessary support for it.

---
 kernel.c            |    3 ++-
 lkcd_vmdump_v2_v3.h |    4 ++--
 symbols.c           |   15 +++++++++++++--
 3 files changed, 17 insertions(+), 5 deletions(-)
kernel.c +2 -1
index 03c620b..5dc2c45 100755
@@ -757,7 +757,8 @@ verify_version(void)
 
 	if (!(sp = symbol_search("linux_banner")))
 		error(FATAL, "linux_banner symbol does not exist?\n");
-	else if ((sp->type == 'R') || (sp->type == 'r'))
+	else if ((sp->type == 'R') || (sp->type == 'r') ||
+		 (machine_type("ARM") && sp->type == 'T'))
 		linux_banner = symbol_value("linux_banner");
 	else
 		get_symbol_data("linux_banner", sizeof(ulong), &linux_banner);
lkcd_vmdump_v2_v3.h +2 -2
index 006b0b6..afdcc53 100755
@@ -35,7 +35,7 @@
 #include <asm/vmdump.h>                 /* for architecture-specific header */
 #endif
 
-#if defined(X86) || defined(PPC) || defined(S390) || defined(S390X)
+#if defined(ARM) || defined(X86) || defined(PPC) || defined(S390) || defined(S390X)
 
 /*
  * Kernel header file for Linux crash dumps.
@@ -92,7 +92,7 @@ typedef struct _dump_header_asm_s {
 
 #endif /* _ASM_VMDUMP_H */
 
-#endif /* X86 || PPC */
+#endif /* ARM || X86 || PPC */
 
 #if defined(ALPHA) || defined(IA64) || defined(X86_64) || defined(PPC64)
 
symbols.c +13 -2
index 5ce2f61..3109ae8 100755
@@ -490,7 +490,8 @@ get_text_init_space(void)
 		return;
 
 	if (((section = get_kernel_section(".text.init")) == NULL) &&
-	    ((section = get_kernel_section(".init.text")) == NULL)) {
+	    ((section = get_kernel_section(".init.text")) == NULL) &&
+	    (machine_type("ARM") && (section = get_kernel_section(".init")) == NULL)) {
 		error(WARNING, "cannot determine text init space\n");
 		return;
 	}
@@ -2660,6 +2661,11 @@ is_kernel(char *file)
 				goto bailout;
 			break;
 
+		case EM_ARM:
+			if (machine_type_mismatch(file, "ARM", NULL, 0))
+				goto bailout;
+			break;
+
 		default:
 			if (machine_type_mismatch(file, "(unknown)", NULL, 0))
 				goto bailout;
@@ -2748,7 +2754,7 @@ is_shared_object(char *file)
 		switch (swap16(elf32->e_machine, swap))
 		{
 		case EM_386:
-			if (machine_type("X86"))
+			if (machine_type("X86") || machine_type("ARM"))
 				return TRUE;
 			break;
 
@@ -2756,6 +2762,11 @@ is_shared_object(char *file)
 			if (machine_type("S390"))
 				return TRUE;
 			break;
+
+		case EM_ARM:
+			if (machine_type("ARM"))
+				return TRUE;
+			break;
 		}
 
 		if (CRASHDEBUG(1))
Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#4 lore raw

PATCH v2 4/6 crash/diskdump: add ARM support

In reply to Mika Westerberg

This patch adds ARM support for makedumpfile generated diskdump files.

---
 diskdump.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)
diskdump.c +31 -3
index 79e72ad..3aab338 100644
@@ -249,6 +249,9 @@ restart:
 	else if (STRNEQ(header->utsname.machine, "ppc64") &&
 	    machine_type_mismatch(file, "PPC64", NULL, 0))
 		goto err;
+	else if (STRNEQ(header->utsname.machine, "arm") &&
+	    machine_type_mismatch(file, "ARM", NULL, 0))
+		goto err;
 
 	if (header->block_size != block_size) {
 		block_size = header->block_size;
@@ -335,7 +338,9 @@ restart:
 
 	dd->header = header;
 
-	if (machine_type("X86"))
+	if (machine_type("ARM"))
+		dd->machine_type = EM_ARM;
+	else if (machine_type("X86"))
 		dd->machine_type = EM_386;
 	else if (machine_type("X86_64"))
 		dd->machine_type = EM_X86_64;
@@ -516,6 +521,17 @@ page_is_cached(physaddr_t paddr)
 }
 
 /*
+ * Translate physical address in paddr to PFN number. This means normally that
+ * we just shift paddr by some constant. Some architectures need special
+ * handling for this, however.
+ */
+static ulong
+paddr_to_pfn(physaddr_t paddr)
+{
+	return paddr >> dd->block_shift;
+}
+
+/*
  *  Cache the page's data.
  *
  *  If an empty page cache location is available, take it.  Otherwise, evict
@@ -560,7 +576,7 @@ cache_page(physaddr_t paddr)
 	dd->page_cache_hdr[i].pg_hit_count++;
 
 	/* find page descriptor */
-	pfn = paddr >> dd->block_shift;
+	pfn = paddr_to_pfn(paddr);
 	desc_pos = pfn_to_pos(pfn);
 	seek_offset = dd->data_offset
 			+ (off_t)(desc_pos - 1)*sizeof(page_desc_t);
@@ -613,7 +629,7 @@ read_diskdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
 	physaddr_t curpaddr;
 	ulong pfn, page_offset;
 
-	pfn = paddr >> dd->block_shift;
+	pfn = paddr_to_pfn(paddr);
 
 	if (KDUMP_SPLIT()) {
 		/* Find proper dd */
@@ -687,6 +703,12 @@ get_diskdump_regs_ppc64(struct bt_info *bt, ulong *eip, ulong *esp)
 	machdep->get_stack_frame(bt, eip, esp);
 }
 
+static void
+get_diskdump_regs_arm(struct bt_info *bt, ulong *eip, ulong *esp)
+{
+	machdep->get_stack_frame(bt, eip, esp);
+}
+
 /*
  *  Send the request to the proper architecture hander.
  */
@@ -696,6 +718,10 @@ get_diskdump_regs(struct bt_info *bt, ulong *eip, ulong *esp)
 {
 	switch (dd->machine_type) 
 	{
+	case EM_ARM:
+		get_diskdump_regs_arm(bt, eip, esp);
+		break;
+
 	case EM_386:
 		return get_netdump_regs_x86(bt, eip, esp);
 		break;
@@ -784,6 +810,8 @@ __diskdump_memory_dump(FILE *fp)
         fprintf(fp, "      machine_type: %d ", dd->machine_type);
 	switch (dd->machine_type)
 	{
+	case EM_ARM:
+		fprintf(fp, "(EM_ARM)\n"); break;
 	case EM_386:
 		fprintf(fp, "(EM_386)\n"); break;
 	case EM_X86_64:
Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#5 lore raw

PATCH v2 5/6 crash/kdump: add ARM support

In reply to Mika Westerberg

This patch adds ARM support for kdump files (ELF files readable from /proc/vmcore). It also provides a function which tries to determine correct phys_base based on the program headers in the ELF file.

---
 defs.h    |    3 ++
 netdump.c |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+), 0 deletions(-)
defs.h +3 -0
index 3d34b8e..c8bae00 100755
@@ -4353,6 +4353,9 @@ int xen_minor_version(void);
 int get_netdump_arch(void);
 void *get_regs_from_elf_notes(struct task_context *);
 void map_cpus_to_prstatus(void);
+#ifdef ARM
+int kdump_phys_base(ulong *);
+#endif
 
 /*
  *  diskdump.c
netdump.c +115 -0

154 lines not on this page · raw message

Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#6 lore raw

PATCH v2 6/6 crash: add ARM crashdump support

In reply to Mika Westerberg

This patch adds minimal support for reading ARM crashdumps. Currently supported dumpfiles are /dev/mem, diskdump and vmcore. Stack unwinding can be done using framepointers or unwinding tables depending on kernel configuration.

---
 Makefile     |   12 +-
 arm.c        | 1741 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 defs.h       |  137 +++++
 diskdump.c   |    8 +
 unwind_arm.c |  697 +++++++++++++++++++++++
 5 files changed, 2593 insertions(+), 2 deletions(-)
 create mode 100644 arm.c
 create mode 100644 unwind_arm.c
Makefile +10 -2
index 038c887..f79f6a9 100644
@@ -80,11 +80,12 @@ UNWIND_HFILES=unwind.h unwind_i.h rse.h unwind_x86.h unwind_x86_64.h
 CFILES=main.c tools.c global_data.c memory.c filesys.c help.c task.c \
 	kernel.c test.c gdb_interface.c configure.c net.c dev.c \
 	alpha.c x86.c ppc.c ia64.c s390.c s390x.c s390dbf.c ppc64.c x86_64.c \
+	arm.c \
 	extensions.c remote.c va_server.c va_server_v1.c symbols.c cmdline.c \
 	lkcd_common.c lkcd_v1.c lkcd_v2_v3.c lkcd_v5.c lkcd_v7.c lkcd_v8.c\
 	lkcd_fix_mem.c s390_dump.c lkcd_x86_trace.c \
 	netdump.c diskdump.c xendump.c unwind.c unwind_decoder.c \
-	unwind_x86_32_64.c \
+	unwind_x86_32_64.c unwind_arm.c \
  	xen_hyper.c xen_hyper_command.c xen_hyper_global_data.c \
 	xen_hyper_dump_tables.c kvmdump.c qemu.c qemu-load.c
 
@@ -96,11 +97,12 @@ SOURCE_FILES=${CFILES} ${GENERIC_HFILES} ${MCORE_HFILES} \
 OBJECT_FILES=main.o tools.o global_data.o memory.o filesys.o help.o task.o \
 	build_data.o kernel.o test.o gdb_interface.o net.o dev.o \
 	alpha.o x86.o ppc.o ia64.o s390.o s390x.o s390dbf.o ppc64.o x86_64.o \
+	arm.o \
 	extensions.o remote.o va_server.o va_server_v1.o symbols.o cmdline.o \
 	lkcd_common.o lkcd_v1.o lkcd_v2_v3.o lkcd_v5.o lkcd_v7.o lkcd_v8.o \
 	lkcd_fix_mem.o s390_dump.o netdump.o diskdump.o xendump.o \
 	lkcd_x86_trace.o unwind_v1.o unwind_v2.o unwind_v3.o \
-	unwind_x86_32_64.o \
+	unwind_x86_32_64.o unwind_arm.o \
  	xen_hyper.o xen_hyper_command.o xen_hyper_global_data.o \
 	xen_hyper_dump_tables.o kvmdump.o qemu.o qemu-load.o
 
@@ -419,6 +421,9 @@ ppc64.o: ${GENERIC_HFILES} ppc64.c
 x86_64.o: ${GENERIC_HFILES} ${REDHAT_HFILES} x86_64.c
 	cc -c ${CRASH_CFLAGS} x86_64.c ${WARNING_OPTIONS} ${WARNING_ERROR}
 
+arm.o: ${GENERIC_HFILES} ${REDHAT_HFILES} arm.c
+	cc -c ${CRASH_CFLAGS} arm.c ${WARNING_OPTIONS} ${WARNING_ERROR}
+
 s390.o: ${GENERIC_HFILES} ${IBM_HFILES} s390.c
 	cc -c ${CRASH_CFLAGS} s390.c ${WARNING_OPTIONS} ${WARNING_ERROR}
 
@@ -460,6 +465,9 @@ lkcd_x86_trace.o: ${GENERIC_HFILES} ${LKCD_TRACE_HFILES} lkcd_x86_trace.c
 unwind_x86_32_64.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind_x86_32_64.c
 	cc -c ${CRASH_CFLAGS} unwind_x86_32_64.c -o unwind_x86_32_64.o ${WARNING_OPTIONS} ${WARNING_ERROR}
 
+unwind_arm.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind_arm.c
+	cc -c ${CRASH_CFLAGS} unwind_arm.c -o unwind_arm.o ${WARNING_OPTIONS} ${WARNING_ERROR}
+
 unwind_v1.o: ${GENERIC_HFILES} ${UNWIND_HFILES} unwind.c unwind_decoder.c
 	cc -c ${CRASH_CFLAGS} unwind.c -DREDHAT -DUNWIND_V1 -o unwind_v1.o ${WARNING_OPTIONS} ${WARNING_ERROR}
 
arm.c new file +1741 -0

1,741 lines not on this page · raw message

defs.h +137 -0

191 lines not on this page · raw message

diskdump.c +8 -0
index 3aab338..e52e603 100644
@@ -528,7 +528,15 @@ page_is_cached(physaddr_t paddr)
 static ulong
 paddr_to_pfn(physaddr_t paddr)
 {
+#ifdef ARM
+	/*
+	 * In ARM, PFN 0 means first page in kernel direct-mapped view.
+	 * This is also first page in mem_map as well.
+	 */
+	return (paddr - machdep->machspec->phys_base) >> dd->block_shift;
+#else
 	return paddr >> dd->block_shift;
+#endif
 }
 
 /*
unwind_arm.c new file +697 -0

697 lines not on this page · raw message

Signature · 7 lines
1.5.6.5


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec