Lines Matching full:test
59 static void ttm_bo_reserve_optimistic_no_ticket(struct kunit *test) in ttm_bo_reserve_optimistic_no_ticket() argument
61 const struct ttm_bo_test_case *params = test->param_value; in ttm_bo_reserve_optimistic_no_ticket()
65 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_optimistic_no_ticket()
68 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_reserve_optimistic_no_ticket()
73 static void ttm_bo_reserve_locked_no_sleep(struct kunit *test) in ttm_bo_reserve_locked_no_sleep() argument
80 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_locked_no_sleep()
88 KUNIT_ASSERT_EQ(test, err, -EBUSY); in ttm_bo_reserve_locked_no_sleep()
91 static void ttm_bo_reserve_no_wait_ticket(struct kunit *test) in ttm_bo_reserve_no_wait_ticket() argument
101 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_no_wait_ticket()
104 KUNIT_ASSERT_EQ(test, err, -EBUSY); in ttm_bo_reserve_no_wait_ticket()
109 static void ttm_bo_reserve_double_resv(struct kunit *test) in ttm_bo_reserve_double_resv() argument
119 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_double_resv()
122 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_reserve_double_resv()
129 KUNIT_ASSERT_EQ(test, err, -EALREADY); in ttm_bo_reserve_double_resv()
133 * A test case heavily inspired by ww_test_edeadlk_normal(). It injects
139 static void ttm_bo_reserve_deadlock(struct kunit *test) in ttm_bo_reserve_deadlock() argument
147 bo1 = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_deadlock()
148 bo2 = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_deadlock()
161 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_reserve_deadlock()
164 KUNIT_ASSERT_EQ(test, err, -EDEADLK); in ttm_bo_reserve_deadlock()
211 static void ttm_bo_reserve_interrupted(struct kunit *test) in ttm_bo_reserve_interrupted() argument
217 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_interrupted()
222 KUNIT_FAIL(test, "Couldn't create ttm bo reserve task\n"); in ttm_bo_reserve_interrupted()
233 KUNIT_ASSERT_EQ(test, err, -ERESTARTSYS); in ttm_bo_reserve_interrupted()
237 static void ttm_bo_unreserve_basic(struct kunit *test) in ttm_bo_unreserve_basic() argument
239 struct ttm_test_devices *priv = test->priv; in ttm_bo_unreserve_basic()
249 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_unreserve_basic()
251 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_unreserve_basic()
252 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_unreserve_basic()
255 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_basic()
258 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_unreserve_basic()
262 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_basic()
273 KUNIT_ASSERT_EQ(test, in ttm_bo_unreserve_basic()
280 static void ttm_bo_unreserve_pinned(struct kunit *test) in ttm_bo_unreserve_pinned() argument
282 struct ttm_test_devices *priv = test->priv; in ttm_bo_unreserve_pinned()
290 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_unreserve_pinned()
291 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_unreserve_pinned()
294 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_pinned()
297 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_unreserve_pinned()
298 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_unreserve_pinned()
304 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_pinned()
309 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_pinned()
310 KUNIT_ASSERT_EQ(test, in ttm_bo_unreserve_pinned()
314 KUNIT_ASSERT_EQ(test, in ttm_bo_unreserve_pinned()
321 static void ttm_bo_unreserve_bulk(struct kunit *test) in ttm_bo_unreserve_bulk() argument
323 struct ttm_test_devices *priv = test->priv; in ttm_bo_unreserve_bulk()
337 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_unreserve_bulk()
339 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_unreserve_bulk()
340 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_unreserve_bulk()
342 resv = kunit_kzalloc(test, sizeof(*resv), GFP_KERNEL); in ttm_bo_unreserve_bulk()
343 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_unreserve_bulk()
346 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_bulk()
351 bo1 = ttm_bo_kunit_init(test, test->priv, BO_SIZE, resv); in ttm_bo_unreserve_bulk()
352 bo2 = ttm_bo_kunit_init(test, test->priv, BO_SIZE, resv); in ttm_bo_unreserve_bulk()
359 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_bulk()
367 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_unreserve_bulk()
374 KUNIT_ASSERT_PTR_EQ(test, res1, pos->last); in ttm_bo_unreserve_bulk()
382 static void ttm_bo_put_basic(struct kunit *test) in ttm_bo_put_basic() argument
384 struct ttm_test_devices *priv = test->priv; in ttm_bo_put_basic()
392 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_put_basic()
394 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_put_basic()
395 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_put_basic()
398 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_put_basic()
401 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_put_basic()
405 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_put_basic()
411 KUNIT_EXPECT_EQ(test, err, 0); in ttm_bo_put_basic()
426 static void ttm_bo_put_shared_resv(struct kunit *test) in ttm_bo_put_shared_resv() argument
428 struct ttm_test_devices *priv = test->priv; in ttm_bo_put_shared_resv()
437 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_put_shared_resv()
438 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_put_shared_resv()
441 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_put_shared_resv()
444 external_resv = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_put_shared_resv()
445 KUNIT_ASSERT_NOT_NULL(test, external_resv); in ttm_bo_put_shared_resv()
449 fence = kunit_kzalloc(test, sizeof(*fence), GFP_KERNEL); in ttm_bo_put_shared_resv()
450 KUNIT_ASSERT_NOT_NULL(test, fence); in ttm_bo_put_shared_resv()
462 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_put_shared_resv()
469 static void ttm_bo_pin_basic(struct kunit *test) in ttm_bo_pin_basic() argument
471 struct ttm_test_devices *priv = test->priv; in ttm_bo_pin_basic()
477 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_pin_basic()
478 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_pin_basic()
481 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_pin_basic()
484 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_pin_basic()
492 KUNIT_ASSERT_EQ(test, bo->pin_count, no_pins); in ttm_bo_pin_basic()
495 static void ttm_bo_pin_unpin_resource(struct kunit *test) in ttm_bo_pin_unpin_resource() argument
497 struct ttm_test_devices *priv = test->priv; in ttm_bo_pin_unpin_resource()
510 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_pin_unpin_resource()
512 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_pin_unpin_resource()
513 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_pin_unpin_resource()
516 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_pin_unpin_resource()
519 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_pin_unpin_resource()
522 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_pin_unpin_resource()
532 KUNIT_ASSERT_EQ(test, bo->pin_count, 1); in ttm_bo_pin_unpin_resource()
533 KUNIT_ASSERT_NULL(test, pos->first); in ttm_bo_pin_unpin_resource()
534 KUNIT_ASSERT_NULL(test, pos->last); in ttm_bo_pin_unpin_resource()
540 KUNIT_ASSERT_PTR_EQ(test, res, pos->last); in ttm_bo_pin_unpin_resource()
541 KUNIT_ASSERT_EQ(test, bo->pin_count, 0); in ttm_bo_pin_unpin_resource()
546 static void ttm_bo_multiple_pin_one_unpin(struct kunit *test) in ttm_bo_multiple_pin_one_unpin() argument
548 struct ttm_test_devices *priv = test->priv; in ttm_bo_multiple_pin_one_unpin()
561 place = ttm_place_kunit_init(test, mem_type, 0); in ttm_bo_multiple_pin_one_unpin()
563 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_bo_multiple_pin_one_unpin()
564 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_bo_multiple_pin_one_unpin()
567 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_multiple_pin_one_unpin()
570 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_multiple_pin_one_unpin()
573 KUNIT_ASSERT_EQ(test, err, 0); in ttm_bo_multiple_pin_one_unpin()
587 KUNIT_ASSERT_EQ(test, bo->pin_count, 2); in ttm_bo_multiple_pin_one_unpin()
588 KUNIT_ASSERT_NULL(test, pos->first); in ttm_bo_multiple_pin_one_unpin()
589 KUNIT_ASSERT_NULL(test, pos->last); in ttm_bo_multiple_pin_one_unpin()
595 KUNIT_ASSERT_EQ(test, bo->pin_count, 1); in ttm_bo_multiple_pin_one_unpin()
596 KUNIT_ASSERT_NULL(test, pos->first); in ttm_bo_multiple_pin_one_unpin()
597 KUNIT_ASSERT_NULL(test, pos->last); in ttm_bo_multiple_pin_one_unpin()