Lines Matching full:size

147 /* adjust *@size so that (@base + *@size) doesn't overflow, return new size */
148 static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size) in memblock_cap_size() argument
150 return *size = min(*size, PHYS_ADDR_MAX - base); in memblock_cap_size()
163 phys_addr_t base, phys_addr_t size) in memblock_overlaps_region() argument
168 if (memblock_addrs_overlap(base, size, type->regions[i].base, in memblock_overlaps_region()
169 type->regions[i].size)) in memblock_overlaps_region()
179 * @size: size of free area to find
191 phys_addr_t size, phys_addr_t align, int nid, in __memblock_find_range_bottom_up() argument
202 if (cand < this_end && this_end - cand >= size) in __memblock_find_range_bottom_up()
214 * @size: size of free area to find
226 phys_addr_t size, phys_addr_t align, int nid, in __memblock_find_range_top_down() argument
237 if (this_end < size) in __memblock_find_range_top_down()
240 cand = round_down(this_end - size, align); in __memblock_find_range_top_down()
250 * @size: size of free area to find
258 * Find @size free area aligned to @align in the specified range and node.
271 static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, in memblock_find_in_range_node() argument
300 size, align, nid, flags); in memblock_find_in_range_node()
318 return __memblock_find_range_top_down(start, end, size, align, nid, in memblock_find_in_range_node()
327 * @size: size of free area to find
330 * Find @size free area aligned to @align in the specified range.
336 phys_addr_t end, phys_addr_t size, in memblock_find_in_range() argument
343 ret = memblock_find_in_range_node(size, align, start, end, in memblock_find_in_range()
348 &size); in memblock_find_in_range()
358 type->total_size -= type->regions[r].size; in memblock_remove_region()
368 type->regions[0].size = 0; in memblock_remove_region()
380 phys_addr_t addr, size; in memblock_discard() local
384 size = PAGE_ALIGN(sizeof(struct memblock_region) * in memblock_discard()
386 __memblock_free_late(addr, size); in memblock_discard()
391 size = PAGE_ALIGN(sizeof(struct memblock_region) * in memblock_discard()
393 __memblock_free_late(addr, size); in memblock_discard()
399 * memblock_double_array - double the size of the memblock regions array
402 * @new_area_size: size of memory range to avoid overlap with
404 * Double the size of the @type regions array. If memblock is being used to
429 /* Calculate new doubled size */ in memblock_double_array()
520 if (this->base + this->size != next->base || in memblock_merge_regions()
524 BUG_ON(this->base + this->size > next->base); in memblock_merge_regions()
529 this->size += next->size; in memblock_merge_regions()
541 * @size: size of the new region
545 * Insert new memblock region [@base, @base + @size) into @type at @idx.
550 phys_addr_t size, in memblock_insert_region() argument
559 rgn->size = size; in memblock_insert_region()
563 type->total_size += size; in memblock_insert_region()
570 * @size: size of the new region
574 * Add new memblock region [@base, @base + @size) into @type. The new region
583 phys_addr_t base, phys_addr_t size, in memblock_add_range() argument
588 phys_addr_t end = base + memblock_cap_size(base, &size); in memblock_add_range()
592 if (!size) in memblock_add_range()
596 if (type->regions[0].size == 0) { in memblock_add_range()
599 type->regions[0].size = size; in memblock_add_range()
602 type->total_size = size; in memblock_add_range()
616 phys_addr_t rend = rbase + rgn->size; in memblock_add_range()
658 if (memblock_double_array(type, obase, size) < 0) in memblock_add_range()
671 * @size: size of the new region
674 * Add new memblock region [@base, @base + @size) to the "memory"
680 int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size, in memblock_add_node() argument
683 return memblock_add_range(&memblock.memory, base, size, nid, 0); in memblock_add_node()
689 * @size: size of the new region
691 * Add new memblock region [@base, @base + @size) to the "memory"
697 int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size) in memblock_add() argument
699 phys_addr_t end = base + size - 1; in memblock_add()
704 return memblock_add_range(&memblock.memory, base, size, MAX_NUMNODES, 0); in memblock_add()
711 * @size: size of range to isolate
716 * [@base, @base + @size). Crossing regions are split at the boundaries,
724 phys_addr_t base, phys_addr_t size, in memblock_isolate_range() argument
727 phys_addr_t end = base + memblock_cap_size(base, &size); in memblock_isolate_range()
733 if (!size) in memblock_isolate_range()
738 if (memblock_double_array(type, base, size) < 0) in memblock_isolate_range()
743 phys_addr_t rend = rbase + rgn->size; in memblock_isolate_range()
756 rgn->size -= base - rbase; in memblock_isolate_range()
767 rgn->size -= end - rbase; in memblock_isolate_range()
784 phys_addr_t base, phys_addr_t size) in memblock_remove_range() argument
789 ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn); in memblock_remove_range()
798 int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size) in memblock_remove() argument
800 phys_addr_t end = base + size - 1; in memblock_remove()
805 return memblock_remove_range(&memblock.memory, base, size); in memblock_remove()
811 * @size: size of the boot memory block in bytes
816 int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) in memblock_free() argument
818 phys_addr_t end = base + size - 1; in memblock_free()
823 kmemleak_free_part_phys(base, size); in memblock_free()
824 return memblock_remove_range(&memblock.reserved, base, size); in memblock_free()
827 int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size) in memblock_reserve() argument
829 phys_addr_t end = base + size - 1; in memblock_reserve()
834 return memblock_add_range(&memblock.reserved, base, size, MAX_NUMNODES, 0); in memblock_reserve()
840 * @size: size of the region
844 * This function isolates region [@base, @base + @size), and sets/clears flag
849 phys_addr_t size, int set, int flag) in memblock_setclr_flag() argument
854 ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn); in memblock_setclr_flag()
874 * @size: the size of the region
878 int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size) in memblock_mark_hotplug() argument
880 return memblock_setclr_flag(base, size, 1, MEMBLOCK_HOTPLUG); in memblock_mark_hotplug()
886 * @size: the size of the region
890 int __init_memblock memblock_clear_hotplug(phys_addr_t base, phys_addr_t size) in memblock_clear_hotplug() argument
892 return memblock_setclr_flag(base, size, 0, MEMBLOCK_HOTPLUG); in memblock_clear_hotplug()
898 * @size: the size of the region
902 int __init_memblock memblock_mark_mirror(phys_addr_t base, phys_addr_t size) in memblock_mark_mirror() argument
906 return memblock_setclr_flag(base, size, 1, MEMBLOCK_MIRROR); in memblock_mark_mirror()
912 * @size: the size of the region
916 int __init_memblock memblock_mark_nomap(phys_addr_t base, phys_addr_t size) in memblock_mark_nomap() argument
918 return memblock_setclr_flag(base, size, 1, MEMBLOCK_NOMAP); in memblock_mark_nomap()
924 * @size: the size of the region
928 int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size) in memblock_clear_nomap() argument
930 return memblock_setclr_flag(base, size, 0, MEMBLOCK_NOMAP); in memblock_clear_nomap()
950 phys_addr_t size = r->size; in __next_reserved_mem_region() local
955 *out_end = base + size - 1; in __next_reserved_mem_region()
1032 phys_addr_t m_end = m->base + m->size; in __next_mem_range()
1057 r_start = idx_b ? r[-1].base + r[-1].size : 0; in __next_mem_range()
1136 phys_addr_t m_end = m->base + m->size; in __next_mem_range_rev()
1161 r_start = idx_b ? r[-1].base + r[-1].size : 0; in __next_mem_range_rev()
1206 if (PFN_UP(r->base) >= PFN_DOWN(r->base + r->size)) in __next_mem_pfn_range()
1219 *out_end_pfn = PFN_DOWN(r->base + r->size); in __next_mem_pfn_range()
1227 * @size: size of area to set node ID for
1231 * Set the nid of memblock @type regions in [@base, @base + @size) to @nid.
1237 int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size, in memblock_set_node() argument
1243 ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn); in memblock_set_node()
1321 * @size: size of memory block to be allocated in bytes
1322 * @align: alignment of the region and block's size
1343 static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, in memblock_alloc_range_nid() argument
1360 found = memblock_find_in_range_node(size, align, start, end, nid, in memblock_alloc_range_nid()
1362 if (found && !memblock_reserve(found, size)) in memblock_alloc_range_nid()
1366 found = memblock_find_in_range_node(size, align, start, in memblock_alloc_range_nid()
1369 if (found && !memblock_reserve(found, size)) in memblock_alloc_range_nid()
1376 &size); in memblock_alloc_range_nid()
1391 kmemleak_alloc_phys(found, size, 0, 0); in memblock_alloc_range_nid()
1398 * @size: size of memory block to be allocated in bytes
1399 * @align: alignment of the region and block's size
1403 * Allocate @size bytes in the between @start and @end.
1408 phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size, in memblock_phys_alloc_range() argument
1413 return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE); in memblock_phys_alloc_range()
1418 * @size: size of memory block to be allocated in bytes
1419 * @align: alignment of the region and block's size
1429 phys_addr_t __init memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid) in memblock_phys_alloc_try_nid() argument
1431 return memblock_alloc_range_nid(size, align, 0, in memblock_phys_alloc_try_nid()
1437 * @size: size of memory block to be allocated in bytes
1438 * @align: alignment of the region and block's size
1455 phys_addr_t size, phys_addr_t align, in memblock_alloc_internal() argument
1467 return kzalloc_node(size, GFP_NOWAIT, nid); in memblock_alloc_internal()
1472 alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid); in memblock_alloc_internal()
1476 alloc = memblock_alloc_range_nid(size, align, 0, max_addr, nid); in memblock_alloc_internal()
1487 * @size: size of memory block to be allocated in bytes
1488 * @align: alignment of the region and block's size
1504 phys_addr_t size, phys_addr_t align, in memblock_alloc_try_nid_raw() argument
1511 __func__, (u64)size, (u64)align, nid, &min_addr, in memblock_alloc_try_nid_raw()
1514 ptr = memblock_alloc_internal(size, align, in memblock_alloc_try_nid_raw()
1516 if (ptr && size > 0) in memblock_alloc_try_nid_raw()
1517 page_init_poison(ptr, size); in memblock_alloc_try_nid_raw()
1524 * @size: size of memory block to be allocated in bytes
1525 * @align: alignment of the region and block's size
1540 phys_addr_t size, phys_addr_t align, in memblock_alloc_try_nid() argument
1547 __func__, (u64)size, (u64)align, nid, &min_addr, in memblock_alloc_try_nid()
1549 ptr = memblock_alloc_internal(size, align, in memblock_alloc_try_nid()
1552 memset(ptr, 0, size); in memblock_alloc_try_nid()
1560 * @size: size of the boot memory block in bytes
1566 void __init __memblock_free_late(phys_addr_t base, phys_addr_t size) in __memblock_free_late() argument
1570 end = base + size - 1; in __memblock_free_late()
1573 kmemleak_free_part_phys(base, size); in __memblock_free_late()
1575 end = PFN_DOWN(base + size); in __memblock_free_late()
1624 return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size); in memblock_end_of_DRAM()
1633 * translate the memory @limit size into the max address within one of in __find_max_addr()
1634 * the memory memblock regions, if the @limit exceeds the total size in __find_max_addr()
1638 if (limit <= r->size) { in __find_max_addr()
1642 limit -= r->size; in __find_max_addr()
1657 /* @limit exceeds the total size of the memory, do nothing */ in memblock_enforce_memory_limit()
1668 void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size) in memblock_cap_memory_range() argument
1673 if (!size) in memblock_cap_memory_range()
1676 ret = memblock_isolate_range(&memblock.memory, base, size, in memblock_cap_memory_range()
1693 base + size, PHYS_ADDR_MAX); in memblock_cap_memory_range()
1705 /* @limit exceeds the total size of the memory, do nothing */ in memblock_mem_limit_remove_map()
1722 type->regions[mid].size)) in memblock_search()
1760 *end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size); in memblock_search_pfn_nid()
1769 * @size: size of region to check
1771 * Check if the region [@base, @base + @size) is a subset of a memory block.
1776 bool __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size) in memblock_is_region_memory() argument
1779 phys_addr_t end = base + memblock_cap_size(base, &size); in memblock_is_region_memory()
1784 memblock.memory.regions[idx].size) >= end; in memblock_is_region_memory()
1790 * @size: size of region to check
1792 * Check if the region [@base, @base + @size) intersects a reserved
1798 bool __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size) in memblock_is_region_reserved() argument
1800 memblock_cap_size(base, &size); in memblock_is_region_reserved()
1801 return memblock_overlaps_region(&memblock.reserved, base, size); in memblock_is_region_reserved()
1811 orig_end = r->base + r->size; in memblock_trim_memory()
1820 r->size = end - start; in memblock_trim_memory()
1841 phys_addr_t base, end, size; in memblock_dump() local
1852 size = rgn->size; in memblock_dump()
1853 end = base + size - 1; in memblock_dump()
1861 type->name, idx, &base, &end, &size, nid_buf, flags); in memblock_dump()
1868 pr_info(" memory size = %pa reserved size = %pa\n", in __memblock_dump_all()
1997 end = reg->base + reg->size - 1; in memblock_debug_show()