Add tests for ttm_bo_validate that focus on BO eviction and swapout. Update device funcs definition with eviction-related callbacks. Add alternative funcs where evict_flags() routes eviction to a domain that can't allocate resources (dubbed "busy manager" in the tests). Extract the common path of ttm_device init into a function. Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com> Reviewed-by: Somalapuram, Amaranath <asomalap@amd.com> Tested-by: Somalapuram, Amaranath <asomalap@amd.com> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/ae8e284d6c7e6bd0be259052bd4f42e07ce24641.1718192625.git.karolina.stolarek@intel.com
30 lines
853 B
C
30 lines
853 B
C
/* SPDX-License-Identifier: GPL-2.0 AND MIT */
|
|
/*
|
|
* Copyright © 2023 Intel Corporation
|
|
*/
|
|
#ifndef TTM_MOCK_MANAGER_H
|
|
#define TTM_MOCK_MANAGER_H
|
|
|
|
#include <drm/drm_buddy.h>
|
|
|
|
struct ttm_mock_manager {
|
|
struct ttm_resource_manager man;
|
|
struct drm_buddy mm;
|
|
u64 default_page_size;
|
|
/* protects allocations of mock buffer objects */
|
|
struct mutex lock;
|
|
};
|
|
|
|
struct ttm_mock_resource {
|
|
struct ttm_resource base;
|
|
struct list_head blocks;
|
|
unsigned long flags;
|
|
};
|
|
|
|
int ttm_mock_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
|
|
int ttm_bad_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
|
|
int ttm_busy_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
|
|
void ttm_mock_manager_fini(struct ttm_device *bdev, u32 mem_type);
|
|
void ttm_bad_manager_fini(struct ttm_device *bdev, u32 mem_type);
|
|
|
|
#endif // TTM_MOCK_MANAGER_H
|