drm/ttm/tests: Add tests for ttm_tt

Test initialization, creation and destruction of ttm_tt instances.
Export ttm_tt_destroy and ttm_tt_create symbols for testing purposes.

Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Amaranath Somalapuram <Amaranath.Somalapuram@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4459cb89c666bfa377753ae18d0c8917131638e8.1701257386.git.karolina.stolarek@intel.com
Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
Karolina Stolarek
2023-11-29 13:02:28 +01:00
committed by Christian König
parent 9afc1e0aa4
commit e6f7c641fa
4 changed files with 319 additions and 0 deletions

View File

@@ -2,9 +2,29 @@
/*
* Copyright © 2023 Intel Corporation
*/
#include <drm/ttm/ttm_tt.h>
#include "ttm_kunit_helpers.h"
static struct ttm_tt *ttm_tt_simple_create(struct ttm_buffer_object *bo,
uint32_t page_flags)
{
struct ttm_tt *tt;
tt = kzalloc(sizeof(*tt), GFP_KERNEL);
ttm_tt_init(tt, bo, page_flags, ttm_cached, 0);
return tt;
}
static void ttm_tt_simple_destroy(struct ttm_device *bdev, struct ttm_tt *ttm)
{
kfree(ttm);
}
struct ttm_device_funcs ttm_dev_funcs = {
.ttm_tt_create = ttm_tt_simple_create,
.ttm_tt_destroy = ttm_tt_simple_destroy,
};
EXPORT_SYMBOL_GPL(ttm_dev_funcs);