diff options
-rw-r--r-- | include/linux/memblock.h | 4 | ||||
-rw-r--r-- | mm/Kconfig | 3 | ||||
-rw-r--r-- | mm/memblock.c | 12 |
3 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f669016874b3..73dc382e72d8 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | 19 | ||
20 | #define INIT_MEMBLOCK_REGIONS 128 | 20 | #define INIT_MEMBLOCK_REGIONS 128 |
21 | #define INIT_PHYSMEM_REGIONS 4 | ||
21 | 22 | ||
22 | /* Definition of memblock flags. */ | 23 | /* Definition of memblock flags. */ |
23 | #define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */ | 24 | #define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */ |
@@ -43,6 +44,9 @@ struct memblock { | |||
43 | phys_addr_t current_limit; | 44 | phys_addr_t current_limit; |
44 | struct memblock_type memory; | 45 | struct memblock_type memory; |
45 | struct memblock_type reserved; | 46 | struct memblock_type reserved; |
47 | #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP | ||
48 | struct memblock_type physmem; | ||
49 | #endif | ||
46 | }; | 50 | }; |
47 | 51 | ||
48 | extern struct memblock memblock; | 52 | extern struct memblock memblock; |
diff --git a/mm/Kconfig b/mm/Kconfig index 1b5a95f0fa01..28cec518f4d4 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -134,6 +134,9 @@ config HAVE_MEMBLOCK | |||
134 | config HAVE_MEMBLOCK_NODE_MAP | 134 | config HAVE_MEMBLOCK_NODE_MAP |
135 | boolean | 135 | boolean |
136 | 136 | ||
137 | config HAVE_MEMBLOCK_PHYS_MAP | ||
138 | boolean | ||
139 | |||
137 | config ARCH_DISCARD_MEMBLOCK | 140 | config ARCH_DISCARD_MEMBLOCK |
138 | boolean | 141 | boolean |
139 | 142 | ||
diff --git a/mm/memblock.c b/mm/memblock.c index 9edd0928daab..a810ba923cdd 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -27,6 +27,9 @@ | |||
27 | 27 | ||
28 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; | 28 | static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; |
29 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; | 29 | static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; |
30 | #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP | ||
31 | static struct memblock_region memblock_physmem_init_regions[INIT_PHYSMEM_REGIONS] __initdata_memblock; | ||
32 | #endif | ||
30 | 33 | ||
31 | struct memblock memblock __initdata_memblock = { | 34 | struct memblock memblock __initdata_memblock = { |
32 | .memory.regions = memblock_memory_init_regions, | 35 | .memory.regions = memblock_memory_init_regions, |
@@ -37,6 +40,12 @@ struct memblock memblock __initdata_memblock = { | |||
37 | .reserved.cnt = 1, /* empty dummy entry */ | 40 | .reserved.cnt = 1, /* empty dummy entry */ |
38 | .reserved.max = INIT_MEMBLOCK_REGIONS, | 41 | .reserved.max = INIT_MEMBLOCK_REGIONS, |
39 | 42 | ||
43 | #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP | ||
44 | .physmem.regions = memblock_physmem_init_regions, | ||
45 | .physmem.cnt = 1, /* empty dummy entry */ | ||
46 | .physmem.max = INIT_PHYSMEM_REGIONS, | ||
47 | #endif | ||
48 | |||
40 | .bottom_up = false, | 49 | .bottom_up = false, |
41 | .current_limit = MEMBLOCK_ALLOC_ANYWHERE, | 50 | .current_limit = MEMBLOCK_ALLOC_ANYWHERE, |
42 | }; | 51 | }; |
@@ -1553,6 +1562,9 @@ static int __init memblock_init_debugfs(void) | |||
1553 | return -ENXIO; | 1562 | return -ENXIO; |
1554 | debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops); | 1563 | debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops); |
1555 | debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops); | 1564 | debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops); |
1565 | #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP | ||
1566 | debugfs_create_file("physmem", S_IRUGO, root, &memblock.physmem, &memblock_debug_fops); | ||
1567 | #endif | ||
1556 | 1568 | ||
1557 | return 0; | 1569 | return 0; |
1558 | } | 1570 | } |