Update crash-driver.patch to F20 version to fix s390x build

This commit is contained in:
Josh Boyer 2013-12-20 08:41:46 -05:00
parent cdff8f5057
commit 8d054aca0f
1 changed files with 214 additions and 74 deletions

View File

@ -1,24 +1,58 @@
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 1786bc697d34af944e29437ce44337b0eb8b6799 Mon Sep 17 00:00:00 2001
From: Kyle McMartin <kyle@dreadnought.bos.jkkm.org>
Date: Tue, 26 Nov 2013 12:42:46 -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/s390/mm/maccess.c | 2 +
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 ++++++++++++++++++++++
12 files changed, 384 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 +102,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 +113,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 +130,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 +138,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 +147,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 +160,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 +214,61 @@ 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/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index d1e0e0c..a2be459 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -219,6 +219,7 @@ void *xlate_dev_mem_ptr(unsigned long addr)
put_online_cpus();
return bounce;
}
+EXPORT_SYMBOL_GPL(xlate_dev_mem_ptr);
/*
* Free converted buffer for /dev/mem access (if necessary)
@@ -228,3 +229,4 @@ void unxlate_dev_mem_ptr(unsigned long addr, void *buf)
if ((void *) addr != buf)
free_page((unsigned long) buf);
}
+EXPORT_SYMBOL_GPL(unxlate_dev_mem_ptr);
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 fa3243d..83643e5b 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -4,6 +4,9 @@
@ -220,10 +282,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 +293,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 +338,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 +354,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 +367,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 +404,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 +425,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