xref: /linux/drivers/gpu/drm/ttm/ttm_pool_internal.h (revision c27e360545373b7aee9862a5beef3b9fb3df0c25)
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /* Copyright (c) 2025 Valve Corporation */
3 
4 #ifndef _TTM_POOL_INTERNAL_H_
5 #define _TTM_POOL_INTERNAL_H_
6 
7 #include <drm/ttm/ttm_allocation.h>
8 #include <drm/ttm/ttm_pool.h>
9 
10 static inline bool ttm_pool_uses_dma_alloc(struct ttm_pool *pool)
11 {
12 	return pool->alloc_flags & TTM_ALLOCATION_POOL_USE_DMA_ALLOC;
13 }
14 
15 static inline bool ttm_pool_uses_dma32(struct ttm_pool *pool)
16 {
17 	return pool->alloc_flags & TTM_ALLOCATION_POOL_USE_DMA32;
18 }
19 
20 static inline unsigned int ttm_pool_beneficial_order(struct ttm_pool *pool)
21 {
22 	return pool->alloc_flags & 0xff;
23 }
24 
25 /*
26  * Implemented in ttm_pool.c, used by ttm_backup.c. Returns true if a fault
27  * should be injected mid-compound to test the reactive split-and-retry
28  * fallback in ttm_pool_backup(). Always returns false when
29  * CONFIG_FAULT_INJECTION is disabled.
30  */
31 bool ttm_backup_fault_inject_folio(void);
32 
33 #endif
34