aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r--include/linux/memblock.h54
1 files changed, 49 insertions, 5 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 77c60e52939d..cd0274bebd4c 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
22struct memblock_region { 25struct 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,12 +47,17 @@ struct memblock {
43 47
44extern struct memblock memblock; 48extern struct memblock memblock;
45extern int memblock_debug; 49extern int memblock_debug;
50#ifdef CONFIG_MOVABLE_NODE
51/* If movable_node boot option specified */
52extern 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
50phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end, 58phys_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);
52phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, 61phys_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);
54phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr); 63phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr);
@@ -59,6 +68,28 @@ int memblock_remove(phys_addr_t base, phys_addr_t size);
59int memblock_free(phys_addr_t base, phys_addr_t size); 68int memblock_free(phys_addr_t base, phys_addr_t size);
60int memblock_reserve(phys_addr_t base, phys_addr_t size); 69int memblock_reserve(phys_addr_t base, phys_addr_t size);
61void memblock_trim_memory(phys_addr_t align); 70void memblock_trim_memory(phys_addr_t align);
71int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
72int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
73#ifdef CONFIG_MOVABLE_NODE
74static inline bool memblock_is_hotpluggable(struct memblock_region *m)
75{
76 return m->flags & MEMBLOCK_HOTPLUG;
77}
78
79static inline bool movable_node_is_enabled(void)
80{
81 return movable_node_enabled;
82}
83#else
84static inline bool memblock_is_hotpluggable(struct memblock_region *m)
85{
86 return false;
87}
88static inline bool movable_node_is_enabled(void)
89{
90 return false;
91}
92#endif
62 93
63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 94#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, 95int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
@@ -87,7 +118,7 @@ void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
87/** 118/**
88 * for_each_free_mem_range - iterate through free memblock areas 119 * for_each_free_mem_range - iterate through free memblock areas
89 * @i: u64 used as loop variable 120 * @i: u64 used as loop variable
90 * @nid: node selector, %MAX_NUMNODES for all nodes 121 * @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 122 * @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 123 * @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 124 * @p_nid: ptr to int for nid of the range, can be %NULL
@@ -107,7 +138,7 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
107/** 138/**
108 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas 139 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
109 * @i: u64 used as loop variable 140 * @i: u64 used as loop variable
110 * @nid: node selector, %MAX_NUMNODES for all nodes 141 * @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 142 * @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 143 * @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 144 * @p_nid: ptr to int for nid of the range, can be %NULL
@@ -121,8 +152,21 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
121 i != (u64)ULLONG_MAX; \ 152 i != (u64)ULLONG_MAX; \
122 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid)) 153 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
123 154
155static inline void memblock_set_region_flags(struct memblock_region *r,
156 unsigned long flags)
157{
158 r->flags |= flags;
159}
160
161static inline void memblock_clear_region_flags(struct memblock_region *r,
162 unsigned long flags)
163{
164 r->flags &= ~flags;
165}
166
124#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 167#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
125int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid); 168int memblock_set_node(phys_addr_t base, phys_addr_t size,
169 struct memblock_type *type, int nid);
126 170
127static inline void memblock_set_region_node(struct memblock_region *r, int nid) 171static inline void memblock_set_region_node(struct memblock_region *r, int nid)
128{ 172{