[source] kernel: fix crashlog issues on various architectures
LEDE Commits
lede-commits at lists.infradead.org
Thu Jul 28 12:26:50 PDT 2016
nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=6b5a4185122b8c9edfb16e0ac70802733191ffe7
commit 6b5a4185122b8c9edfb16e0ac70802733191ffe7
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Jul 28 11:59:48 2016 +0200
kernel: fix crashlog issues on various architectures
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
.../linux/generic/patches-4.4/930-crashlog.patch | 38 ++++++++++++++--------
1 file 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 at 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:
More information about the lede-commits
mailing list