From 6b5a4185122b8c9edfb16e0ac70802733191ffe7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 28 Jul 2016 11:59:48 +0200 Subject: [PATCH] kernel: fix crashlog issues on various architectures Signed-off-by: Felix Fietkau --- .../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 936366e259..339cffa34e 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 @@ -75,6 +75,7 @@ +#include +#include +#include ++#include +#include + +#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 #include -@@ -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: