In preparation of MTL-pxp support, add helper functions to determine if teelink is required and to determine the type of teelink for the current gt-pxp subsystem. Signed-off-by: Alan Previn <alan.previn.teres.alexis@xxxxxxxxx> --- drivers/gpu/drm/i915/pxp/intel_pxp.c | 6 +++--- drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 26 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 3 +++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c index 58219beecfa4..33f86bb05148 100644 --- a/drivers/gpu/drm/i915/pxp/intel_pxp.c +++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c @@ -174,7 +174,7 @@ static void pxp_init_full(struct intel_pxp *pxp) if (ret) return; - ret = intel_pxp_tee_component_init(pxp); + ret = intel_pxp_teelink_init(pxp); if (ret) goto out_context; @@ -197,14 +197,14 @@ void intel_pxp_init(struct intel_pxp *pxp) if (intel_pxp_supported_on_gt(pxp)) pxp_init_full(pxp); else if (_gt_needs_teelink(gt)) - intel_pxp_tee_component_init(pxp); + intel_pxp_teelink_init(pxp); } void intel_pxp_fini(struct intel_pxp *pxp) { pxp->arb_is_valid = false; - intel_pxp_tee_component_fini(pxp); + intel_pxp_teelink_fini(pxp); destroy_vcs_context(pxp); } diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c index b9198e961cb6..23a848b52c75 100644 --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c @@ -319,3 +319,29 @@ int intel_pxp_tee_cmd_create_arb_session(struct intel_pxp *pxp, return ret; } + +static bool gt_supports_teelink_via_mei(struct intel_gt *gt) +{ + return (IS_ENABLED(CONFIG_INTEL_MEI_PXP) && !HAS_ENGINE(gt, GSC0)); +} + +int intel_pxp_teelink_init(struct intel_pxp *pxp) +{ + struct intel_gt *gt = pxp_to_gt(pxp); + int ret = -ENOLINK; + + if (!gt_supports_teelink_via_mei(gt)) + return -ENODEV; + + ret = intel_pxp_tee_component_init(pxp); + if (ret) + drm_warn(>->i915->drm, "Teelink initialization failed with %d\n", ret); + + return ret; +} + +void intel_pxp_teelink_fini(struct intel_pxp *pxp) +{ + intel_pxp_tee_component_fini(pxp); +} + diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.h b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.h index aeb3dfe7ce96..62995e95773f 100644 --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.h +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.h @@ -19,4 +19,7 @@ int intel_pxp_tee_stream_message(struct intel_pxp *pxp, void *msg_in, size_t msg_in_len, void *msg_out, size_t msg_out_len); +int intel_pxp_teelink_init(struct intel_pxp *pxp); +void intel_pxp_teelink_fini(struct intel_pxp *pxp); + #endif /* __INTEL_PXP_TEE_H__ */ -- 2.34.1