Lines Matching +full:0 +full:xe

37 	struct xe_device *xe = pxp->xe;  in allocate_vcs_execution_resources()  local
44 hwe = xe_gt_hw_engine(gt, XE_ENGINE_CLASS_VIDEO_DECODE, 0, true); in allocate_vcs_execution_resources()
48 q = xe_exec_queue_create(xe, NULL, BIT(hwe->logical_instance), 1, hwe, in allocate_vcs_execution_resources()
49 EXEC_QUEUE_FLAG_KERNEL | EXEC_QUEUE_FLAG_PERMANENT, 0); in allocate_vcs_execution_resources()
57 bo = xe_bo_create_pin_map(xe, tile, NULL, SZ_4K, ttm_bo_type_kernel, in allocate_vcs_execution_resources()
67 return 0; in allocate_vcs_execution_resources()
89 struct xe_device *xe = tile_to_xe(tile); in allocate_gsc_client_resources() local
96 int err = 0; in allocate_gsc_client_resources()
98 hwe = xe_gt_hw_engine(gt, XE_ENGINE_CLASS_OTHER, 0, true); in allocate_gsc_client_resources()
101 xe_assert(xe, hwe); in allocate_gsc_client_resources()
104 vm = xe_vm_create(xe, XE_VM_FLAG_GSC); in allocate_gsc_client_resources()
110 bo = xe_bo_create_pin_map(xe, tile, vm, PXP_BB_SIZE + inout_size * 2, in allocate_gsc_client_resources()
119 fence = xe_vm_bind_kernel_bo(vm, bo, NULL, 0, XE_CACHE_WB); in allocate_gsc_client_resources()
127 if (timeout <= 0) { in allocate_gsc_client_resources()
132 q = xe_exec_queue_create(xe, vm, BIT(hwe->logical_instance), 1, hwe, in allocate_gsc_client_resources()
134 EXEC_QUEUE_FLAG_PERMANENT, 0); in allocate_gsc_client_resources()
143 gsc_res->batch = IOSYS_MAP_INIT_OFFSET(&bo->vmap, 0); in allocate_gsc_client_resources()
148 /* initialize host-session-handle (for all Xe-to-gsc-firmware PXP cmds) */ in allocate_gsc_client_resources()
151 return 0; in allocate_gsc_client_resources()
179 * Returns 0 if the allocation and mapping is successful, an errno value
199 return 0; in xe_pxp_allocate_execution_resources()
219 static u32 pxp_emit_wait(struct xe_device *xe, struct iosys_map *batch, u32 offset) in pxp_emit_wait() argument
222 emit_cmd(xe, batch, offset++, MFX_WAIT_PXP); in pxp_emit_wait()
223 emit_cmd(xe, batch, offset++, 0); in pxp_emit_wait()
228 static u32 pxp_emit_session_selection(struct xe_device *xe, struct iosys_map *batch, in pxp_emit_session_selection() argument
231 offset = pxp_emit_wait(xe, batch, offset); in pxp_emit_session_selection()
234 emit_cmd(xe, batch, offset++, MI_FLUSH_DW | MI_FLUSH_IMM_DW); in pxp_emit_session_selection()
235 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
236 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
237 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
240 emit_cmd(xe, batch, offset++, MI_SET_APPID | MI_SET_APPID_SESSION_ID(idx)); in pxp_emit_session_selection()
241 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
243 offset = pxp_emit_wait(xe, batch, offset); in pxp_emit_session_selection()
246 emit_cmd(xe, batch, offset++, MI_FLUSH_DW | in pxp_emit_session_selection()
250 emit_cmd(xe, batch, offset++, LRC_PPHWSP_PXP_INVAL_SCRATCH_ADDR | in pxp_emit_session_selection()
252 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
253 emit_cmd(xe, batch, offset++, 0); in pxp_emit_session_selection()
255 offset = pxp_emit_wait(xe, batch, offset); in pxp_emit_session_selection()
260 static u32 pxp_emit_inline_termination(struct xe_device *xe, in pxp_emit_inline_termination() argument
264 emit_cmd(xe, batch, offset++, CRYPTO_KEY_EXCHANGE); in pxp_emit_inline_termination()
265 emit_cmd(xe, batch, offset++, 0); in pxp_emit_inline_termination()
270 static u32 pxp_emit_session_termination(struct xe_device *xe, struct iosys_map *batch, in pxp_emit_session_termination() argument
273 offset = pxp_emit_session_selection(xe, batch, offset, idx); in pxp_emit_session_termination()
274 offset = pxp_emit_inline_termination(xe, batch, offset); in pxp_emit_session_termination()
286 * Returns 0 if the submission is successful, an errno value otherwise.
293 u32 offset = 0; in xe_pxp_submit_session_termination()
296 offset = pxp_emit_session_termination(pxp->xe, &pxp->vcs_exec.bo->vmap, offset, id); in xe_pxp_submit_session_termination()
297 offset = pxp_emit_wait(pxp->xe, &pxp->vcs_exec.bo->vmap, offset); in xe_pxp_submit_session_termination()
298 emit_cmd(pxp->xe, &pxp->vcs_exec.bo->vmap, offset, MI_BATCH_BUFFER_END); in xe_pxp_submit_session_termination()
314 else if (timeout < 0) in xe_pxp_submit_session_termination()
317 return 0; in xe_pxp_submit_session_termination()
356 struct xe_device *xe = gt_to_xe(gt); in pxp_pkt_submit() local
361 xe_assert(xe, q->hwe->engine_id == XE_HW_ENGINE_GSCCS0); in pxp_pkt_submit()
373 if (timeout < 0) in pxp_pkt_submit()
378 return 0; in pxp_pkt_submit()
381 static void emit_pxp_heci_cmd(struct xe_device *xe, struct iosys_map *batch, in emit_pxp_heci_cmd() argument
384 u32 len = 0; in emit_pxp_heci_cmd()
386 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, GSC_HECI_CMD_PKT); in emit_pxp_heci_cmd()
387 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, lower_32_bits(addr_in)); in emit_pxp_heci_cmd()
388 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, upper_32_bits(addr_in)); in emit_pxp_heci_cmd()
389 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, size_in); in emit_pxp_heci_cmd()
390 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, lower_32_bits(addr_out)); in emit_pxp_heci_cmd()
391 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, upper_32_bits(addr_out)); in emit_pxp_heci_cmd()
392 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, size_out); in emit_pxp_heci_cmd()
393 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, 0); in emit_pxp_heci_cmd()
394 xe_map_wr(xe, batch, len++ * sizeof(u32), u32, MI_BATCH_BUFFER_END); in emit_pxp_heci_cmd()
403 struct xe_device *xe = gsc_res->vm->xe; in gsccs_send_message() local
408 u32 min_reply_size = 0; in gsccs_send_message()
415 wr_offset = xe_gsc_emit_header(xe, &gsc_res->msg_in, 0, in gsccs_send_message()
422 xe_map_memcpy_to(xe, &gsc_res->msg_in, wr_offset, in gsccs_send_message()
428 xe_gsc_poison_header(xe, &gsc_res->msg_out, 0); in gsccs_send_message()
431 * The BO is mapped at address 0 of the PPGTT, so no need to add its in gsccs_send_message()
434 emit_pxp_heci_cmd(xe, &gsc_res->batch, PXP_BB_SIZE, in gsccs_send_message()
438 xe_device_wmb(xe); in gsccs_send_message()
451 ret = pxp_pkt_submit(gsc_res->q, 0); in gsccs_send_message()
455 if (xe_gsc_check_and_update_pending(xe, &gsc_res->msg_in, 0, in gsccs_send_message()
456 &gsc_res->msg_out, 0)) { in gsccs_send_message()
463 drm_err(&xe->drm, "failed to submit GSC PXP message (%pe)\n", ERR_PTR(ret)); in gsccs_send_message()
467 ret = xe_gsc_read_out_header(xe, &gsc_res->msg_out, 0, in gsccs_send_message()
470 drm_err(&xe->drm, "invalid GSC reply for PXP (%pe)\n", ERR_PTR(ret)); in gsccs_send_message()
475 reply_size = xe_map_rd_field(xe, &gsc_res->msg_out, rd_offset, in gsccs_send_message()
480 drm_warn(&xe->drm, "PXP reply size overflow: %u (%zu)\n", in gsccs_send_message()
485 xe_map_memcpy_from(xe, msg_out, &gsc_res->msg_out, in gsccs_send_message()
489 xe_gsc_poison_header(xe, &gsc_res->msg_in, 0); in gsccs_send_message()
501 * Returns 0 if the submission is successful, an errno value otherwise.
505 struct xe_device *xe = gsc_res->vm->xe; in xe_pxp_submit_session_init() local
506 struct pxp43_create_arb_in msg_in = {0}; in xe_pxp_submit_session_init()
507 struct pxp43_create_arb_out msg_out = {0}; in xe_pxp_submit_session_init()
514 FIELD_PREP(PXP43_INIT_SESSION_APPTYPE, 0)); in xe_pxp_submit_session_init()
523 drm_err(&xe->drm, "Failed to init PXP session %u (%pe)\n", id, ERR_PTR(ret)); in xe_pxp_submit_session_init()
524 } else if (msg_out.header.status != 0) { in xe_pxp_submit_session_init()
528 drm_info_once(&xe->drm, in xe_pxp_submit_session_init()
529 "Failed to init PXP session %u due to BIOS/SOC, s=0x%x(%s)\n", in xe_pxp_submit_session_init()
533 drm_dbg(&xe->drm, "Failed to init PXP session %u, s=0x%x\n", in xe_pxp_submit_session_init()
548 * Returns 0 if the submission is successful, an errno value otherwise.
552 struct xe_device *xe = gsc_res->vm->xe; in xe_pxp_submit_session_invalidation() local
553 struct pxp43_inv_stream_key_in msg_in = {0}; in xe_pxp_submit_session_invalidation()
554 struct pxp43_inv_stream_key_out msg_out = {0}; in xe_pxp_submit_session_invalidation()
555 int ret = 0; in xe_pxp_submit_session_invalidation()
566 msg_in.header.stream_id |= FIELD_PREP(PXP_CMDHDR_EXTDATA_APP_TYPE, 0); in xe_pxp_submit_session_invalidation()
572 drm_err(&xe->drm, "Failed to invalidate PXP stream-key %u (%pe)\n", in xe_pxp_submit_session_invalidation()
574 } else if (msg_out.header.status != 0) { in xe_pxp_submit_session_invalidation()
578 drm_info_once(&xe->drm, in xe_pxp_submit_session_invalidation()
579 "Failed to invalidate PXP stream-key %u: BIOS/SOC 0x%08x(%s)\n", in xe_pxp_submit_session_invalidation()
583 drm_dbg(&xe->drm, "Failed to invalidate stream-key %u, s=0x%08x\n", in xe_pxp_submit_session_invalidation()