include/drm/ttm/ttm_bo.h
Source file repositories/reference/linux-study-clean/include/drm/ttm/ttm_bo.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/ttm/ttm_bo.h- Extension
.h- Size
- 19048 bytes
- Lines
- 557
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_gem.hlinux/kref.hlinux/list.httm_device.h
Detected Declarations
struct iosys_mapstruct ttm_globalstruct ttm_devicestruct ttm_placementstruct ttm_placestruct ttm_resourcestruct ttm_resource_managerstruct ttm_ttstruct ttm_buffer_objectstruct ttm_bo_kmap_objstruct ttm_operation_ctxstruct ttm_lru_walkstruct ttm_lru_walk_opsstruct ttm_lru_walk_argstruct ttm_lru_walkstruct ttm_bo_shrink_flagsstruct ttm_bo_lru_cursorenum ttm_bo_typefunction ttm_bo_reservefunction ttm_bo_reserve_slowpathfunction ttm_bo_move_to_lru_tail_unlockedfunction ttm_bo_assign_memfunction ttm_bo_move_nullfunction ttm_bo_unreservefunction iowriteXXfunction autocleanupfunction class_ttm_bo_lru_cursor_lock_ptr
Annotated Snippet
struct ttm_buffer_object {
struct drm_gem_object base;
/*
* Members constant at init.
*/
struct ttm_device *bdev;
enum ttm_bo_type type;
uint32_t page_alignment;
void (*destroy) (struct ttm_buffer_object *);
/*
* Members not needing protection.
*/
struct kref kref;
/*
* Members protected by the bo::resv::reserved lock.
*/
struct ttm_resource *resource;
struct ttm_tt *ttm;
bool deleted;
struct ttm_lru_bulk_move *bulk_move;
unsigned priority;
unsigned pin_count;
/**
* @delayed_delete: Work item used when we can't delete the BO
* immediately
*/
struct work_struct delayed_delete;
/**
* @sg: external source of pages and DMA addresses, protected by the
* reservation lock.
*/
struct sg_table *sg;
};
#define TTM_BO_MAP_IOMEM_MASK 0x80
/**
* struct ttm_bo_kmap_obj
*
* @virtual: The current kernel virtual address.
* @page: The page when kmap'ing a single page.
* @bo_kmap_type: Type of bo_kmap.
* @bo: The TTM BO.
*
* Object describing a kernel mapping. Since a TTM bo may be located
* in various memory types with various caching policies, the
* mapping can either be an ioremap, a vmap, a kmap or part of a
* premapped region.
*/
struct ttm_bo_kmap_obj {
void *virtual;
struct page *page;
enum {
ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK,
ttm_bo_map_vmap = 2,
ttm_bo_map_kmap = 3,
ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK,
} bo_kmap_type;
struct ttm_buffer_object *bo;
};
/**
* struct ttm_operation_ctx
*
* Context for TTM operations like changing buffer placement or general memory
* allocation.
*/
struct ttm_operation_ctx {
/** @interruptible: Sleep interruptible if sleeping. */
bool interruptible;
/** @no_wait_gpu: Return immediately if the GPU is busy. */
bool no_wait_gpu;
/**
* @gfp_retry_mayfail: Use __GFP_RETRY_MAYFAIL | __GFP_NOWARN
* when allocation pages. This is to avoid invoking the OOM
* killer when populating a buffer object, in order to
* forward the error for it to be dealt with.
*/
bool gfp_retry_mayfail;
/**
* @allow_res_evict: Allow eviction of reserved BOs. Can be used
* when multiple BOs share the same reservation object @resv.
*/
bool allow_res_evict;
/**
Annotation
- Immediate include surface: `drm/drm_gem.h`, `linux/kref.h`, `linux/list.h`, `ttm_device.h`.
- Detected declarations: `struct iosys_map`, `struct ttm_global`, `struct ttm_device`, `struct ttm_placement`, `struct ttm_place`, `struct ttm_resource`, `struct ttm_resource_manager`, `struct ttm_tt`, `struct ttm_buffer_object`, `struct ttm_bo_kmap_obj`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.