Lines Matching +full:memory +full:- +full:region

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * A simple test that tries to allocate a memory region above a specified,
9 * | +-----------+ |
11 * +----------+-----------+---------+
16 * Expect to allocate a cleared region at the minimal memory address.
28 min_addr = memblock_end_of_DRAM() - SMP_CACHE_BYTES; in alloc_from_simple_generic_check()
35 ASSERT_EQ(rgn->size, size); in alloc_from_simple_generic_check()
36 ASSERT_EQ(rgn->base, min_addr); in alloc_from_simple_generic_check()
47 * A test that tries to allocate a memory region above a certain address.
51 * | + +---------+ |
53 * +------+------+---------+------------+
54 * ^ ^------.
59 * Expect to allocate a cleared region at the closest aligned memory address.
72 min_addr = memblock_end_of_DRAM() - (SMP_CACHE_BYTES * 2 - 1); in alloc_from_misaligned_generic_check()
79 ASSERT_EQ(rgn->size, size); in alloc_from_misaligned_generic_check()
80 ASSERT_EQ(rgn->base, memblock_end_of_DRAM() - SMP_CACHE_BYTES); in alloc_from_misaligned_generic_check()
91 * A test that tries to allocate a memory region above an address that is too
92 * close to the end of the memory:
95 * | +--------+---+ |
97 * +-----------+--------+---+------+
105 * Expect to prioritize granting memory over satisfying the minimal address
118 /* The address is too close to the end of the memory */ in alloc_from_top_down_high_addr_check()
119 min_addr = memblock_end_of_DRAM() - SZ_16; in alloc_from_top_down_high_addr_check()
124 ASSERT_EQ(rgn->size, size); in alloc_from_top_down_high_addr_check()
125 ASSERT_EQ(rgn->base, memblock_end_of_DRAM() - SMP_CACHE_BYTES); in alloc_from_top_down_high_addr_check()
136 * A test that tries to allocate a memory region when there is no space
140 * | +---------+-------------|
142 * +--------+---------+-------------+
147 * Expect to prioritize granting memory over satisfying the minimal address
148 * requirement and to allocate next to the previously reserved region. The
163 min_addr = memblock_end_of_DRAM() - SMP_CACHE_BYTES * 2; in alloc_from_top_down_no_space_above_check()
171 ASSERT_EQ(rgn->base, min_addr - r1_size); in alloc_from_top_down_no_space_above_check()
172 ASSERT_EQ(rgn->size, total_size); in alloc_from_top_down_no_space_above_check()
183 * A test that tries to allocate a memory region with a minimal address below
184 * the start address of the available memory. As the allocation is top-down,
185 * first reserve a region that will force allocation near the start.
200 min_addr = start_addr - SMP_CACHE_BYTES * 3; in alloc_from_top_down_min_addr_cap_check()
202 memblock_reserve(start_addr + r1_size, MEM_SIZE - r1_size); in alloc_from_top_down_min_addr_cap_check()
207 ASSERT_EQ(rgn->base, start_addr); in alloc_from_top_down_min_addr_cap_check()
208 ASSERT_EQ(rgn->size, MEM_SIZE); in alloc_from_top_down_min_addr_cap_check()
219 * A test that tries to allocate a memory region above an address that is too
220 * close to the end of the memory:
223 * |-----------+ + |
225 * +-----------+--------------+-----+
231 * Expect to prioritize granting memory over satisfying the minimal address
232 * requirement. Allocation happens at beginning of the available memory.
244 /* The address is too close to the end of the memory */ in alloc_from_bottom_up_high_addr_check()
245 min_addr = memblock_end_of_DRAM() - SZ_8; in alloc_from_bottom_up_high_addr_check()
250 ASSERT_EQ(rgn->size, size); in alloc_from_bottom_up_high_addr_check()
251 ASSERT_EQ(rgn->base, memblock_start_of_DRAM()); in alloc_from_bottom_up_high_addr_check()
262 * A test that tries to allocate a memory region when there is no space
266 * |-----------+ +-------------------|
268 * +-----------+----+-------------------+
273 * Expect to prioritize granting memory over satisfying the minimal address
274 * requirement and to allocate at the beginning of the available memory.
288 r2_size = memblock_end_of_DRAM() - min_addr; in alloc_from_bottom_up_no_space_above_check()
291 memblock_reserve(min_addr - SMP_CACHE_BYTES, r2_size); in alloc_from_bottom_up_no_space_above_check()
296 ASSERT_EQ(rgn->base, memblock_start_of_DRAM()); in alloc_from_bottom_up_no_space_above_check()
297 ASSERT_EQ(rgn->size, r1_size); in alloc_from_bottom_up_no_space_above_check()
308 * A test that tries to allocate a memory region with a minimal address below
309 * the start address of the available memory. Expect to allocate a region
310 * at the beginning of the available memory.
324 min_addr = start_addr - SMP_CACHE_BYTES * 3; in alloc_from_bottom_up_min_addr_cap_check()
329 ASSERT_EQ(rgn->base, start_addr); in alloc_from_bottom_up_min_addr_cap_check()
330 ASSERT_EQ(rgn->size, r1_size); in alloc_from_bottom_up_min_addr_cap_check()