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.

Dependency Surface

Detected Declarations

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

Implementation Notes