drivers/gpu/drm/i915/pxp/intel_pxp_session.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/pxp/intel_pxp_session.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/pxp/intel_pxp_session.c- Extension
.c- Size
- 4858 bytes
- Lines
- 193
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_print.hi915_drv.hintel_pxp.hintel_pxp_cmd.hintel_pxp_gsccs.hintel_pxp_session.hintel_pxp_tee.hintel_pxp_types.hintel_pxp_regs.h
Detected Declarations
function Copyrightfunction pxp_wait_for_session_statefunction pxp_create_arb_sessionfunction pxp_terminate_arb_session_and_globalfunction intel_pxp_terminatefunction pxp_terminate_completefunction pxp_session_workfunction intel_pxp_session_management_init
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright(c) 2020, Intel Corporation. All rights reserved.
*/
#include <drm/drm_print.h>
#include "i915_drv.h"
#include "intel_pxp.h"
#include "intel_pxp_cmd.h"
#include "intel_pxp_gsccs.h"
#include "intel_pxp_session.h"
#include "intel_pxp_tee.h"
#include "intel_pxp_types.h"
#include "intel_pxp_regs.h"
#define ARB_SESSION I915_PROTECTED_CONTENT_DEFAULT_SESSION /* shorter define */
static bool intel_pxp_session_is_in_play(struct intel_pxp *pxp, u32 id)
{
struct intel_uncore *uncore = pxp->ctrl_gt->uncore;
intel_wakeref_t wakeref;
u32 sip = 0;
/* if we're suspended the session is considered off */
with_intel_runtime_pm_if_in_use(uncore->rpm, wakeref)
sip = intel_uncore_read(uncore, KCR_SIP(pxp->kcr_base));
return sip & BIT(id);
}
static int pxp_wait_for_session_state(struct intel_pxp *pxp, u32 id, bool in_play)
{
struct intel_uncore *uncore = pxp->ctrl_gt->uncore;
intel_wakeref_t wakeref;
u32 mask = BIT(id);
int ret;
/* if we're suspended the session is considered off */
wakeref = intel_runtime_pm_get_if_in_use(uncore->rpm);
if (!wakeref)
return in_play ? -ENODEV : 0;
ret = intel_wait_for_register(uncore,
KCR_SIP(pxp->kcr_base),
mask,
in_play ? mask : 0,
250);
intel_runtime_pm_put(uncore->rpm, wakeref);
return ret;
}
static int pxp_create_arb_session(struct intel_pxp *pxp)
{
struct intel_gt *gt = pxp->ctrl_gt;
int ret;
pxp->arb_is_valid = false;
if (intel_pxp_session_is_in_play(pxp, ARB_SESSION)) {
drm_err(>->i915->drm, "arb session already in play at creation time\n");
return -EEXIST;
}
if (HAS_ENGINE(pxp->ctrl_gt, GSC0))
ret = intel_pxp_gsccs_create_session(pxp, ARB_SESSION);
else
ret = intel_pxp_tee_cmd_create_arb_session(pxp, ARB_SESSION);
if (ret) {
drm_err(>->i915->drm, "tee cmd for arb session creation failed\n");
return ret;
}
ret = pxp_wait_for_session_state(pxp, ARB_SESSION, true);
if (ret) {
drm_dbg(>->i915->drm, "arb session failed to go in play\n");
return ret;
}
drm_dbg(>->i915->drm, "PXP ARB session is alive\n");
if (!++pxp->key_instance)
++pxp->key_instance;
pxp->arb_is_valid = true;
return 0;
}
Annotation
- Immediate include surface: `drm/drm_print.h`, `i915_drv.h`, `intel_pxp.h`, `intel_pxp_cmd.h`, `intel_pxp_gsccs.h`, `intel_pxp_session.h`, `intel_pxp_tee.h`, `intel_pxp_types.h`.
- Detected declarations: `function Copyright`, `function pxp_wait_for_session_state`, `function pxp_create_arb_session`, `function pxp_terminate_arb_session_and_global`, `function intel_pxp_terminate`, `function pxp_terminate_complete`, `function pxp_session_work`, `function intel_pxp_session_management_init`.
- 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.