include/drm/ttm/ttm_tt.h
Source file repositories/reference/linux-study-clean/include/drm/ttm/ttm_tt.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/ttm/ttm_tt.h- Extension
.h- Size
- 10435 bytes
- Lines
- 328
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pagemap.hlinux/types.hdrm/ttm/ttm_caching.hdrm/ttm/ttm_kmap_iter.hlinux/agp_backend.h
Detected Declarations
struct ttm_backupstruct ttm_devicestruct ttm_ttstruct ttm_resourcestruct ttm_buffer_objectstruct ttm_operation_ctxstruct ttm_pool_tt_restorestruct ttm_ttstruct ttm_kmap_iter_ttstruct ttm_backup_flagsfunction ttm_tt_is_populatedfunction ttm_tt_is_swappedfunction ttm_tt_is_backed_upfunction ttm_tt_clear_backed_upfunction ttm_tt_mark_for_clear
Annotated Snippet
struct ttm_tt {
/** @pages: Array of pages backing the data. */
struct page **pages;
/**
* @page_flags: The page flags.
*
* Supported values:
*
* TTM_TT_FLAG_SWAPPED: Set by TTM when the pages have been unpopulated
* and swapped out by TTM. Calling ttm_tt_populate() will then swap the
* pages back in, and unset the flag. Drivers should in general never
* need to touch this.
*
* TTM_TT_FLAG_ZERO_ALLOC: Set if the pages will be zeroed on
* allocation.
*
* TTM_TT_FLAG_EXTERNAL: Set if the underlying pages were allocated
* externally, like with dma-buf or userptr. This effectively disables
* TTM swapping out such pages. Also important is to prevent TTM from
* ever directly mapping these pages.
*
* Note that enum ttm_bo_type.ttm_bo_type_sg objects will always enable
* this flag.
*
* TTM_TT_FLAG_EXTERNAL_MAPPABLE: Same behaviour as
* TTM_TT_FLAG_EXTERNAL, but with the reduced restriction that it is
* still valid to use TTM to map the pages directly. This is useful when
* implementing a ttm_tt backend which still allocates driver owned
* pages underneath(say with shmem).
*
* Note that since this also implies TTM_TT_FLAG_EXTERNAL, the usage
* here should always be:
*
* page_flags = TTM_TT_FLAG_EXTERNAL |
* TTM_TT_FLAG_EXTERNAL_MAPPABLE;
*
* TTM_TT_FLAG_DECRYPTED: The mapped ttm pages should be marked as
* not encrypted. The framework will try to match what the dma layer
* is doing, but note that it is a little fragile because ttm page
* fault handling abuses the DMA api a bit and dma_map_attrs can't be
* used to assure pgprot always matches.
*
* TTM_TT_FLAG_BACKED_UP: TTM internal only. This is set if the
* struct ttm_tt has been (possibly partially) backed up.
*
* TTM_TT_FLAG_PRIV_POPULATED: TTM internal only. DO NOT USE. This is
* set by TTM after ttm_tt_populate() has successfully returned, and is
* then unset when TTM calls ttm_tt_unpopulate().
*
*/
#define TTM_TT_FLAG_SWAPPED BIT(0)
#define TTM_TT_FLAG_ZERO_ALLOC BIT(1)
#define TTM_TT_FLAG_EXTERNAL BIT(2)
#define TTM_TT_FLAG_EXTERNAL_MAPPABLE BIT(3)
#define TTM_TT_FLAG_DECRYPTED BIT(4)
#define TTM_TT_FLAG_BACKED_UP BIT(5)
#define TTM_TT_FLAG_PRIV_POPULATED BIT(6)
uint32_t page_flags;
/** @num_pages: Number of pages in the page array. */
uint32_t num_pages;
/** @sg: for SG objects via dma-buf. */
struct sg_table *sg;
/** @dma_address: The DMA (bus) addresses of the pages. */
dma_addr_t *dma_address;
/** @swap_storage: Pointer to shmem struct file for swap storage. */
struct file *swap_storage;
/**
* @backup: Pointer to backup struct for backed up tts.
* Could be unified with @swap_storage. Meanwhile, the driver's
* ttm_tt_create() callback is responsible for assigning
* this field.
*/
struct file *backup;
/**
* @caching: The current caching state of the pages, see enum
* ttm_caching.
*/
enum ttm_caching caching;
/** @restore: Partial restoration from backup state. TTM private */
struct ttm_pool_tt_restore *restore;
};
/**
* struct ttm_kmap_iter_tt - Specialization of a mappig iterator for a tt.
* @base: Embedded struct ttm_kmap_iter providing the usage interface
* @tt: Cached struct ttm_tt.
* @prot: Cached page protection for mapping.
*/
struct ttm_kmap_iter_tt {
Annotation
- Immediate include surface: `linux/pagemap.h`, `linux/types.h`, `drm/ttm/ttm_caching.h`, `drm/ttm/ttm_kmap_iter.h`, `linux/agp_backend.h`.
- Detected declarations: `struct ttm_backup`, `struct ttm_device`, `struct ttm_tt`, `struct ttm_resource`, `struct ttm_buffer_object`, `struct ttm_operation_ctx`, `struct ttm_pool_tt_restore`, `struct ttm_tt`, `struct ttm_kmap_iter_tt`, `struct ttm_backup_flags`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.