mirror of https://gitee.com/openkylin/linux.git
powerpc: Add System RAM to /proc/iomem
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> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
88cf11b4cc
commit
c40dd2f766
|
@ -34,6 +34,7 @@
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/hugetlb.h>
|
#include <linux/hugetlb.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
#include <asm/prom.h>
|
#include <asm/prom.h>
|
||||||
|
@ -555,3 +556,32 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
|
||||||
book3e_hugetlb_preload(vma->vm_mm, address, *ptep);
|
book3e_hugetlb_preload(vma->vm_mm, address, *ptep);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
Loading…
Reference in New Issue