drivers/gpu/drm/xe/xe_pxp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_pxp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_pxp.c- Extension
.c- Size
- 25049 bytes
- Lines
- 945
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
xe_pxp.hdrm/drm_managed.huapi/drm/xe_drm.hxe_bo.hxe_bo_types.hxe_device_types.hxe_exec_queue.hxe_force_wake.hxe_guc_exec_queue_types.hxe_guc_submit.hxe_gsc_proxy.hxe_gt_types.hxe_huc.hxe_hw_engine.hxe_mmio.hxe_pm.hxe_pxp_submit.hxe_pxp_types.hxe_uc_fw.hregs/xe_irq_regs.hregs/xe_pxp_regs.h
Detected Declarations
function Copyrightfunction xe_pxp_is_enabledfunction pxp_prerequisites_donefunction uapifunction pxp_session_is_in_playfunction pxp_wait_for_session_statefunction pxp_terminate_hwfunction mark_termination_in_progressfunction pxp_terminatefunction pxp_terminate_completefunction pxp_irq_workfunction xe_pxp_irq_handlerfunction kcr_pxp_set_statusfunction kcr_pxp_enablefunction kcr_pxp_disablefunction pxp_finifunction supportfunction __pxp_start_arb_sessionfunction xe_pxp_exec_queue_set_typefunction __exec_queue_addfunction pxp_startfunction sessionfunction __pxp_exec_queue_removefunction xe_pxp_exec_queue_removefunction pxp_invalidate_queuesfunction list_for_each_entry_safefunction list_for_each_entry_safefunction xe_pxp_key_assignfunction xe_pxp_bo_key_checkfunction xe_pxp_obj_key_checkfunction xe_pxp_pm_suspendfunction xe_pxp_pm_resume
Annotated Snippet
if (ret) {
drm_err(&pxp->xe->drm, "PXP termination failed before start\n");
mutex_lock(&pxp->mutex);
pxp->status = XE_PXP_ERROR;
complete_all(&pxp->termination);
goto out_unlock;
}
goto wait_for_idle;
}
/* All the cases except for start should have exited earlier */
XE_WARN_ON(completion_done(&pxp->activation));
ret = __pxp_start_arb_session(pxp);
mutex_lock(&pxp->mutex);
complete_all(&pxp->activation);
/*
* Any other process should wait until the state goes away from
* XE_PXP_START_IN_PROGRESS, so if the state is not that something went
* wrong. Mark the status as needing termination and try again.
*/
if (pxp->status != XE_PXP_START_IN_PROGRESS) {
drm_err(&pxp->xe->drm, "unexpected state after PXP start: %u\n", pxp->status);
pxp->status = XE_PXP_NEEDS_TERMINATION;
restart = true;
goto out_unlock;
}
/* If everything went ok, update the status and add the queue to the list */
if (!ret)
pxp->status = XE_PXP_ACTIVE;
else
pxp->status = XE_PXP_ERROR;
out_unlock:
mutex_unlock(&pxp->mutex);
if (restart)
goto wait_for_idle;
return ret;
}
/**
* xe_pxp_exec_queue_add - add a queue to the PXP list
* @pxp: the xe->pxp pointer (it will be NULL if PXP is disabled)
* @q: the queue to add to the list
*
* If PXP is enabled and the prerequisites are done, start the PXP default
* session (if not already running) and add the queue to the PXP list.
*
* Returns 0 if the PXP session is running and the queue is in the list,
* -ENODEV if PXP is disabled, -EBUSY if the PXP prerequisites are not done,
* other errno value if something goes wrong during the session start.
*/
int xe_pxp_exec_queue_add(struct xe_pxp *pxp, struct xe_exec_queue *q)
{
int ret;
if (!xe_pxp_is_enabled(pxp))
return -ENODEV;
/*
* Runtime suspend kills PXP, so we take a reference to prevent it from
* happening while we have active queues that use PXP
*/
xe_pm_runtime_get(pxp->xe);
start:
ret = pxp_start(pxp, q->pxp.type);
if (!ret) {
ret = __exec_queue_add(pxp, q);
if (ret == -EBUSY)
goto start;
}
/*
* in the successful case the PM ref is released from
* xe_pxp_exec_queue_remove
*/
if (ret)
xe_pm_runtime_put(pxp->xe);
return ret;
}
Annotation
- Immediate include surface: `xe_pxp.h`, `drm/drm_managed.h`, `uapi/drm/xe_drm.h`, `xe_bo.h`, `xe_bo_types.h`, `xe_device_types.h`, `xe_exec_queue.h`, `xe_force_wake.h`.
- Detected declarations: `function Copyright`, `function xe_pxp_is_enabled`, `function pxp_prerequisites_done`, `function uapi`, `function pxp_session_is_in_play`, `function pxp_wait_for_session_state`, `function pxp_terminate_hw`, `function mark_termination_in_progress`, `function pxp_terminate`, `function pxp_terminate_complete`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source 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.