* [PATCH] powerpc: Add System RAM to /proc/iomem
@ 2011-11-03 0:56 Anton Blanchard
0 siblings, 0 replies; only message in thread
From: Anton Blanchard @ 2011-11-03 0:56 UTC (permalink / raw)
To: benh, paulus; +Cc: linuxppc-dev
We've resisted adding System RAM to /proc/iomem because it is
the wrong place for it. Unfortunately we continue to find tools
that rely on this behaviour so give up and add it in.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Index: linux-build/arch/powerpc/mm/mem.c
===================================================================
--- linux-build.orig/arch/powerpc/mm/mem.c 2011-11-03 11:28:48.128478738 +1100
+++ linux-build/arch/powerpc/mm/mem.c 2011-11-03 11:53:39.002465556 +1100
@@ -34,6 +34,7 @@
#include <linux/suspend.h>
#include <linux/memblock.h>
#include <linux/hugetlb.h>
+#include <linux/slab.h>
#include <asm/pgalloc.h>
#include <asm/prom.h>
@@ -549,3 +550,32 @@ void update_mmu_cache(struct vm_area_str
hash_preload(vma->vm_mm, address, access, trap);
#endif /* CONFIG_PPC_STD_MMU */
}
+
+/*
+ * System memory should not be in /proc/iomem but various tools expect it
+ * (eg kdump).
+ */
+static int add_system_ram_resources(void)
+{
+ struct memblock_region *reg;
+
+ for_each_memblock(memory, reg) {
+ struct resource *res;
+ unsigned long base = reg->base;
+ unsigned long size = reg->size;
+
+ res = kzalloc(sizeof(struct resource), GFP_KERNEL);
+ WARN_ON(!res);
+
+ if (res) {
+ res->name = "System RAM";
+ res->start = base;
+ res->end = base + size - 1;
+ res->flags = IORESOURCE_MEM;
+ WARN_ON(request_resource(&iomem_resource, res) < 0);
+ }
+ }
+
+ return 0;
+}
+subsys_initcall(add_system_ram_resources);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-11-03 0:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-03 0:56 [PATCH] powerpc: Add System RAM to /proc/iomem Anton Blanchard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).