Lines Matching full:pxp
18 static bool intel_pxp_session_is_in_play(struct intel_pxp *pxp, u32 id) in intel_pxp_session_is_in_play() argument
20 struct intel_uncore *uncore = pxp->ctrl_gt->uncore; in intel_pxp_session_is_in_play()
26 sip = intel_uncore_read(uncore, KCR_SIP(pxp->kcr_base)); in intel_pxp_session_is_in_play()
31 static int pxp_wait_for_session_state(struct intel_pxp *pxp, u32 id, bool in_play) in pxp_wait_for_session_state() argument
33 struct intel_uncore *uncore = pxp->ctrl_gt->uncore; in pxp_wait_for_session_state()
44 KCR_SIP(pxp->kcr_base), in pxp_wait_for_session_state()
54 static int pxp_create_arb_session(struct intel_pxp *pxp) in pxp_create_arb_session() argument
56 struct intel_gt *gt = pxp->ctrl_gt; in pxp_create_arb_session()
59 pxp->arb_is_valid = false; in pxp_create_arb_session()
61 if (intel_pxp_session_is_in_play(pxp, ARB_SESSION)) { in pxp_create_arb_session()
66 if (HAS_ENGINE(pxp->ctrl_gt, GSC0)) in pxp_create_arb_session()
67 ret = intel_pxp_gsccs_create_session(pxp, ARB_SESSION); in pxp_create_arb_session()
69 ret = intel_pxp_tee_cmd_create_arb_session(pxp, ARB_SESSION); in pxp_create_arb_session()
75 ret = pxp_wait_for_session_state(pxp, ARB_SESSION, true); in pxp_create_arb_session()
80 drm_dbg(>->i915->drm, "PXP ARB session is alive\n"); in pxp_create_arb_session()
82 if (!++pxp->key_instance) in pxp_create_arb_session()
83 ++pxp->key_instance; in pxp_create_arb_session()
85 pxp->arb_is_valid = true; in pxp_create_arb_session()
90 static int pxp_terminate_arb_session_and_global(struct intel_pxp *pxp) in pxp_terminate_arb_session_and_global() argument
93 struct intel_gt *gt = pxp->ctrl_gt; in pxp_terminate_arb_session_and_global()
96 GEM_WARN_ON(pxp->arb_is_valid); in pxp_terminate_arb_session_and_global()
99 ret = intel_pxp_terminate_session(pxp, ARB_SESSION); in pxp_terminate_arb_session_and_global()
105 ret = pxp_wait_for_session_state(pxp, ARB_SESSION, false); in pxp_terminate_arb_session_and_global()
111 intel_uncore_write(gt->uncore, KCR_GLOBAL_TERMINATE(pxp->kcr_base), 1); in pxp_terminate_arb_session_and_global()
114 intel_pxp_gsccs_end_arb_fw_session(pxp, ARB_SESSION); in pxp_terminate_arb_session_and_global()
116 intel_pxp_tee_end_arb_fw_session(pxp, ARB_SESSION); in pxp_terminate_arb_session_and_global()
121 void intel_pxp_terminate(struct intel_pxp *pxp, bool post_invalidation_needs_restart) in intel_pxp_terminate() argument
125 pxp->hw_state_invalidated = post_invalidation_needs_restart; in intel_pxp_terminate()
129 * it to complete. PXP will be marked as non-active until the next in intel_pxp_terminate()
132 ret = pxp_terminate_arb_session_and_global(pxp); in intel_pxp_terminate()
134 complete_all(&pxp->termination); in intel_pxp_terminate()
137 static void pxp_terminate_complete(struct intel_pxp *pxp) in pxp_terminate_complete() argument
140 if (fetch_and_zero(&pxp->hw_state_invalidated)) in pxp_terminate_complete()
141 pxp_create_arb_session(pxp); in pxp_terminate_complete()
143 complete_all(&pxp->termination); in pxp_terminate_complete()
148 struct intel_pxp *pxp = container_of(work, typeof(*pxp), session_work); in pxp_session_work() local
149 struct intel_gt *gt = pxp->ctrl_gt; in pxp_session_work()
154 events = fetch_and_zero(&pxp->session_events); in pxp_session_work()
161 intel_pxp_invalidate(pxp); in pxp_session_work()
173 intel_pxp_terminate(pxp, true); in pxp_session_work()
177 pxp_terminate_complete(pxp); in pxp_session_work()
182 void intel_pxp_session_management_init(struct intel_pxp *pxp) in intel_pxp_session_management_init() argument
184 mutex_init(&pxp->arb_mutex); in intel_pxp_session_management_init()
185 INIT_WORK(&pxp->session_work, pxp_session_work); in intel_pxp_session_management_init()