Lines Matching full:mm
38 static bool assert_no_holes(struct kunit *test, const struct drm_mm *mm) in assert_no_holes() argument
45 drm_mm_for_each_hole(hole, mm, hole_start, hole_end) in assert_no_holes()
53 drm_mm_for_each_node(hole, mm) { in assert_no_holes()
63 static bool assert_one_hole(struct kunit *test, const struct drm_mm *mm, u64 start, u64 end) in assert_one_hole() argument
74 drm_mm_for_each_hole(hole, mm, hole_start, hole_end) { in assert_one_hole()
78 "empty mm has incorrect hole, found (%llx, %llx), expect (%llx, %llx)\n", in assert_one_hole()
103 static bool assert_node(struct kunit *test, struct drm_mm_node *node, struct drm_mm *mm, in assert_node() argument
108 if (!drm_mm_node_allocated(node) || node->mm != mm) { in assert_node()
138 struct drm_mm mm; in drm_test_mm_init() local
142 memset(&mm, 0, sizeof(mm)); in drm_test_mm_init()
143 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_initialized(&mm), in drm_test_mm_init()
144 "zeroed mm claims to be initialized\n"); in drm_test_mm_init()
146 memset(&mm, 0xff, sizeof(mm)); in drm_test_mm_init()
147 drm_mm_init(&mm, 0, size); in drm_test_mm_init()
148 if (!drm_mm_initialized(&mm)) { in drm_test_mm_init()
149 KUNIT_FAIL(test, "mm claims not to be initialized\n"); in drm_test_mm_init()
153 if (!drm_mm_clean(&mm)) { in drm_test_mm_init()
154 KUNIT_FAIL(test, "mm not empty on creation\n"); in drm_test_mm_init()
159 if (!assert_one_hole(test, &mm, 0, size)) { in drm_test_mm_init()
160 KUNIT_FAIL(test, "mm not one hole on creation"); in drm_test_mm_init()
167 if (drm_mm_reserve_node(&mm, &tmp)) { in drm_test_mm_init()
173 if (!assert_no_holes(test, &mm)) { in drm_test_mm_init()
174 KUNIT_FAIL(test, "mm has holes when filled"); in drm_test_mm_init()
180 if (!assert_one_hole(test, &mm, 0, size)) { in drm_test_mm_init()
181 KUNIT_FAIL(test, "mm does not have single hole after emptying"); in drm_test_mm_init()
186 drm_mm_takedown(&mm); in drm_test_mm_init()
192 struct drm_mm mm; in drm_test_mm_debug() local
198 drm_mm_init(&mm, 0, 4096); in drm_test_mm_debug()
203 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[0]), in drm_test_mm_debug()
209 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[1]), in drm_test_mm_debug()
213 drm_mm_print(&mm, &p); in drm_test_mm_debug()
217 static bool expect_insert(struct kunit *test, struct drm_mm *mm, in expect_insert() argument
223 err = drm_mm_insert_node_generic(mm, node, in expect_insert()
233 if (!assert_node(test, node, mm, size, alignment, color)) { in expect_insert()
243 struct drm_mm mm; in drm_test_mm_align_pot() local
249 drm_mm_init(&mm, 1, U64_MAX - 2); in drm_test_mm_align_pot()
262 if (!expect_insert(test, &mm, node, size, align, bit, &insert_modes[0])) { in drm_test_mm_align_pot()
271 drm_mm_for_each_node_safe(node, next, &mm) { in drm_test_mm_align_pot()
275 drm_mm_takedown(&mm); in drm_test_mm_align_pot()
290 struct drm_mm mm; in drm_test_mm_once() local
293 drm_mm_init(&mm, 0, 7); in drm_test_mm_once()
298 if (drm_mm_reserve_node(&mm, &rsvd_lo)) { in drm_test_mm_once()
306 if (drm_mm_reserve_node(&mm, &rsvd_hi)) { in drm_test_mm_once()
317 if (drm_mm_insert_node_generic(&mm, &node, 2, 0, 0, mode)) { in drm_test_mm_once()
328 drm_mm_takedown(&mm); in drm_test_mm_once()