drivers/gpu/drm/xe/display/xe_stolen.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/display/xe_stolen.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/display/xe_stolen.c- Extension
.c- Size
- 2520 bytes
- Lines
- 114
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/intel/display_parent_interface.hxe_res_cursor.hxe_stolen.hxe_ttm_stolen_mgr.hxe_validation.h
Detected Declarations
struct intel_stolen_nodefunction xe_stolen_insert_node_in_rangefunction xe_stolen_remove_nodefunction xe_stolen_initializedfunction xe_stolen_node_allocatedfunction xe_stolen_node_offsetfunction xe_stolen_node_addressfunction xe_stolen_node_sizefunction xe_stolen_node_free
Annotated Snippet
struct intel_stolen_node {
struct xe_device *xe;
struct xe_bo *bo;
};
static int xe_stolen_insert_node_in_range(struct intel_stolen_node *node, u64 size,
unsigned int align, u64 start, u64 end)
{
struct xe_device *xe = node->xe;
struct xe_bo *bo;
int err = 0;
u32 flags = XE_BO_FLAG_PINNED | XE_BO_FLAG_STOLEN;
if (start < SZ_4K)
start = SZ_4K;
if (align) {
size = ALIGN(size, align);
start = ALIGN(start, align);
}
bo = xe_bo_create_pin_range_novm(xe, xe_device_get_root_tile(xe),
size, start, end, ttm_bo_type_kernel, flags);
if (IS_ERR(bo)) {
err = PTR_ERR(bo);
bo = NULL;
return err;
}
node->bo = bo;
return err;
}
static void xe_stolen_remove_node(struct intel_stolen_node *node)
{
xe_bo_unpin_map_no_vm(node->bo);
node->bo = NULL;
}
static bool xe_stolen_initialized(struct drm_device *drm)
{
struct xe_device *xe = to_xe_device(drm);
return ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
}
static bool xe_stolen_node_allocated(const struct intel_stolen_node *node)
{
return node->bo;
}
static u64 xe_stolen_node_offset(const struct intel_stolen_node *node)
{
struct xe_res_cursor res;
xe_res_first(node->bo->ttm.resource, 0, 4096, &res);
return res.start;
}
static u64 xe_stolen_node_address(const struct intel_stolen_node *node)
{
struct xe_device *xe = node->xe;
return xe_ttm_stolen_gpu_offset(xe) + xe_stolen_node_offset(node);
}
static u64 xe_stolen_node_size(const struct intel_stolen_node *node)
{
return xe_bo_size(node->bo);
}
static struct intel_stolen_node *xe_stolen_node_alloc(struct drm_device *drm)
{
struct xe_device *xe = to_xe_device(drm);
struct intel_stolen_node *node;
node = kzalloc_obj(*node);
if (!node)
return NULL;
node->xe = xe;
return node;
}
static void xe_stolen_node_free(const struct intel_stolen_node *node)
{
kfree(node);
Annotation
- Immediate include surface: `drm/intel/display_parent_interface.h`, `xe_res_cursor.h`, `xe_stolen.h`, `xe_ttm_stolen_mgr.h`, `xe_validation.h`.
- Detected declarations: `struct intel_stolen_node`, `function xe_stolen_insert_node_in_range`, `function xe_stolen_remove_node`, `function xe_stolen_initialized`, `function xe_stolen_node_allocated`, `function xe_stolen_node_offset`, `function xe_stolen_node_address`, `function xe_stolen_node_size`, `function xe_stolen_node_free`.
- 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.