summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-07-28 11:59:48 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-28 21:26:37 +0200
commit6b5a4185122b8c9edfb16e0ac70802733191ffe7 (patch)
tree748c7bf8fedfd9c73ed9f07f31af1807dcc5cfad /target
parenteb28a0cde631c96388ada781fb02933ecdb0e69d (diff)
downloadmtk-20170518-6b5a4185122b8c9edfb16e0ac70802733191ffe7.zip
mtk-20170518-6b5a4185122b8c9edfb16e0ac70802733191ffe7.tar.gz
mtk-20170518-6b5a4185122b8c9edfb16e0ac70802733191ffe7.tar.bz2
kernel: fix crashlog issues on various architectures
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/patches-4.4/930-crashlog.patch38
1 files changed, 25 insertions, 13 deletions
diff --git a/target/linux/generic/patches-4.4/930-crashlog.patch b/target/linux/generic/patches-4.4/930-crashlog.patch
index 936366e..339cffa 100644
--- a/target/linux/generic/patches-4.4/930-crashlog.patch
+++ b/target/linux/generic/patches-4.4/930-crashlog.patch
@@ -26,7 +26,7 @@
+config CRASHLOG
+ bool "Crash logging"
-+ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK) && !(ARM || SPARC || PPC)
++ depends on (!NO_BOOTMEM || HAVE_MEMBLOCK)
+
config BLK_DEV_INITRD
bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support"
@@ -43,7 +43,7 @@
--- /dev/null
+++ b/kernel/crashlog.c
-@@ -0,0 +1,181 @@
+@@ -0,0 +1,193 @@
+/*
+ * Crash information logger
+ * Copyright (C) 2010 Felix Fietkau <nbd@nbd.name>
@@ -75,6 +75,7 @@
+#include <linux/kmsg_dump.h>
+#include <linux/module.h>
+#include <linux/pfn.h>
++#include <linux/vmalloc.h>
+#include <asm/io.h>
+
+#define CRASHLOG_PAGES 4
@@ -208,10 +209,21 @@
+
+int __init crashlog_init_fs(void)
+{
-+ if (!crashlog_addr)
++ struct page *pages[CRASHLOG_PAGES];
++ pgprot_t prot;
++ int i;
++
++ if (!crashlog_addr) {
++ printk("No memory allocated for crashlog\n");
+ return -ENOMEM;
++ }
++
++ printk("Crashlog allocated RAM at address 0x%lx\n", (unsigned long) crashlog_addr);
++ for (i = 0; i < CRASHLOG_PAGES; i++)
++ pages[i] = pfn_to_page((crashlog_addr >> PAGE_SHIFT) + i);
+
-+ crashlog_buf = ioremap(crashlog_addr, CRASHLOG_SIZE);
++ prot = pgprot_writecombine(PAGE_KERNEL);
++ crashlog_buf = vmap(pages, CRASHLOG_PAGES, VM_MAP, prot);
+
+ crashlog_copy();
+
@@ -265,12 +277,12 @@
#include <asm-generic/sections.h>
#include <linux/io.h>
-@@ -503,6 +504,8 @@ static void __init_memblock memblock_ins
- memblock_set_region_node(rgn, nid);
- type->cnt++;
- type->total_size += size;
-+ if (type == &memblock.memory && idx == 0)
-+ crashlog_init_memblock(base, size);
- }
-
- /**
+@@ -541,6 +542,8 @@ int __init_memblock memblock_add_range(s
+ type->regions[0].flags = flags;
+ memblock_set_region_node(&type->regions[0], nid);
+ type->total_size = size;
++ if (type == &memblock.memory)
++ crashlog_init_memblock(base, size);
+ return 0;
+ }
+ repeat: