enable crash on other architectures

This commit is contained in:
Kyle McMartin 2013-11-05 16:51:00 -05:00
parent 17cfc21f1f
commit 0a346ea311
5 changed files with 205 additions and 74 deletions

View File

@ -149,3 +149,5 @@ CONFIG_SMC911X=m
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_CXGB3_ISCSI is not set
# CONFIG_SCSI_CXGB4_ISCSI is not set
CONFIG_CRASH=m

View File

@ -379,3 +379,5 @@ CONFIG_BACKLIGHT_PWM=m
CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=n
CONFIG_XZ_DEC_POWERPC=y
CONFIG_CRASH=m

View File

@ -277,3 +277,5 @@ CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
# CONFIG_IEEE802154_DRIVERS is not set
# CONFIG_FMC is not set
CONFIG_CRASH=m

View File

@ -1,24 +1,57 @@
From f72d640713d01b3b704c6e84ab49b62f19fc9c22 Mon Sep 17 00:00:00 2001
From: Kyle McMartin <kyle@phobos.i.jkkm.org>
Date: Tue, 30 Mar 2010 00:16:25 -0400
Subject: [PATCH] dev-crash-driver.patch
From 9fcd8dd1ccc20ea8d466d48e887e92b832e22d56 Mon Sep 17 00:00:00 2001
From: Kyle McMartin <kyle@dreadnought.bos.jkkm.org>
Date: Tue, 5 Nov 2013 13:16:00 -0500
Subject: [PATCH] crash-driver
---
arch/ia64/include/asm/crash.h | 90 +++++++++++++++++++++++++++++
arch/ia64/kernel/ia64_ksyms.c | 3 +
arch/x86/include/asm/crash.h | 75 ++++++++++++++++++++++++
arch/x86/mm/ioremap.c | 2 +
drivers/char/Kconfig | 3 +
drivers/char/Makefile | 2 +
drivers/char/crash.c | 128 +++++++++++++++++++++++++++++++++++++++++
7 files changed, 303 insertions(+), 0 deletions(-)
arch/arm/include/asm/crash.h | 6 ++
arch/arm64/include/asm/crash.h | 6 ++
arch/ia64/include/asm/crash.h | 90 +++++++++++++++++++++++++++
arch/ia64/kernel/ia64_ksyms.c | 3 +
arch/powerpc/include/asm/crash.h | 6 ++
arch/s390/include/asm/crash.h | 60 ++++++++++++++++++
arch/x86/include/asm/crash.h | 6 ++
drivers/char/Kconfig | 3 +
drivers/char/Makefile | 2 +
drivers/char/crash.c | 128 +++++++++++++++++++++++++++++++++++++++
include/asm-generic/crash.h | 72 ++++++++++++++++++++++
11 files changed, 382 insertions(+)
create mode 100644 arch/arm/include/asm/crash.h
create mode 100644 arch/arm64/include/asm/crash.h
create mode 100644 arch/ia64/include/asm/crash.h
create mode 100644 arch/powerpc/include/asm/crash.h
create mode 100644 arch/s390/include/asm/crash.h
create mode 100644 arch/x86/include/asm/crash.h
create mode 100644 drivers/char/crash.c
create mode 100644 include/asm-generic/crash.h
diff --git a/arch/arm/include/asm/crash.h b/arch/arm/include/asm/crash.h
new file mode 100644
index 0000000..1d2e537
--- /dev/null
+++ b/arch/arm/include/asm/crash.h
@@ -0,0 +1,6 @@
+#ifndef _ARM_CRASH_H
+#define _ARM_CRASH_H
+
+#include <asm-generic/crash.h>
+
+#endif /* _ARM_CRASH_H */
diff --git a/arch/arm64/include/asm/crash.h b/arch/arm64/include/asm/crash.h
new file mode 100644
index 0000000..a7fcc28
--- /dev/null
+++ b/arch/arm64/include/asm/crash.h
@@ -0,0 +1,6 @@
+#ifndef _ARM64_CRASH_H
+#define _ARM64_CRASH_H
+
+#include <asm-generic/crash.h>
+
+#endif /* _ARM64_CRASH_H */
diff --git a/arch/ia64/include/asm/crash.h b/arch/ia64/include/asm/crash.h
new file mode 100644
index 0000000..541af84
index 0000000..28bd955
--- /dev/null
+++ b/arch/ia64/include/asm/crash.h
@@ -0,0 +1,90 @@
@ -68,7 +101,7 @@ index 0000000..541af84
+ return NULL;
+ }
+
+ switch (type = efi_mem_type(offset))
+ switch (type = efi_mem_type(offset))
+ {
+ case EFI_LOADER_CODE:
+ case EFI_LOADER_DATA:
@ -79,7 +112,7 @@ index 0000000..541af84
+
+ default:
+ printk(KERN_INFO
+ "crash memory driver: invalid memory type for %lx: %d\n",
+ "crash memory driver: invalid memory type for %lx: %d\n",
+ offset, type);
+ return NULL;
+ }
@ -96,7 +129,7 @@ index 0000000..541af84
+
+ if (!page->virtual) {
+ printk(KERN_INFO
+ "crash memory driver: offset: %lx page: %lx page->virtual: NULL\n",
+ "crash memory driver: offset: %lx page: %lx page->virtual: NULL\n",
+ offset, (unsigned long)page);
+ return NULL;
+ }
@ -104,8 +137,8 @@ index 0000000..541af84
+ return (page->virtual + (offset & (PAGE_SIZE-1)));
+}
+
+static inline void unmap_virtual(struct page *page)
+{
+static inline void unmap_virtual(struct page *page)
+{
+ return;
+}
+
@ -113,7 +146,7 @@ index 0000000..541af84
+
+#endif /* _ASM_IA64_CRASH_H */
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 7f4a0ed..552fe24 100644
index 5b7791d..aee4b87 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -84,6 +84,9 @@ EXPORT_SYMBOL(ia64_save_scratch_fpregs);
@ -126,50 +159,47 @@ index 7f4a0ed..552fe24 100644
#if defined(CONFIG_IA64_ESI) || defined(CONFIG_IA64_ESI_MODULE)
extern void esi_call_phys (void);
EXPORT_SYMBOL_GPL(esi_call_phys);
diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h
diff --git a/arch/powerpc/include/asm/crash.h b/arch/powerpc/include/asm/crash.h
new file mode 100644
index 0000000..dfcc006
index 0000000..daa8c4d
--- /dev/null
+++ b/arch/x86/include/asm/crash.h
@@ -0,0 +1,73 @@
+#ifndef _ASM_I386_CRASH_H
+#define _ASM_I386_CRASH_H
+++ b/arch/powerpc/include/asm/crash.h
@@ -0,0 +1,6 @@
+#ifndef _PPC64_CRASH_H
+#define _PPC64_CRASH_H
+
+/*
+ * linux/include/asm-i386/crash.h
+ *
+ * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+#include <asm-generic/crash.h>
+
+#endif /* _PPC64_CRASH_H */
diff --git a/arch/s390/include/asm/crash.h b/arch/s390/include/asm/crash.h
new file mode 100644
index 0000000..552be5e
--- /dev/null
+++ b/arch/s390/include/asm/crash.h
@@ -0,0 +1,60 @@
+#ifndef _S390_CRASH_H
+#define _S390_CRASH_H
+
+#ifdef __KERNEL__
+
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <asm/mmzone.h>
+
+static inline void *
+map_virtual(u64 offset, struct page **pp)
+/*
+ * For swapped prefix pages get bounce buffer using xlate_dev_mem_ptr()
+ */
+static inline void *map_virtual(u64 offset, struct page **pp)
+{
+ struct page *page;
+ unsigned long pfn;
+ void *vaddr;
+
+ pfn = (unsigned long)(offset >> PAGE_SHIFT);
+ vaddr = xlate_dev_mem_ptr(offset);
+ pfn = ((unsigned long) vaddr) >> PAGE_SHIFT;
+ if ((unsigned long) vaddr != offset)
+ page = pfn_to_page(pfn);
+ else
+ page = NULL;
+
+ if (!page_is_ram(pfn)) {
+ printk(KERN_INFO
@ -183,30 +213,44 @@ index 0000000..dfcc006
+ return NULL;
+ }
+
+ page = pfn_to_page(pfn);
+
+ vaddr = kmap(page);
+ if (!vaddr) {
+ printk(KERN_INFO
+ "crash memory driver: pfn: %lx kmap(page: %lx) failed\n",
+ pfn, (unsigned long)page);
+ return NULL;
+ }
+
+ *pp = page;
+ return (vaddr + (offset & (PAGE_SIZE-1)));
+ return vaddr;
+}
+
+static inline void unmap_virtual(struct page *page)
+{
+ kunmap(page);
+/*
+ * Free bounce buffer if necessary
+ */
+static inline void unmap_virtual(struct page *page)
+{
+ void *vaddr;
+
+ if (page) {
+ /*
+ * Because for bounce buffers vaddr will never be 0
+ * unxlate_dev_mem_ptr() will always free the bounce buffer.
+ */
+ vaddr = (void *)(page_to_pfn(page) << PAGE_SHIFT);
+ unxlate_dev_mem_ptr(0, vaddr);
+ }
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_I386_CRASH_H */
+#endif /* _S390_CRASH_H */
diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h
new file mode 100644
index 0000000..27a4156
--- /dev/null
+++ b/arch/x86/include/asm/crash.h
@@ -0,0 +1,6 @@
+#ifndef _X86_CRASH_H
+#define _X86_CRASH_H
+
+#include <asm-generic/crash.h>
+
+#endif /* _X86_CRASH_H */
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 423fd56..e04a561 100644
index 1421997..72a8b74 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -4,6 +4,9 @@
@ -220,10 +264,10 @@ index 423fd56..e04a561 100644
config DEVKMEM
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 32762ba..3d5d525 100644
index 7ff1d0d..3ed67af 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -65,3 +65,5 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o
@@ -62,3 +62,5 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o
js-rtc-y = rtc.o
obj-$(CONFIG_TILE_SROM) += tile-srom.o
@ -231,7 +275,7 @@ index 32762ba..3d5d525 100644
+obj-$(CONFIG_CRASH) += crash.o
diff --git a/drivers/char/crash.c b/drivers/char/crash.c
new file mode 100644
index 0000000..e5437de
index 0000000..a142bb3
--- /dev/null
+++ b/drivers/char/crash.c
@@ -0,0 +1,128 @@
@ -276,7 +320,7 @@ index 0000000..e5437de
+ * access to physical memory.
+ */
+
+static loff_t
+static loff_t
+crash_llseek(struct file * file, loff_t offset, int orig)
+{
+ switch (orig) {
@ -292,7 +336,7 @@ index 0000000..e5437de
+}
+
+/*
+ * Determine the page address for an address offset value,
+ * Determine the page address for an address offset value,
+ * get a virtual address for it, and copy it out.
+ * Accesses must fit within a page.
+ */
@ -305,7 +349,7 @@ index 0000000..e5437de
+ ssize_t read;
+
+ offset = *poff;
+ if (offset >> PAGE_SHIFT != (offset+count-1) >> PAGE_SHIFT)
+ if (offset >> PAGE_SHIFT != (offset+count-1) >> PAGE_SHIFT)
+ return -EINVAL;
+
+ vaddr = map_virtual(offset, &page);
@ -342,11 +386,11 @@ index 0000000..e5437de
+
+ ret = misc_register(&crash_dev);
+ if (ret) {
+ printk(KERN_ERR
+ printk(KERN_ERR
+ "crash memory driver: cannot misc_register (MISC_DYNAMIC_MINOR)\n");
+ goto out;
+ }
+
+
+ ret = 0;
+ printk(KERN_INFO "crash memory driver: version %s\n", CRASH_VERSION);
+out:
@ -363,6 +407,84 @@ index 0000000..e5437de
+module_exit(crash_cleanup_module);
+
+MODULE_LICENSE("GPL");
diff --git a/include/asm-generic/crash.h b/include/asm-generic/crash.h
new file mode 100644
index 0000000..8a0a69a
--- /dev/null
+++ b/include/asm-generic/crash.h
@@ -0,0 +1,72 @@
+#ifndef __CRASH_H__
+#define __CRASH_H__
+
+/*
+ * include/linux/crash.h
+ *
+ * Copyright (c) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifdef __KERNEL__
+
+#include <linux/mm.h>
+#include <linux/highmem.h>
+
+static inline void *
+map_virtual(u64 offset, struct page **pp)
+{
+ struct page *page;
+ unsigned long pfn;
+ void *vaddr;
+
+ pfn = (unsigned long)(offset >> PAGE_SHIFT);
+
+ if (!page_is_ram(pfn)) {
+ printk(KERN_INFO
+ "crash memory driver: !page_is_ram(pfn: %lx)\n", pfn);
+ return NULL;
+ }
+
+ if (!pfn_valid(pfn)) {
+ printk(KERN_INFO
+ "crash memory driver: invalid pfn: %lx )\n", pfn);
+ return NULL;
+ }
+
+ page = pfn_to_page(pfn);
+
+ vaddr = kmap(page);
+ if (!vaddr) {
+ printk(KERN_INFO
+ "crash memory driver: pfn: %lx kmap(page: %lx) failed\n",
+ pfn, (unsigned long)page);
+ return NULL;
+ }
+
+ *pp = page;
+ return (vaddr + (offset & (PAGE_SIZE-1)));
+}
+
+static inline void unmap_virtual(struct page *page)
+{
+ kunmap(page);
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* __CRASH_H__ */
--
1.7.6
1.8.3.1

View File

@ -2247,6 +2247,9 @@ fi
# ||----w |
# || ||
%changelog
* Tue Nov 05 2013 Kyle McMartin <kyle@fedoraproject.org>
- Enable crash on {arm,aarch64,ppc64,s390x}
* Mon Nov 04 2013 Josh Boyer <jwboyer@fedoraproject.org> - 3.12.0-1
- Linux v3.12
- Disable debugging options.