xref: /linux/drivers/gpu/drm/ttm/tests/ttm_mock_manager.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0 AND MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 #ifndef TTM_MOCK_MANAGER_H
6 #define TTM_MOCK_MANAGER_H
7 
8 #include <drm/drm_buddy.h>
9 
10 struct ttm_mock_manager {
11 	struct ttm_resource_manager man;
12 	struct drm_buddy mm;
13 	u64 default_page_size;
14 	/* protects allocations of mock buffer objects */
15 	struct mutex lock;
16 };
17 
18 struct ttm_mock_resource {
19 	struct ttm_resource base;
20 	struct list_head blocks;
21 	unsigned long flags;
22 };
23 
24 int ttm_mock_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
25 int ttm_bad_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
26 int ttm_busy_manager_init(struct ttm_device *bdev, u32 mem_type, u32 size);
27 void ttm_mock_manager_fini(struct ttm_device *bdev, u32 mem_type);
28 void ttm_bad_manager_fini(struct ttm_device *bdev, u32 mem_type);
29 
30 #endif // TTM_MOCK_MANAGER_H
31