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

1 // SPDX-License-Identifier: GPL-2.0 AND MIT
20 .description = "Page-aligned size",
33 strscpy(desc, t->description, KUNIT_PARAM_DESC_SIZE); in ttm_tt_init_case_desc()
41 const struct ttm_tt_test_case *params = test->param_value; in ttm_tt_init_basic()
46 u32 extra_pages = params->extra_pages_num; in ttm_tt_init_basic()
47 int num_pages = params->size >> PAGE_SHIFT; in ttm_tt_init_basic()
53 bo = ttm_bo_kunit_init(test, test->priv, params->size, NULL); in ttm_tt_init_basic()
58 KUNIT_ASSERT_EQ(test, tt->num_pages, num_pages + extra_pages); in ttm_tt_init_basic()
60 KUNIT_ASSERT_EQ(test, tt->page_flags, page_flags); in ttm_tt_init_basic()
61 KUNIT_ASSERT_EQ(test, tt->caching, caching); in ttm_tt_init_basic()
63 KUNIT_ASSERT_NULL(test, tt->dma_address); in ttm_tt_init_basic()
64 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_init_basic()
79 bo = ttm_bo_kunit_init(test, test->priv, size, NULL); in ttm_tt_init_misaligned()
82 bo->base.size += 1; in ttm_tt_init_misaligned()
87 KUNIT_ASSERT_EQ(test, tt->num_pages, num_pages); in ttm_tt_init_misaligned()
100 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_basic()
104 KUNIT_ASSERT_NOT_NULL(test, tt->pages); in ttm_tt_fini_basic()
107 KUNIT_ASSERT_NULL(test, tt->pages); in ttm_tt_fini_basic()
120 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_sg()
124 KUNIT_ASSERT_NOT_NULL(test, tt->dma_address); in ttm_tt_fini_sg()
127 KUNIT_ASSERT_NULL(test, tt->dma_address); in ttm_tt_fini_sg()
141 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_shmem()
147 tt->swap_storage = shmem; in ttm_tt_fini_shmem()
150 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_fini_shmem()
158 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_basic()
159 bo->type = ttm_bo_type_device; in ttm_tt_create_basic()
161 dma_resv_lock(bo->base.resv, NULL); in ttm_tt_create_basic()
163 dma_resv_unlock(bo->base.resv); in ttm_tt_create_basic()
166 KUNIT_EXPECT_NOT_NULL(test, bo->ttm); in ttm_tt_create_basic()
169 kfree(bo->ttm); in ttm_tt_create_basic()
177 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_invalid_bo_type()
178 bo->type = ttm_bo_type_sg + 1; in ttm_tt_create_invalid_bo_type()
180 dma_resv_lock(bo->base.resv, NULL); in ttm_tt_create_invalid_bo_type()
182 dma_resv_unlock(bo->base.resv); in ttm_tt_create_invalid_bo_type()
184 KUNIT_EXPECT_EQ(test, err, -EINVAL); in ttm_tt_create_invalid_bo_type()
185 KUNIT_EXPECT_NULL(test, bo->ttm); in ttm_tt_create_invalid_bo_type()
198 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_ttm_exists()
202 bo->ttm = tt; in ttm_tt_create_ttm_exists()
204 dma_resv_lock(bo->base.resv, NULL); in ttm_tt_create_ttm_exists()
206 dma_resv_unlock(bo->base.resv); in ttm_tt_create_ttm_exists()
210 KUNIT_ASSERT_PTR_EQ(test, tt, bo->ttm); in ttm_tt_create_ttm_exists()
225 const struct ttm_test_devices *devs = test->priv; in ttm_tt_create_failed() local
229 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_failed()
232 devs->ttm_dev->funcs = &ttm_dev_empty_funcs; in ttm_tt_create_failed()
234 dma_resv_lock(bo->base.resv, NULL); in ttm_tt_create_failed()
236 dma_resv_unlock(bo->base.resv); in ttm_tt_create_failed()
238 KUNIT_ASSERT_EQ(test, err, -ENOMEM); in ttm_tt_create_failed()
243 const struct ttm_test_devices *devs = test->priv; in ttm_tt_destroy_basic() local
247 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_destroy_basic()
249 dma_resv_lock(bo->base.resv, NULL); in ttm_tt_destroy_basic()
251 dma_resv_unlock(bo->base.resv); in ttm_tt_destroy_basic()
254 KUNIT_ASSERT_NOT_NULL(test, bo->ttm); in ttm_tt_destroy_basic()
256 ttm_tt_destroy(devs->ttm_dev, bo->ttm); in ttm_tt_destroy_basic()
261 const struct ttm_test_devices *devs = test->priv; in ttm_tt_populate_null_ttm() local
265 err = ttm_tt_populate(devs->ttm_dev, NULL, &ctx); in ttm_tt_populate_null_ttm()
266 KUNIT_ASSERT_EQ(test, err, -EINVAL); in ttm_tt_populate_null_ttm()
271 const struct ttm_test_devices *devs = test->priv; in ttm_tt_populate_populated_ttm() local
278 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_populate_populated_ttm()
286 err = ttm_tt_populate(devs->ttm_dev, tt, &ctx); in ttm_tt_populate_populated_ttm()
288 populated_page = *tt->pages; in ttm_tt_populate_populated_ttm()
290 err = ttm_tt_populate(devs->ttm_dev, tt, &ctx); in ttm_tt_populate_populated_ttm()
291 KUNIT_ASSERT_PTR_EQ(test, populated_page, *tt->pages); in ttm_tt_populate_populated_ttm()
296 const struct ttm_test_devices *devs = test->priv; in ttm_tt_unpopulate_basic() local
302 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_unpopulate_basic()
310 err = ttm_tt_populate(devs->ttm_dev, tt, &ctx); in ttm_tt_unpopulate_basic()
314 ttm_tt_unpopulate(devs->ttm_dev, tt); in ttm_tt_unpopulate_basic()
320 const struct ttm_test_devices *devs = test->priv; in ttm_tt_unpopulate_empty_ttm() local
325 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_unpopulate_empty_ttm()
333 ttm_tt_unpopulate(devs->ttm_dev, tt); in ttm_tt_unpopulate_empty_ttm()
339 const struct ttm_test_devices *devs = test->priv; in ttm_tt_swapin_basic() local
346 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_swapin_basic()
354 err = ttm_tt_populate(devs->ttm_dev, tt, &ctx); in ttm_tt_swapin_basic()
358 num_pages = ttm_tt_swapout(devs->ttm_dev, tt, GFP_KERNEL); in ttm_tt_swapin_basic()
360 KUNIT_ASSERT_NOT_NULL(test, tt->swap_storage); in ttm_tt_swapin_basic()
361 KUNIT_ASSERT_TRUE(test, tt->page_flags & TTM_TT_FLAG_SWAPPED); in ttm_tt_swapin_basic()
364 err = ttm_pool_alloc(&devs->ttm_dev->pool, tt, &ctx); in ttm_tt_swapin_basic()
369 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_swapin_basic()
370 KUNIT_ASSERT_FALSE(test, tt->page_flags & TTM_TT_FLAG_SWAPPED); in ttm_tt_swapin_basic()
402 MODULE_LICENSE("GPL and additional rights");