diff options
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r-- | include/linux/memblock.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 77c60e52939d..1ef66360f0b0 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -19,9 +19,13 @@ | |||
19 | 19 | ||
20 | #define INIT_MEMBLOCK_REGIONS 128 | 20 | #define INIT_MEMBLOCK_REGIONS 128 |
21 | 21 | ||
22 | /* Definition of memblock flags. */ | ||
23 | #define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */ | ||
24 | |||
22 | struct memblock_region { | 25 | struct memblock_region { |
23 | phys_addr_t base; | 26 | phys_addr_t base; |
24 | phys_addr_t size; | 27 | phys_addr_t size; |
28 | unsigned long flags; | ||
25 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 29 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
26 | int nid; | 30 | int nid; |
27 | #endif | 31 | #endif |
@@ -43,15 +47,21 @@ struct memblock { | |||
43 | 47 | ||
44 | extern struct memblock memblock; | 48 | extern struct memblock memblock; |
45 | extern int memblock_debug; | 49 | extern int memblock_debug; |
50 | #ifdef CONFIG_MOVABLE_NODE | ||
51 | /* If movable_node boot option specified */ | ||
52 | extern bool movable_node_enabled; | ||
53 | #endif /* CONFIG_MOVABLE_NODE */ | ||
46 | 54 | ||
47 | #define memblock_dbg(fmt, ...) \ | 55 | #define memblock_dbg(fmt, ...) \ |
48 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | 56 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
49 | 57 | ||
50 | phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end, | 58 | phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, |
51 | phys_addr_t size, phys_addr_t align, int nid); | 59 | phys_addr_t start, phys_addr_t end, |
60 | int nid); | ||
52 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, | 61 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, |
53 | phys_addr_t size, phys_addr_t align); | 62 | phys_addr_t size, phys_addr_t align); |
54 | phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr); | 63 | phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr); |
64 | phys_addr_t get_allocated_memblock_memory_regions_info(phys_addr_t *addr); | ||
55 | void memblock_allow_resize(void); | 65 | void memblock_allow_resize(void); |
56 | int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); | 66 | int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); |
57 | int memblock_add(phys_addr_t base, phys_addr_t size); | 67 | int memblock_add(phys_addr_t base, phys_addr_t size); |
@@ -59,6 +69,28 @@ int memblock_remove(phys_addr_t base, phys_addr_t size); | |||
59 | int memblock_free(phys_addr_t base, phys_addr_t size); | 69 | int memblock_free(phys_addr_t base, phys_addr_t size); |
60 | int memblock_reserve(phys_addr_t base, phys_addr_t size); | 70 | int memblock_reserve(phys_addr_t base, phys_addr_t size); |
61 | void memblock_trim_memory(phys_addr_t align); | 71 | void memblock_trim_memory(phys_addr_t align); |
72 | int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); | ||
73 | int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); | ||
74 | #ifdef CONFIG_MOVABLE_NODE | ||
75 | static inline bool memblock_is_hotpluggable(struct memblock_region *m) | ||
76 | { | ||
77 | return m->flags & MEMBLOCK_HOTPLUG; | ||
78 | } | ||
79 | |||
80 | static inline bool movable_node_is_enabled(void) | ||
81 | { | ||
82 | return movable_node_enabled; | ||
83 | } | ||
84 | #else | ||
85 | static inline bool memblock_is_hotpluggable(struct memblock_region *m) | ||
86 | { | ||
87 | return false; | ||
88 | } | ||
89 | static inline bool movable_node_is_enabled(void) | ||
90 | { | ||
91 | return false; | ||
92 | } | ||
93 | #endif | ||
62 | 94 | ||
63 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 95 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
64 | int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, | 96 | int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, |
@@ -87,7 +119,7 @@ void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start, | |||
87 | /** | 119 | /** |
88 | * for_each_free_mem_range - iterate through free memblock areas | 120 | * for_each_free_mem_range - iterate through free memblock areas |
89 | * @i: u64 used as loop variable | 121 | * @i: u64 used as loop variable |
90 | * @nid: node selector, %MAX_NUMNODES for all nodes | 122 | * @nid: node selector, %NUMA_NO_NODE for all nodes |
91 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL | 123 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL |
92 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL | 124 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL |
93 | * @p_nid: ptr to int for nid of the range, can be %NULL | 125 | * @p_nid: ptr to int for nid of the range, can be %NULL |
@@ -107,7 +139,7 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start, | |||
107 | /** | 139 | /** |
108 | * for_each_free_mem_range_reverse - rev-iterate through free memblock areas | 140 | * for_each_free_mem_range_reverse - rev-iterate through free memblock areas |
109 | * @i: u64 used as loop variable | 141 | * @i: u64 used as loop variable |
110 | * @nid: node selector, %MAX_NUMNODES for all nodes | 142 | * @nid: node selector, %NUMA_NO_NODE for all nodes |
111 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL | 143 | * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL |
112 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL | 144 | * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL |
113 | * @p_nid: ptr to int for nid of the range, can be %NULL | 145 | * @p_nid: ptr to int for nid of the range, can be %NULL |
@@ -121,8 +153,21 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start, | |||
121 | i != (u64)ULLONG_MAX; \ | 153 | i != (u64)ULLONG_MAX; \ |
122 | __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid)) | 154 | __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid)) |
123 | 155 | ||
156 | static inline void memblock_set_region_flags(struct memblock_region *r, | ||
157 | unsigned long flags) | ||
158 | { | ||
159 | r->flags |= flags; | ||
160 | } | ||
161 | |||
162 | static inline void memblock_clear_region_flags(struct memblock_region *r, | ||
163 | unsigned long flags) | ||
164 | { | ||
165 | r->flags &= ~flags; | ||
166 | } | ||
167 | |||
124 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 168 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
125 | int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid); | 169 | int memblock_set_node(phys_addr_t base, phys_addr_t size, |
170 | struct memblock_type *type, int nid); | ||
126 | 171 | ||
127 | static inline void memblock_set_region_node(struct memblock_region *r, int nid) | 172 | static inline void memblock_set_region_node(struct memblock_region *r, int nid) |
128 | { | 173 | { |