Lines Matching +full:additional +full:- +full:devs

1 // SPDX-License-Identifier: GPL-2.0 AND MIT
19 struct ttm_test_devices *devs; member
37 priv->devs = ttm_test_devices_basic(test); in ttm_pool_test_init()
38 test->priv = priv; in ttm_pool_test_init()
45 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_test_fini()
47 ttm_test_devices_put(test, priv->devs); in ttm_pool_test_fini()
55 struct ttm_pool_test_priv *priv = test->priv; in ttm_tt_kunit_init()
60 bo = ttm_bo_kunit_init(test, priv->devs, size, NULL); in ttm_tt_kunit_init()
62 priv->mock_bo = bo; in ttm_tt_kunit_init()
67 err = ttm_tt_init(tt, priv->mock_bo, page_flags, caching, 0); in ttm_tt_kunit_init()
77 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_pre_populated()
78 struct ttm_test_devices *devs = priv->devs; in ttm_pool_pre_populated() local
89 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, true, false); in ttm_pool_pre_populated()
128 strscpy(desc, t->description, KUNIT_PARAM_DESC_SIZE); in ttm_pool_alloc_case_desc()
136 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_alloc_basic()
137 struct ttm_test_devices *devs = priv->devs; in ttm_pool_alloc_basic() local
138 const struct ttm_pool_test_case *params = test->param_value; in ttm_pool_alloc_basic()
143 unsigned int expected_num_pages = 1 << params->order; in ttm_pool_alloc_basic()
153 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, params->use_dma_alloc, in ttm_pool_alloc_basic()
156 KUNIT_ASSERT_PTR_EQ(test, pool->dev, devs->dev); in ttm_pool_alloc_basic()
157 KUNIT_ASSERT_EQ(test, pool->nid, NUMA_NO_NODE); in ttm_pool_alloc_basic()
158 KUNIT_ASSERT_EQ(test, pool->use_dma_alloc, params->use_dma_alloc); in ttm_pool_alloc_basic()
162 KUNIT_ASSERT_EQ(test, tt->num_pages, expected_num_pages); in ttm_pool_alloc_basic()
164 fst_page = tt->pages[0]; in ttm_pool_alloc_basic()
165 last_page = tt->pages[tt->num_pages - 1]; in ttm_pool_alloc_basic()
167 if (params->order <= MAX_PAGE_ORDER) { in ttm_pool_alloc_basic()
168 if (params->use_dma_alloc) { in ttm_pool_alloc_basic()
169 KUNIT_ASSERT_NOT_NULL(test, (void *)fst_page->private); in ttm_pool_alloc_basic()
170 KUNIT_ASSERT_NOT_NULL(test, (void *)last_page->private); in ttm_pool_alloc_basic()
172 KUNIT_ASSERT_EQ(test, fst_page->private, params->order); in ttm_pool_alloc_basic()
175 if (params->use_dma_alloc) { in ttm_pool_alloc_basic()
176 KUNIT_ASSERT_NOT_NULL(test, (void *)fst_page->private); in ttm_pool_alloc_basic()
177 KUNIT_ASSERT_NULL(test, (void *)last_page->private); in ttm_pool_alloc_basic()
183 KUNIT_ASSERT_EQ(test, fst_page->private, in ttm_pool_alloc_basic()
185 params->order)); in ttm_pool_alloc_basic()
186 KUNIT_ASSERT_EQ(test, last_page->private, 0); in ttm_pool_alloc_basic()
197 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_alloc_basic_dma_addr()
198 struct ttm_test_devices *devs = priv->devs; in ttm_pool_alloc_basic_dma_addr() local
199 const struct ttm_pool_test_case *params = test->param_value; in ttm_pool_alloc_basic_dma_addr()
205 unsigned int expected_num_pages = 1 << params->order; in ttm_pool_alloc_basic_dma_addr()
212 bo = ttm_bo_kunit_init(test, devs, size, NULL); in ttm_pool_alloc_basic_dma_addr()
221 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, true, false); in ttm_pool_alloc_basic_dma_addr()
225 KUNIT_ASSERT_EQ(test, tt->num_pages, expected_num_pages); in ttm_pool_alloc_basic_dma_addr()
227 dma1 = tt->dma_address[0]; in ttm_pool_alloc_basic_dma_addr()
228 dma2 = tt->dma_address[tt->num_pages - 1]; in ttm_pool_alloc_basic_dma_addr()
250 pt = &pool->caching[caching].orders[order]; in ttm_pool_alloc_order_caching_match()
251 KUNIT_ASSERT_FALSE(test, list_empty(&pt->pages)); in ttm_pool_alloc_order_caching_match()
259 KUNIT_ASSERT_TRUE(test, list_empty(&pt->pages)); in ttm_pool_alloc_order_caching_match()
279 pt_pool = &pool->caching[pool_caching].orders[order]; in ttm_pool_alloc_caching_mismatch()
280 pt_tt = &pool->caching[tt_caching].orders[order]; in ttm_pool_alloc_caching_mismatch()
285 KUNIT_ASSERT_FALSE(test, list_empty(&pt_pool->pages)); in ttm_pool_alloc_caching_mismatch()
286 KUNIT_ASSERT_TRUE(test, list_empty(&pt_tt->pages)); in ttm_pool_alloc_caching_mismatch()
294 KUNIT_ASSERT_FALSE(test, list_empty(&pt_pool->pages)); in ttm_pool_alloc_caching_mismatch()
295 KUNIT_ASSERT_FALSE(test, list_empty(&pt_tt->pages)); in ttm_pool_alloc_caching_mismatch()
313 pt_pool = &pool->caching[caching].orders[order]; in ttm_pool_alloc_order_mismatch()
314 pt_tt = &pool->caching[caching].orders[0]; in ttm_pool_alloc_order_mismatch()
319 KUNIT_ASSERT_FALSE(test, list_empty(&pt_pool->pages)); in ttm_pool_alloc_order_mismatch()
320 KUNIT_ASSERT_TRUE(test, list_empty(&pt_tt->pages)); in ttm_pool_alloc_order_mismatch()
328 KUNIT_ASSERT_FALSE(test, list_empty(&pt_pool->pages)); in ttm_pool_alloc_order_mismatch()
329 KUNIT_ASSERT_FALSE(test, list_empty(&pt_tt->pages)); in ttm_pool_alloc_order_mismatch()
336 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_free_dma_alloc()
337 struct ttm_test_devices *devs = priv->devs; in ttm_pool_free_dma_alloc() local
351 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, true, false); in ttm_pool_free_dma_alloc()
354 pt = &pool->caching[caching].orders[order]; in ttm_pool_free_dma_alloc()
355 KUNIT_ASSERT_TRUE(test, list_empty(&pt->pages)); in ttm_pool_free_dma_alloc()
360 KUNIT_ASSERT_FALSE(test, list_empty(&pt->pages)); in ttm_pool_free_dma_alloc()
367 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_free_no_dma_alloc()
368 struct ttm_test_devices *devs = priv->devs; in ttm_pool_free_no_dma_alloc() local
382 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, false, false); in ttm_pool_free_no_dma_alloc()
385 pt = &pool->caching[caching].orders[order]; in ttm_pool_free_no_dma_alloc()
386 KUNIT_ASSERT_TRUE(test, list_is_singular(&pt->pages)); in ttm_pool_free_no_dma_alloc()
391 KUNIT_ASSERT_TRUE(test, list_is_singular(&pt->pages)); in ttm_pool_free_no_dma_alloc()
405 pt = &pool->caching[caching].orders[order]; in ttm_pool_fini_basic()
407 KUNIT_ASSERT_FALSE(test, list_empty(&pt->pages)); in ttm_pool_fini_basic()
411 KUNIT_ASSERT_TRUE(test, list_empty(&pt->pages)); in ttm_pool_fini_basic()
437 MODULE_LICENSE("GPL and additional rights");