/* check if this is a host-session-handle cleanup call (empty packet) */ if (!msg_in && !msg_out)
header->flags |= GSC_INFLAG_MSG_CLEANUP;
/* copy caller provided gsc message handle if this is polling for a prior msg completion */
header->gsc_message_handle = *gsc_msg_handle_retry;
/* NOTE: zero size packets are used for session-cleanups */ if (msg_in && msg_in_size)
memcpy(exec_res->pkt_vaddr + sizeof(*header), msg_in, msg_in_size);
/* * Before submitting, let's clear-out the validity marker on the reply offset. * We use offset PXP43_MAX_HECI_INOUT_SIZE for reply location so point header there.
*/
header = exec_res->pkt_vaddr + PXP43_MAX_HECI_INOUT_SIZE;
header->validity_marker = 0;
ret = intel_gsc_uc_heci_cmd_submit_nonpriv(>->uc.gsc,
exec_res->ce, &pkt, exec_res->bb_vaddr,
GSC_HECI_REPLY_LATENCY_MS); if (ret) {
drm_err(&i915->drm, "failed to send gsc PXP msg (%d)\n", ret); goto unlock;
}
/* Response validity marker, status and busyness */ if (header->validity_marker != GSC_HECI_VALIDITY_MARKER) {
drm_err(&i915->drm, "gsc PXP reply with invalid validity marker\n");
ret = -EINVAL; goto unlock;
} if (header->status != 0) {
drm_dbg(&i915->drm, "gsc PXP reply status has error = 0x%08x\n",
header->status);
ret = -EINVAL; goto unlock;
} if (header->flags & GSC_OUTFLAG_MSG_PENDING) {
drm_dbg(&i915->drm, "gsc PXP reply is busy\n"); /* * When the GSC firmware replies with pending bit, it means that the requested * operation has begun but the completion is pending and the caller needs * to re-request with the gsc_message_handle that was returned by the firmware. * until the pending bit is turned off.
*/
*gsc_msg_handle_retry = header->gsc_message_handle;
ret = -EAGAIN; goto unlock;
}
/* * Keep sending request if GSC firmware was busy. Based on fw specs + * sw overhead (and testing) we expect a worst case pending-bit delay of * GSC_PENDING_RETRY_MAXCOUNT x GSC_PENDING_RETRY_PAUSE_MS millisecs.
*/ do {
ret = gsccs_send_message(pxp, msg_in, msg_in_size, msg_out, msg_out_size_max,
msg_out_len, &gsc_session_retry); /* Only try again if gsc says so */ if (ret != -EAGAIN) break;
msleep(GSC_PENDING_RETRY_PAUSE_MS);
} while (++tries < GSC_PENDING_RETRY_MAXCOUNT);
return ret;
}
bool intel_pxp_gsccs_is_ready_for_sessions(struct intel_pxp *pxp)
{ /* * GSC-fw loading, HuC-fw loading, HuC-fw authentication and * GSC-proxy init flow (requiring an mei component driver) * must all occur first before we can start requesting for PXP * sessions. Checking for completion on HuC authentication and * gsc-proxy init flow (the last set of dependencies that * are out of order) will suffice.
*/ if (intel_huc_is_authenticated(&pxp->ctrl_gt->uc.huc, INTEL_HUC_AUTH_BY_GSC) &&
intel_gsc_uc_fw_proxy_init_done(&pxp->ctrl_gt->uc.gsc, true)) returntrue;
returnfalse;
}
int intel_pxp_gsccs_create_session(struct intel_pxp *pxp, int arb_session_id)
{ struct drm_i915_private *i915 = pxp->ctrl_gt->i915; struct pxp43_create_arb_in msg_in = {}; struct pxp43_create_arb_out msg_out = {}; int ret;
if (exec_res->host_session_handle)
gsccs_cleanup_fw_host_session_handle(pxp); if (exec_res->ce)
intel_context_put(exec_res->ce); if (exec_res->bb_vma)
i915_vma_unpin_and_release(&exec_res->bb_vma, I915_VMA_RELEASE_MAP); if (exec_res->pkt_vma)
i915_vma_unpin_and_release(&exec_res->pkt_vma, I915_VMA_RELEASE_MAP);
/* * First, ensure the GSC engine is present. * NOTE: Backend would only be called with the correct gt.
*/ if (!engine) return -ENODEV;
/* * Now, allocate, pin and map two objects, one for the heci message packet * and another for the batch buffer we submit into GSC engine (that includes the packet). * NOTE: GSC-CS backend is currently only supported on MTL, so we allocate shmem.
*/
err = gsccs_create_buffer(pxp->ctrl_gt, "Heci Packet",
2 * PXP43_MAX_HECI_INOUT_SIZE,
&exec_res->pkt_vma, &exec_res->pkt_vaddr); if (err) return err;
/* Finally, create an intel_context to be used during the submission */
ce = intel_context_create(engine); if (IS_ERR(ce)) {
drm_err(>->i915->drm, "Failed creating gsccs backend ctx\n");
err = PTR_ERR(ce); goto free_batch;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.