parisc: Check if initrd was loaded into broken RAM
authorHelge Deller <deller@gmx.de>
Mon, 18 Sep 2017 15:55:24 +0000 (17:55 +0200)
committerHelge Deller <deller@gmx.de>
Fri, 22 Sep 2017 17:47:00 +0000 (19:47 +0200)
While scanning the PDT for reported broken memory modules, warn if the
initrd was coincidentally loaded into bad memory.

Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/pdt.c

index 05730a83895c7f5700760e880a460257e8c372ba..00aed082969b126719a988bbe7c63a210c10ed90 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
 #include <linux/kthread.h>
+#include <linux/initrd.h>
 
 #include <asm/pdc.h>
 #include <asm/pdcpat.h>
@@ -216,8 +217,16 @@ void __init pdc_pdt_init(void)
        }
 
        for (i = 0; i < pdt_status.pdt_entries; i++) {
+               unsigned long addr;
+
                report_mem_err(pdt_entry[i]);
 
+               addr = pdt_entry[i] & PDT_ADDR_PHYS_MASK;
+               if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) &&
+                       addr >= initrd_start && addr < initrd_end)
+                       pr_crit("CRITICAL: initrd possibly broken "
+                               "due to bad memory!\n");
+
                /* mark memory page bad */
                memblock_reserve(pdt_entry[i] & PAGE_MASK, PAGE_SIZE);
        }