aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2014-06-04 19:06:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 19:53:57 -0400
commit2bfc2862c4fe38379a2fb2cfba33fad32ccb4ff4 (patch)
tree1413260b509c37c05857525e7327fa5985ca8375 /mm/memblock.c
parent367464362591d89b371e2a690638e9bc899d8ebb (diff)
memblock: introduce memblock_alloc_range()
This introduces memblock_alloc_range() which allocates memblock from the specified range of physical address. I would like to use this function to specify the location of CMA. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Don Dutile <ddutile@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index a810ba923cdd..146736411318 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1033,22 +1033,35 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
1033} 1033}
1034#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ 1034#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
1035 1035
1036static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size, 1036static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
1037 phys_addr_t align, phys_addr_t max_addr, 1037 phys_addr_t align, phys_addr_t start,
1038 int nid) 1038 phys_addr_t end, int nid)
1039{ 1039{
1040 phys_addr_t found; 1040 phys_addr_t found;
1041 1041
1042 if (!align) 1042 if (!align)
1043 align = SMP_CACHE_BYTES; 1043 align = SMP_CACHE_BYTES;
1044 1044
1045 found = memblock_find_in_range_node(size, align, 0, max_addr, nid); 1045 found = memblock_find_in_range_node(size, align, start, end, nid);
1046 if (found && !memblock_reserve(found, size)) 1046 if (found && !memblock_reserve(found, size))
1047 return found; 1047 return found;
1048 1048
1049 return 0; 1049 return 0;
1050} 1050}
1051 1051
1052phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
1053 phys_addr_t start, phys_addr_t end)
1054{
1055 return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE);
1056}
1057
1058static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
1059 phys_addr_t align, phys_addr_t max_addr,
1060 int nid)
1061{
1062 return memblock_alloc_range_nid(size, align, 0, max_addr, nid);
1063}
1064
1052phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) 1065phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
1053{ 1066{
1054 return memblock_alloc_base_nid(size, align, MEMBLOCK_ALLOC_ACCESSIBLE, nid); 1067 return memblock_alloc_base_nid(size, align, MEMBLOCK_ALLOC_ACCESSIBLE, nid);