drivers/gpu/drm/xe/xe_pm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_pm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_pm.c- Extension
.c- Size
- 28217 bytes
- Lines
- 1036
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xe_pm.hlinux/fault-inject.hlinux/pm_runtime.hlinux/suspend.hlinux/dmi.hdrm/drm_managed.hdrm/ttm/ttm_placement.hdisplay/xe_display.hxe_bo.hxe_bo_evict.hxe_device.hxe_ggtt.hxe_gt.hxe_gt_idle.hxe_i2c.hxe_irq.hxe_late_bind_fw.hxe_pcode.hxe_printk.hxe_pxp.hxe_sriov_vf_ccs.hxe_sysctrl.hxe_trace.hxe_vm.hxe_wa.h
Detected Declarations
function xe_pm_block_begin_signallingfunction xe_pm_block_end_signallingfunction xe_pm_might_block_on_suspendfunction xe_pm_block_on_suspendfunction xe_rpm_reclaim_safefunction xe_rpm_lockmap_acquirefunction xe_rpm_lockmap_releasefunction xe_pm_suspendfunction for_each_gtfunction xe_pm_resumefunction for_each_gtfunction xe_pm_pci_d3cold_capablefunction xe_pm_runtime_initfunction xe_pm_init_earlyfunction xe_pm_probefunction vram_threshold_valuefunction xe_pm_wake_rebind_workersfunction xe_pm_notifier_callbackfunction xe_pm_initfunction xe_pm_runtime_finifunction xe_pm_finifunction xe_pm_write_callback_taskfunction xe_pm_runtime_suspendedfunction xe_pm_runtime_suspendfunction for_each_gtfunction xe_pm_runtime_resumefunction for_each_gtfunction lockfunction xe_pm_runtime_lockdep_primefunction scopefunction xe_pm_runtime_putfunction ACQUIREfunction xe_pm_runtime_get_if_activefunction xe_pm_runtime_get_if_in_usefunction xe_pm_suspending_or_resumingfunction scopefunction xe_pm_runtime_resume_and_getfunction xe_pm_assert_unbounded_bridgefunction xe_pm_set_vram_thresholdfunction xe_pm_d3cold_allowed_togglefunction xe_pm_module_init
Annotated Snippet
if (product_name && strstr(product_name, "NUC13RNG")) {
drm_warn(&xe->drm, "BMG + D3Cold not supported on this platform\n");
return 0;
}
}
return DEFAULT_VRAM_THRESHOLD;
}
static void xe_pm_wake_rebind_workers(struct xe_device *xe)
{
struct xe_vm *vm, *next;
mutex_lock(&xe->rebind_resume_lock);
list_for_each_entry_safe(vm, next, &xe->rebind_resume_list,
preempt.pm_activate_link) {
list_del_init(&vm->preempt.pm_activate_link);
xe_vm_resume_rebind_worker(vm);
}
mutex_unlock(&xe->rebind_resume_lock);
}
static int xe_pm_notifier_callback(struct notifier_block *nb,
unsigned long action, void *data)
{
struct xe_device *xe = container_of(nb, struct xe_device, pm_notifier);
int err = 0;
switch (action) {
case PM_HIBERNATION_PREPARE:
case PM_SUSPEND_PREPARE:
{
struct xe_validation_ctx ctx;
reinit_completion(&xe->pm_block);
xe_pm_block_begin_signalling();
xe_pm_runtime_get(xe);
(void)xe_validation_ctx_init(&ctx, &xe->val, NULL,
(struct xe_val_flags) {.exclusive = true});
err = xe_bo_evict_all_user(xe);
xe_validation_ctx_fini(&ctx);
if (err)
drm_dbg(&xe->drm, "Notifier evict user failed (%d)\n", err);
err = xe_bo_notifier_prepare_all_pinned(xe);
if (err)
drm_dbg(&xe->drm, "Notifier prepare pin failed (%d)\n", err);
/*
* Keep the runtime pm reference until post hibernation / post suspend to
* avoid a runtime suspend interfering with evicted objects or backup
* allocations.
*/
xe_pm_block_end_signalling();
break;
}
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
complete_all(&xe->pm_block);
xe_pm_wake_rebind_workers(xe);
xe_bo_notifier_unprepare_all_pinned(xe);
xe_pm_runtime_put(xe);
break;
}
return NOTIFY_DONE;
}
/**
* xe_pm_init - Initialize Xe Power Management
* @xe: xe device instance
*
* This component is responsible for System and Device sleep states.
*
* Returns 0 for success, negative error code otherwise.
*/
int xe_pm_init(struct xe_device *xe)
{
u32 vram_threshold;
int err;
xe->pm_notifier.notifier_call = xe_pm_notifier_callback;
err = register_pm_notifier(&xe->pm_notifier);
if (err)
return err;
/* For now suspend/resume is only allowed with GuC */
if (!xe_device_uc_enabled(xe))
return 0;
if (xe->d3cold.capable) {
Annotation
- Immediate include surface: `xe_pm.h`, `linux/fault-inject.h`, `linux/pm_runtime.h`, `linux/suspend.h`, `linux/dmi.h`, `drm/drm_managed.h`, `drm/ttm/ttm_placement.h`, `display/xe_display.h`.
- Detected declarations: `function xe_pm_block_begin_signalling`, `function xe_pm_block_end_signalling`, `function xe_pm_might_block_on_suspend`, `function xe_pm_block_on_suspend`, `function xe_rpm_reclaim_safe`, `function xe_rpm_lockmap_acquire`, `function xe_rpm_lockmap_release`, `function xe_pm_suspend`, `function for_each_gt`, `function xe_pm_resume`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.