drivers/gpu/drm/xe/xe_page_reclaim.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_page_reclaim.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_page_reclaim.h- Extension
.h- Size
- 4050 bytes
- Lines
- 129
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kref.hlinux/mm.hlinux/slab.hlinux/types.hlinux/workqueue.hlinux/bits.h
Detected Declarations
struct xe_tlb_invalstruct xe_tlb_inval_fencestruct xe_tilestruct xe_gtstruct xe_gucstruct xe_vmastruct xe_guc_page_reclaim_entrystruct xe_page_reclaim_listfunction xe_page_reclaim_list_is_newfunction xe_page_reclaim_list_validfunction xe_page_reclaim_entries_getfunction xe_page_reclaim_entries_put
Annotated Snippet
struct xe_guc_page_reclaim_entry {
u64 qw;
/* valid reclaim entry bit */
#define XE_PAGE_RECLAIM_VALID BIT_ULL(0)
/*
* offset order of page size to be reclaimed
* page_size = 1 << (XE_PTE_SHIFT + reclamation_size)
*/
#define XE_PAGE_RECLAIM_SIZE GENMASK_ULL(6, 1)
#define XE_PAGE_RECLAIM_RSVD_0 GENMASK_ULL(11, 7)
/* lower 20 bits of the physical address */
#define XE_PAGE_RECLAIM_ADDR_LO GENMASK_ULL(31, 12)
/* upper 20 bits of the physical address */
#define XE_PAGE_RECLAIM_ADDR_HI GENMASK_ULL(51, 32)
#define XE_PAGE_RECLAIM_RSVD_1 GENMASK_ULL(63, 52)
} __packed;
struct xe_page_reclaim_list {
/** @entries: array of page reclaim entries, page allocated */
struct xe_guc_page_reclaim_entry *entries;
/** @num_entries: number of entries */
int num_entries;
#define XE_PAGE_RECLAIM_INVALID_LIST -1
};
/**
* xe_page_reclaim_list_is_new() - Check if PRL is new allocation
* @prl: Pointer to page reclaim list
*
* PRL indicates it hasn't been allocated through both values being NULL
*/
static inline bool xe_page_reclaim_list_is_new(struct xe_page_reclaim_list *prl)
{
return !prl->entries && prl->num_entries == 0;
}
/**
* xe_page_reclaim_list_valid() - Check if the page reclaim list is valid
* @prl: Pointer to page reclaim list
*
* PRL uses the XE_PAGE_RECLAIM_INVALID_LIST to indicate that a PRL
* is unusable.
*/
static inline bool xe_page_reclaim_list_valid(struct xe_page_reclaim_list *prl)
{
return !xe_page_reclaim_list_is_new(prl) &&
prl->num_entries != XE_PAGE_RECLAIM_INVALID_LIST;
}
bool xe_page_reclaim_skip(struct xe_tile *tile, struct xe_vma *vma);
struct drm_suballoc *xe_page_reclaim_create_prl_bo(struct xe_tlb_inval *tlb_inval,
struct xe_page_reclaim_list *prl,
struct xe_tlb_inval_fence *fence);
void xe_page_reclaim_list_invalidate(struct xe_page_reclaim_list *prl);
/**
* xe_page_reclaim_list_abort() - Invalidate a PRL and log an abort reason
* @gt: GT owning the page reclaim request
* @prl: Page reclaim list to invalidate
* @fmt: format string for the log message with args
*
* Abort page reclaim process by invalidating PRL and doing any relevant logging.
*/
#define xe_page_reclaim_list_abort(gt, prl, fmt, ...) \
do { \
struct xe_gt *__gt = (gt); \
struct xe_page_reclaim_list *__prl = (prl); \
\
xe_page_reclaim_list_invalidate(__prl); \
xe_gt_stats_incr(__gt, XE_GT_STATS_ID_PRL_ABORTED_COUNT, 1); \
vm_dbg(>_to_xe(__gt)->drm, "PRL aborted: " fmt, ##__VA_ARGS__); \
} while (0)
void xe_page_reclaim_list_init(struct xe_page_reclaim_list *prl);
int xe_page_reclaim_list_alloc_entries(struct xe_page_reclaim_list *prl);
/**
* xe_page_reclaim_entries_get() - Increment the reference count of page reclaim entries.
* @entries: Pointer to the array of page reclaim entries.
*
* This function increments the reference count of the backing page.
*/
static inline void xe_page_reclaim_entries_get(struct xe_guc_page_reclaim_entry *entries)
{
if (entries)
get_page(virt_to_page(entries));
}
/**
* xe_page_reclaim_entries_put() - Decrement the reference count of page reclaim entries.
* @entries: Pointer to the array of page reclaim entries.
Annotation
- Immediate include surface: `linux/kref.h`, `linux/mm.h`, `linux/slab.h`, `linux/types.h`, `linux/workqueue.h`, `linux/bits.h`.
- Detected declarations: `struct xe_tlb_inval`, `struct xe_tlb_inval_fence`, `struct xe_tile`, `struct xe_gt`, `struct xe_guc`, `struct xe_vma`, `struct xe_guc_page_reclaim_entry`, `struct xe_page_reclaim_list`, `function xe_page_reclaim_list_is_new`, `function xe_page_reclaim_list_valid`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.