drivers/gpu/drm/xe/xe_pt_walk.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_pt_walk.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_pt_walk.h- Extension
.h- Size
- 4566 bytes
- Lines
- 153
- 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/pagewalk.hlinux/types.h
Detected Declarations
struct xe_ptwstruct xe_pt_walkstruct xe_pt_walk_opsfunction xe_pt_coversfunction xe_pt_num_entriesfunction xe_pt_offset
Annotated Snippet
struct xe_ptw {
struct xe_ptw **children;
struct xe_ptw **staging;
};
/**
* struct xe_pt_walk - Embeddable struct for walk parameters
*/
struct xe_pt_walk {
/** @ops: The walk ops used for the pagewalk */
const struct xe_pt_walk_ops *ops;
/**
* @shifts: Array of page-table entry shifts used for the
* different levels, starting out with the leaf level 0
* page-shift as the first entry. It's legal for this pointer to be
* changed during the walk.
*/
const u64 *shifts;
/** @max_level: Highest populated level in @shifts */
unsigned int max_level;
/**
* @shared_pt_mode: Whether to skip all entries that are private
* to the address range and called only for entries that are
* shared with other address ranges. Such entries are referred to
* as shared pagetables.
*/
bool shared_pt_mode;
/** @staging: Walk staging PT structure */
bool staging;
};
/**
* typedef xe_pt_entry_fn - gpu page-table-walk callback-function
* @parent: The parent page table.
* @offset: The offset (number of entries) into the page table.
* @level: The level of @parent.
* @addr: The virtual address.
* @next: The virtual address for the next call, or end address.
* @child: Pointer to pointer to child page-table at this @offset. The
* function may modify the value pointed to if, for example, allocating a
* child page table.
* @action: The walk action to take upon return. See <linux/pagewalk.h>.
* @walk: The walk parameters.
*/
typedef int (*xe_pt_entry_fn)(struct xe_ptw *parent, pgoff_t offset,
unsigned int level, u64 addr, u64 next,
struct xe_ptw **child,
enum page_walk_action *action,
struct xe_pt_walk *walk);
/**
* struct xe_pt_walk_ops - Walk callbacks.
*/
struct xe_pt_walk_ops {
/**
* @pt_entry: Callback to be called for each page table entry prior
* to descending to the next level. The returned value of the action
* function parameter is honored.
*/
xe_pt_entry_fn pt_entry;
/**
* @pt_post_descend: Callback to be called for each page table entry
* after return from descending to the next level. The returned value
* of the action function parameter is ignored.
*/
xe_pt_entry_fn pt_post_descend;
};
int xe_pt_walk_range(struct xe_ptw *parent, unsigned int level,
u64 addr, u64 end, struct xe_pt_walk *walk);
int xe_pt_walk_shared(struct xe_ptw *parent, unsigned int level,
u64 addr, u64 end, struct xe_pt_walk *walk);
/**
* xe_pt_covers - Whether the address range covers an entire entry in @level
* @addr: Start of the range.
* @end: End of range + 1.
* @level: Page table level.
* @walk: Page table walk info.
*
* This function is a helper to aid in determining whether a leaf page table
* entry can be inserted at this @level.
*
* Return: Whether the range provided covers exactly an entry at this level.
*/
static inline bool xe_pt_covers(u64 addr, u64 end, unsigned int level,
const struct xe_pt_walk *walk)
{
u64 pt_size = 1ull << walk->shifts[level];
Annotation
- Immediate include surface: `linux/pagewalk.h`, `linux/types.h`.
- Detected declarations: `struct xe_ptw`, `struct xe_pt_walk`, `struct xe_pt_walk_ops`, `function xe_pt_covers`, `function xe_pt_num_entries`, `function xe_pt_offset`.
- 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.