Lines Matching full:gt

54 static int pf_send_vf_control_cmd(struct xe_gt *gt, unsigned int vfid, u32 cmd)  in pf_send_vf_control_cmd()  argument
58 xe_gt_assert(gt, vfid != PFID); in pf_send_vf_control_cmd()
59 xe_gt_sriov_dbg_verbose(gt, "sending VF%u control command %s\n", in pf_send_vf_control_cmd()
62 err = guc_action_vf_control_cmd(&gt->uc.guc, vfid, cmd); in pf_send_vf_control_cmd()
64 xe_gt_sriov_err(gt, "VF%u control command %s failed (%pe)\n", in pf_send_vf_control_cmd()
69 static int pf_send_vf_pause(struct xe_gt *gt, unsigned int vfid) in pf_send_vf_pause() argument
71 return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_PAUSE); in pf_send_vf_pause()
74 static int pf_send_vf_resume(struct xe_gt *gt, unsigned int vfid) in pf_send_vf_resume() argument
76 return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_RESUME); in pf_send_vf_resume()
79 static int pf_send_vf_stop(struct xe_gt *gt, unsigned int vfid) in pf_send_vf_stop() argument
81 return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_STOP); in pf_send_vf_stop()
84 static int pf_send_vf_flr_start(struct xe_gt *gt, unsigned int vfid) in pf_send_vf_flr_start() argument
86 return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_FLR_START); in pf_send_vf_flr_start()
89 static int pf_send_vf_flr_finish(struct xe_gt *gt, unsigned int vfid) in pf_send_vf_flr_finish() argument
91 return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_FLR_FINISH); in pf_send_vf_flr_finish()
210 static struct xe_gt_sriov_control_state *pf_pick_vf_control(struct xe_gt *gt, unsigned int vfid) in pf_pick_vf_control() argument
212 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in pf_pick_vf_control()
213 xe_gt_assert(gt, vfid <= xe_gt_sriov_pf_get_totalvfs(gt)); in pf_pick_vf_control()
215 return &gt->sriov.pf.vfs[vfid].control; in pf_pick_vf_control()
218 static unsigned long *pf_peek_vf_state(struct xe_gt *gt, unsigned int vfid) in pf_peek_vf_state() argument
220 struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, vfid); in pf_peek_vf_state()
225 static bool pf_check_vf_state(struct xe_gt *gt, unsigned int vfid, in pf_check_vf_state() argument
228 return test_bit(bit, pf_peek_vf_state(gt, vfid)); in pf_check_vf_state()
231 static void pf_dump_vf_state(struct xe_gt *gt, unsigned int vfid) in pf_dump_vf_state() argument
233 unsigned long state = *pf_peek_vf_state(gt, vfid); in pf_dump_vf_state()
237 xe_gt_sriov_dbg_verbose(gt, "VF%u state %#lx%s%*pbl\n", in pf_dump_vf_state()
241 xe_gt_sriov_dbg_verbose(gt, "VF%u state %s(%d)\n", in pf_dump_vf_state()
244 xe_gt_sriov_dbg_verbose(gt, "VF%u state READY\n", vfid); in pf_dump_vf_state()
248 static bool pf_expect_vf_state(struct xe_gt *gt, unsigned int vfid, in pf_expect_vf_state() argument
251 bool result = pf_check_vf_state(gt, vfid, bit); in pf_expect_vf_state()
254 pf_dump_vf_state(gt, vfid); in pf_expect_vf_state()
259 static bool pf_expect_vf_not_state(struct xe_gt *gt, unsigned int vfid, in pf_expect_vf_not_state() argument
262 bool result = !pf_check_vf_state(gt, vfid, bit); in pf_expect_vf_not_state()
265 pf_dump_vf_state(gt, vfid); in pf_expect_vf_not_state()
270 static bool pf_enter_vf_state(struct xe_gt *gt, unsigned int vfid, in pf_enter_vf_state() argument
273 if (!test_and_set_bit(bit, pf_peek_vf_state(gt, vfid))) { in pf_enter_vf_state()
274 xe_gt_sriov_dbg_verbose(gt, "VF%u state %s(%d) enter\n", in pf_enter_vf_state()
281 static bool pf_exit_vf_state(struct xe_gt *gt, unsigned int vfid, in pf_exit_vf_state() argument
284 if (test_and_clear_bit(bit, pf_peek_vf_state(gt, vfid))) { in pf_exit_vf_state()
285 xe_gt_sriov_dbg_verbose(gt, "VF%u state %s(%d) exit\n", in pf_exit_vf_state()
292 static void pf_escape_vf_state(struct xe_gt *gt, unsigned int vfid, in pf_escape_vf_state() argument
295 if (pf_exit_vf_state(gt, vfid, bit)) in pf_escape_vf_state()
296 xe_gt_sriov_dbg_verbose(gt, "VF%u state %s(%d) escaped by %ps\n", in pf_escape_vf_state()
301 static void pf_enter_vf_mismatch(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_mismatch() argument
303 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_MISMATCH)) { in pf_enter_vf_mismatch()
304 xe_gt_sriov_dbg(gt, "VF%u state mismatch detected by %ps\n", in pf_enter_vf_mismatch()
306 pf_dump_vf_state(gt, vfid); in pf_enter_vf_mismatch()
310 static void pf_exit_vf_mismatch(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_mismatch() argument
312 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_MISMATCH)) in pf_exit_vf_mismatch()
313 xe_gt_sriov_dbg(gt, "VF%u state mismatch cleared by %ps\n", in pf_exit_vf_mismatch()
316 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_FAILED); in pf_exit_vf_mismatch()
317 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_FAILED); in pf_exit_vf_mismatch()
318 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_FAILED); in pf_exit_vf_mismatch()
319 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_FAILED); in pf_exit_vf_mismatch()
322 #define pf_enter_vf_state_machine_bug(gt, vfid) ({ \ argument
323 pf_enter_vf_mismatch((gt), (vfid)); \
326 static void pf_queue_control_worker(struct xe_gt *gt) in pf_queue_control_worker() argument
328 struct xe_device *xe = gt_to_xe(gt); in pf_queue_control_worker()
330 xe_gt_assert(gt, IS_SRIOV_PF(xe)); in pf_queue_control_worker()
332 queue_work(xe->sriov.wq, &gt->sriov.pf.control.worker); in pf_queue_control_worker()
335 static void pf_queue_vf(struct xe_gt *gt, unsigned int vfid) in pf_queue_vf() argument
337 struct xe_gt_sriov_pf_control *pfc = &gt->sriov.pf.control; in pf_queue_vf()
339 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in pf_queue_vf()
342 list_move_tail(&gt->sriov.pf.vfs[vfid].control.link, &pfc->list); in pf_queue_vf()
345 pf_queue_control_worker(gt); in pf_queue_vf()
348 static void pf_exit_vf_flr_wip(struct xe_gt *gt, unsigned int vfid);
349 static void pf_exit_vf_stop_wip(struct xe_gt *gt, unsigned int vfid);
350 static void pf_exit_vf_pause_wip(struct xe_gt *gt, unsigned int vfid);
351 static void pf_exit_vf_resume_wip(struct xe_gt *gt, unsigned int vfid);
353 static bool pf_enter_vf_wip(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_wip() argument
355 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_WIP)) { in pf_enter_vf_wip()
356 struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, vfid); in pf_enter_vf_wip()
364 static void pf_exit_vf_wip(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_wip() argument
366 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_WIP)) { in pf_exit_vf_wip()
367 struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, vfid); in pf_exit_vf_wip()
369 pf_exit_vf_flr_wip(gt, vfid); in pf_exit_vf_wip()
370 pf_exit_vf_stop_wip(gt, vfid); in pf_exit_vf_wip()
371 pf_exit_vf_pause_wip(gt, vfid); in pf_exit_vf_wip()
372 pf_exit_vf_resume_wip(gt, vfid); in pf_exit_vf_wip()
378 static int pf_wait_vf_wip_done(struct xe_gt *gt, unsigned int vfid, unsigned long timeout) in pf_wait_vf_wip_done() argument
380 struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, vfid); in pf_wait_vf_wip_done()
385 static void pf_enter_vf_ready(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_ready() argument
387 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED); in pf_enter_vf_ready()
388 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOPPED); in pf_enter_vf_ready()
389 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUMED); in pf_enter_vf_ready()
390 pf_exit_vf_mismatch(gt, vfid); in pf_enter_vf_ready()
391 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_ready()
431 static void pf_exit_vf_pause_wip(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_pause_wip() argument
433 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WIP)) { in pf_exit_vf_pause_wip()
434 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE); in pf_exit_vf_pause_wip()
435 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC); in pf_exit_vf_pause_wip()
436 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_GUC_DONE); in pf_exit_vf_pause_wip()
440 static void pf_enter_vf_paused(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_paused() argument
442 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED)) in pf_enter_vf_paused()
443 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_paused()
445 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUMED); in pf_enter_vf_paused()
446 pf_exit_vf_mismatch(gt, vfid); in pf_enter_vf_paused()
447 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_paused()
450 static void pf_enter_vf_pause_completed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_completed() argument
452 pf_enter_vf_paused(gt, vfid); in pf_enter_vf_pause_completed()
455 static void pf_enter_vf_pause_failed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_failed() argument
457 pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_FAILED); in pf_enter_vf_pause_failed()
458 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_pause_failed()
461 static void pf_enter_vf_pause_rejected(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_rejected() argument
463 pf_enter_vf_mismatch(gt, vfid); in pf_enter_vf_pause_rejected()
464 pf_enter_vf_pause_failed(gt, vfid); in pf_enter_vf_pause_rejected()
467 static bool pf_exit_vf_pause_guc_done(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_pause_guc_done() argument
469 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_GUC_DONE)) in pf_exit_vf_pause_guc_done()
472 pf_enter_vf_pause_completed(gt, vfid); in pf_exit_vf_pause_guc_done()
476 static void pf_enter_vf_pause_guc_done(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_guc_done() argument
478 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_GUC_DONE)) in pf_enter_vf_pause_guc_done()
479 pf_queue_vf(gt, vfid); in pf_enter_vf_pause_guc_done()
482 static void pf_enter_pause_wait_guc(struct xe_gt *gt, unsigned int vfid) in pf_enter_pause_wait_guc() argument
484 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC)) in pf_enter_pause_wait_guc()
485 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_pause_wait_guc()
488 static bool pf_exit_pause_wait_guc(struct xe_gt *gt, unsigned int vfid) in pf_exit_pause_wait_guc() argument
490 return pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC); in pf_exit_pause_wait_guc()
493 static void pf_enter_vf_pause_send_pause(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_send_pause() argument
495 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE)) in pf_enter_vf_pause_send_pause()
496 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_pause_send_pause()
498 pf_queue_vf(gt, vfid); in pf_enter_vf_pause_send_pause()
501 static bool pf_exit_vf_pause_send_pause(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_pause_send_pause() argument
505 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_SEND_PAUSE)) in pf_exit_vf_pause_send_pause()
509 pf_enter_pause_wait_guc(gt, vfid); in pf_exit_vf_pause_send_pause()
511 err = pf_send_vf_pause(gt, vfid); in pf_exit_vf_pause_send_pause()
514 pf_exit_pause_wait_guc(gt, vfid); in pf_exit_vf_pause_send_pause()
517 pf_enter_vf_pause_send_pause(gt, vfid); in pf_exit_vf_pause_send_pause()
519 pf_enter_vf_pause_rejected(gt, vfid); in pf_exit_vf_pause_send_pause()
521 pf_enter_vf_pause_failed(gt, vfid); in pf_exit_vf_pause_send_pause()
527 pf_exit_vf_mismatch(gt, vfid); in pf_exit_vf_pause_send_pause()
533 static bool pf_enter_vf_pause_wip(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_pause_wip() argument
535 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WIP)) { in pf_enter_vf_pause_wip()
536 pf_enter_vf_wip(gt, vfid); in pf_enter_vf_pause_wip()
537 pf_enter_vf_pause_send_pause(gt, vfid); in pf_enter_vf_pause_wip()
546 * @gt: the &xe_gt
553 int xe_gt_sriov_pf_control_pause_vf(struct xe_gt *gt, unsigned int vfid) in xe_gt_sriov_pf_control_pause_vf() argument
558 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOPPED)) { in xe_gt_sriov_pf_control_pause_vf()
559 xe_gt_sriov_dbg(gt, "VF%u is stopped!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
563 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED)) { in xe_gt_sriov_pf_control_pause_vf()
564 xe_gt_sriov_dbg(gt, "VF%u was already paused!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
568 if (!pf_enter_vf_pause_wip(gt, vfid)) { in xe_gt_sriov_pf_control_pause_vf()
569 xe_gt_sriov_dbg(gt, "VF%u pause already in progress!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
573 err = pf_wait_vf_wip_done(gt, vfid, timeout); in xe_gt_sriov_pf_control_pause_vf()
575 xe_gt_sriov_dbg(gt, "VF%u pause didn't finish in %u ms (%pe)\n", in xe_gt_sriov_pf_control_pause_vf()
580 if (pf_expect_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED)) { in xe_gt_sriov_pf_control_pause_vf()
581 xe_gt_sriov_info(gt, "VF%u paused!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
585 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_FAILED)) { in xe_gt_sriov_pf_control_pause_vf()
586 xe_gt_sriov_dbg(gt, "VF%u pause failed!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
590 xe_gt_sriov_dbg(gt, "VF%u pause was canceled!\n", vfid); in xe_gt_sriov_pf_control_pause_vf()
622 static void pf_exit_vf_resume_wip(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_resume_wip() argument
624 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_WIP)) in pf_exit_vf_resume_wip()
625 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_SEND_RESUME); in pf_exit_vf_resume_wip()
628 static void pf_enter_vf_resumed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resumed() argument
630 pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUMED); in pf_enter_vf_resumed()
631 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED); in pf_enter_vf_resumed()
632 pf_exit_vf_mismatch(gt, vfid); in pf_enter_vf_resumed()
633 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_resumed()
636 static void pf_enter_vf_resume_completed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resume_completed() argument
638 pf_enter_vf_resumed(gt, vfid); in pf_enter_vf_resume_completed()
641 static void pf_enter_vf_resume_failed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resume_failed() argument
643 pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_FAILED); in pf_enter_vf_resume_failed()
644 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_resume_failed()
647 static void pf_enter_vf_resume_rejected(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resume_rejected() argument
649 pf_enter_vf_mismatch(gt, vfid); in pf_enter_vf_resume_rejected()
650 pf_enter_vf_resume_failed(gt, vfid); in pf_enter_vf_resume_rejected()
653 static void pf_enter_vf_resume_send_resume(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resume_send_resume() argument
655 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_SEND_RESUME)) in pf_enter_vf_resume_send_resume()
656 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_resume_send_resume()
658 pf_queue_vf(gt, vfid); in pf_enter_vf_resume_send_resume()
661 static bool pf_exit_vf_resume_send_resume(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_resume_send_resume() argument
665 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_SEND_RESUME)) in pf_exit_vf_resume_send_resume()
668 err = pf_send_vf_resume(gt, vfid); in pf_exit_vf_resume_send_resume()
670 pf_enter_vf_resume_send_resume(gt, vfid); in pf_exit_vf_resume_send_resume()
672 pf_enter_vf_resume_rejected(gt, vfid); in pf_exit_vf_resume_send_resume()
674 pf_enter_vf_resume_failed(gt, vfid); in pf_exit_vf_resume_send_resume()
676 pf_enter_vf_resume_completed(gt, vfid); in pf_exit_vf_resume_send_resume()
680 static bool pf_enter_vf_resume_wip(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_resume_wip() argument
682 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_WIP)) { in pf_enter_vf_resume_wip()
683 pf_enter_vf_wip(gt, vfid); in pf_enter_vf_resume_wip()
684 pf_enter_vf_resume_send_resume(gt, vfid); in pf_enter_vf_resume_wip()
693 * @gt: the &xe_gt
700 int xe_gt_sriov_pf_control_resume_vf(struct xe_gt *gt, unsigned int vfid) in xe_gt_sriov_pf_control_resume_vf() argument
705 if (!pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED)) { in xe_gt_sriov_pf_control_resume_vf()
706 xe_gt_sriov_dbg(gt, "VF%u is not paused!\n", vfid); in xe_gt_sriov_pf_control_resume_vf()
710 if (!pf_enter_vf_resume_wip(gt, vfid)) { in xe_gt_sriov_pf_control_resume_vf()
711 xe_gt_sriov_dbg(gt, "VF%u resume already in progress!\n", vfid); in xe_gt_sriov_pf_control_resume_vf()
715 err = pf_wait_vf_wip_done(gt, vfid, timeout); in xe_gt_sriov_pf_control_resume_vf()
719 if (pf_expect_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUMED)) { in xe_gt_sriov_pf_control_resume_vf()
720 xe_gt_sriov_info(gt, "VF%u resumed!\n", vfid); in xe_gt_sriov_pf_control_resume_vf()
724 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUME_FAILED)) { in xe_gt_sriov_pf_control_resume_vf()
725 xe_gt_sriov_dbg(gt, "VF%u resume failed!\n", vfid); in xe_gt_sriov_pf_control_resume_vf()
729 xe_gt_sriov_dbg(gt, "VF%u resume was canceled!\n", vfid); in xe_gt_sriov_pf_control_resume_vf()
761 static void pf_exit_vf_stop_wip(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_stop_wip() argument
763 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_WIP)) in pf_exit_vf_stop_wip()
764 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_SEND_STOP); in pf_exit_vf_stop_wip()
767 static void pf_enter_vf_stopped(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stopped() argument
769 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOPPED)) in pf_enter_vf_stopped()
770 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_stopped()
772 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_RESUMED); in pf_enter_vf_stopped()
773 pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSED); in pf_enter_vf_stopped()
774 pf_exit_vf_mismatch(gt, vfid); in pf_enter_vf_stopped()
775 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_stopped()
778 static void pf_enter_vf_stop_completed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stop_completed() argument
780 pf_enter_vf_stopped(gt, vfid); in pf_enter_vf_stop_completed()
783 static void pf_enter_vf_stop_failed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stop_failed() argument
785 pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_FAILED); in pf_enter_vf_stop_failed()
786 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_stop_failed()
789 static void pf_enter_vf_stop_rejected(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stop_rejected() argument
791 pf_enter_vf_mismatch(gt, vfid); in pf_enter_vf_stop_rejected()
792 pf_enter_vf_stop_failed(gt, vfid); in pf_enter_vf_stop_rejected()
795 static void pf_enter_vf_stop_send_stop(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stop_send_stop() argument
797 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_SEND_STOP)) in pf_enter_vf_stop_send_stop()
798 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_stop_send_stop()
800 pf_queue_vf(gt, vfid); in pf_enter_vf_stop_send_stop()
803 static bool pf_exit_vf_stop_send_stop(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_stop_send_stop() argument
807 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_SEND_STOP)) in pf_exit_vf_stop_send_stop()
810 err = pf_send_vf_stop(gt, vfid); in pf_exit_vf_stop_send_stop()
812 pf_enter_vf_stop_send_stop(gt, vfid); in pf_exit_vf_stop_send_stop()
814 pf_enter_vf_stop_rejected(gt, vfid); in pf_exit_vf_stop_send_stop()
816 pf_enter_vf_stop_failed(gt, vfid); in pf_exit_vf_stop_send_stop()
818 pf_enter_vf_stop_completed(gt, vfid); in pf_exit_vf_stop_send_stop()
822 static bool pf_enter_vf_stop_wip(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_stop_wip() argument
824 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_WIP)) { in pf_enter_vf_stop_wip()
825 pf_enter_vf_wip(gt, vfid); in pf_enter_vf_stop_wip()
826 pf_enter_vf_stop_send_stop(gt, vfid); in pf_enter_vf_stop_wip()
834 * @gt: the &xe_gt
841 int xe_gt_sriov_pf_control_stop_vf(struct xe_gt *gt, unsigned int vfid) in xe_gt_sriov_pf_control_stop_vf() argument
846 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOPPED)) { in xe_gt_sriov_pf_control_stop_vf()
847 xe_gt_sriov_dbg(gt, "VF%u was already stopped!\n", vfid); in xe_gt_sriov_pf_control_stop_vf()
851 if (!pf_enter_vf_stop_wip(gt, vfid)) { in xe_gt_sriov_pf_control_stop_vf()
852 xe_gt_sriov_dbg(gt, "VF%u stop already in progress!\n", vfid); in xe_gt_sriov_pf_control_stop_vf()
856 err = pf_wait_vf_wip_done(gt, vfid, timeout); in xe_gt_sriov_pf_control_stop_vf()
860 if (pf_expect_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOPPED)) { in xe_gt_sriov_pf_control_stop_vf()
861 xe_gt_sriov_info(gt, "VF%u stopped!\n", vfid); in xe_gt_sriov_pf_control_stop_vf()
865 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_STOP_FAILED)) { in xe_gt_sriov_pf_control_stop_vf()
866 xe_gt_sriov_dbg(gt, "VF%u stop failed!\n", vfid); in xe_gt_sriov_pf_control_stop_vf()
870 xe_gt_sriov_dbg(gt, "VF%u stop was canceled!\n", vfid); in xe_gt_sriov_pf_control_stop_vf()
921 static void pf_enter_vf_flr_send_start(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_send_start() argument
923 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_START)) in pf_enter_vf_flr_send_start()
924 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_send_start()
926 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_send_start()
929 static void pf_enter_vf_flr_wip(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_wip() argument
931 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WIP)) { in pf_enter_vf_flr_wip()
932 xe_gt_sriov_dbg(gt, "VF%u FLR is already in progress\n", vfid); in pf_enter_vf_flr_wip()
936 pf_enter_vf_wip(gt, vfid); in pf_enter_vf_flr_wip()
937 pf_enter_vf_flr_send_start(gt, vfid); in pf_enter_vf_flr_wip()
940 static void pf_exit_vf_flr_wip(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_wip() argument
942 if (pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WIP)) { in pf_exit_vf_flr_wip()
943 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_FINISH); in pf_exit_vf_flr_wip()
944 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_MMIO); in pf_exit_vf_flr_wip()
945 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_DATA); in pf_exit_vf_flr_wip()
946 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_CONFIG); in pf_exit_vf_flr_wip()
947 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_GUC_DONE); in pf_exit_vf_flr_wip()
948 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WAIT_GUC); in pf_exit_vf_flr_wip()
949 pf_escape_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_START); in pf_exit_vf_flr_wip()
953 static void pf_enter_vf_flr_completed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_completed() argument
955 pf_enter_vf_ready(gt, vfid); in pf_enter_vf_flr_completed()
958 static void pf_enter_vf_flr_failed(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_failed() argument
960 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_FAILED)) in pf_enter_vf_flr_failed()
961 xe_gt_sriov_notice(gt, "VF%u FLR failed!\n", vfid); in pf_enter_vf_flr_failed()
962 pf_exit_vf_wip(gt, vfid); in pf_enter_vf_flr_failed()
965 static void pf_enter_vf_flr_rejected(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_rejected() argument
967 pf_enter_vf_mismatch(gt, vfid); in pf_enter_vf_flr_rejected()
968 pf_enter_vf_flr_failed(gt, vfid); in pf_enter_vf_flr_rejected()
971 static void pf_enter_vf_flr_send_finish(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_send_finish() argument
973 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_FINISH)) in pf_enter_vf_flr_send_finish()
974 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_send_finish()
976 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_send_finish()
979 static bool pf_exit_vf_flr_send_finish(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_send_finish() argument
983 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_FINISH)) in pf_exit_vf_flr_send_finish()
986 err = pf_send_vf_flr_finish(gt, vfid); in pf_exit_vf_flr_send_finish()
988 pf_enter_vf_flr_send_finish(gt, vfid); in pf_exit_vf_flr_send_finish()
990 pf_enter_vf_flr_rejected(gt, vfid); in pf_exit_vf_flr_send_finish()
992 pf_enter_vf_flr_failed(gt, vfid); in pf_exit_vf_flr_send_finish()
994 pf_enter_vf_flr_completed(gt, vfid); in pf_exit_vf_flr_send_finish()
998 static void pf_enter_vf_flr_reset_mmio(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_reset_mmio() argument
1000 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_MMIO)) in pf_enter_vf_flr_reset_mmio()
1001 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_reset_mmio()
1003 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_reset_mmio()
1006 static bool pf_exit_vf_flr_reset_mmio(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_reset_mmio() argument
1008 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_MMIO)) in pf_exit_vf_flr_reset_mmio()
1013 pf_enter_vf_flr_send_finish(gt, vfid); in pf_exit_vf_flr_reset_mmio()
1017 static void pf_enter_vf_flr_reset_data(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_reset_data() argument
1019 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_DATA)) in pf_enter_vf_flr_reset_data()
1020 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_reset_data()
1022 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_reset_data()
1025 static bool pf_exit_vf_flr_reset_data(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_reset_data() argument
1027 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_DATA)) in pf_exit_vf_flr_reset_data()
1030 xe_gt_sriov_pf_service_reset(gt, vfid); in pf_exit_vf_flr_reset_data()
1031 xe_gt_sriov_pf_monitor_flr(gt, vfid); in pf_exit_vf_flr_reset_data()
1033 pf_enter_vf_flr_reset_mmio(gt, vfid); in pf_exit_vf_flr_reset_data()
1037 static void pf_enter_vf_flr_reset_config(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_reset_config() argument
1039 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_CONFIG)) in pf_enter_vf_flr_reset_config()
1040 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_reset_config()
1042 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_reset_config()
1045 static bool pf_exit_vf_flr_reset_config(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_reset_config() argument
1050 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_RESET_CONFIG)) in pf_exit_vf_flr_reset_config()
1053 err = xe_gt_sriov_pf_config_sanitize(gt, vfid, timeout); in pf_exit_vf_flr_reset_config()
1055 pf_enter_vf_flr_failed(gt, vfid); in pf_exit_vf_flr_reset_config()
1057 pf_enter_vf_flr_reset_data(gt, vfid); in pf_exit_vf_flr_reset_config()
1061 static void pf_enter_vf_flr_wait_guc(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_wait_guc() argument
1063 if (!pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WAIT_GUC)) in pf_enter_vf_flr_wait_guc()
1064 pf_enter_vf_state_machine_bug(gt, vfid); in pf_enter_vf_flr_wait_guc()
1067 static bool pf_exit_vf_flr_wait_guc(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_wait_guc() argument
1069 return pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WAIT_GUC); in pf_exit_vf_flr_wait_guc()
1072 static bool pf_exit_vf_flr_send_start(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_send_start() argument
1076 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_SEND_START)) in pf_exit_vf_flr_send_start()
1080 pf_enter_vf_flr_wait_guc(gt, vfid); in pf_exit_vf_flr_send_start()
1082 err = pf_send_vf_flr_start(gt, vfid); in pf_exit_vf_flr_send_start()
1085 pf_exit_vf_flr_wait_guc(gt, vfid); in pf_exit_vf_flr_send_start()
1088 pf_enter_vf_flr_send_start(gt, vfid); in pf_exit_vf_flr_send_start()
1090 pf_enter_vf_flr_rejected(gt, vfid); in pf_exit_vf_flr_send_start()
1092 pf_enter_vf_flr_failed(gt, vfid); in pf_exit_vf_flr_send_start()
1098 pf_exit_vf_mismatch(gt, vfid); in pf_exit_vf_flr_send_start()
1104 static bool pf_exit_vf_flr_guc_done(struct xe_gt *gt, unsigned int vfid) in pf_exit_vf_flr_guc_done() argument
1106 if (!pf_exit_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_GUC_DONE)) in pf_exit_vf_flr_guc_done()
1109 pf_enter_vf_flr_reset_config(gt, vfid); in pf_exit_vf_flr_guc_done()
1113 static void pf_enter_vf_flr_guc_done(struct xe_gt *gt, unsigned int vfid) in pf_enter_vf_flr_guc_done() argument
1115 if (pf_enter_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_GUC_DONE)) in pf_enter_vf_flr_guc_done()
1116 pf_queue_vf(gt, vfid); in pf_enter_vf_flr_guc_done()
1121 * @gt: the &xe_gt
1128 int xe_gt_sriov_pf_control_trigger_flr(struct xe_gt *gt, unsigned int vfid) in xe_gt_sriov_pf_control_trigger_flr() argument
1133 pf_enter_vf_flr_wip(gt, vfid); in xe_gt_sriov_pf_control_trigger_flr()
1135 err = pf_wait_vf_wip_done(gt, vfid, timeout); in xe_gt_sriov_pf_control_trigger_flr()
1137 xe_gt_sriov_notice(gt, "VF%u FLR didn't finish in %u ms (%pe)\n", in xe_gt_sriov_pf_control_trigger_flr()
1142 if (!pf_expect_vf_not_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_FAILED)) in xe_gt_sriov_pf_control_trigger_flr()
1187 static void pf_handle_vf_flr(struct xe_gt *gt, u32 vfid) in pf_handle_vf_flr() argument
1189 struct xe_device *xe = gt_to_xe(gt); in pf_handle_vf_flr()
1193 xe_gt_sriov_info(gt, "VF%u FLR\n", vfid); in pf_handle_vf_flr()
1199 pf_enter_vf_flr_wip(gt, vfid); in pf_handle_vf_flr()
1203 static void pf_handle_vf_flr_done(struct xe_gt *gt, u32 vfid) in pf_handle_vf_flr_done() argument
1205 if (!pf_exit_vf_flr_wait_guc(gt, vfid)) { in pf_handle_vf_flr_done()
1206 xe_gt_sriov_dbg(gt, "Received out of order 'VF%u FLR done'\n", vfid); in pf_handle_vf_flr_done()
1207 pf_enter_vf_mismatch(gt, vfid); in pf_handle_vf_flr_done()
1211 pf_enter_vf_flr_guc_done(gt, vfid); in pf_handle_vf_flr_done()
1214 static void pf_handle_vf_pause_done(struct xe_gt *gt, u32 vfid) in pf_handle_vf_pause_done() argument
1216 if (!pf_exit_pause_wait_guc(gt, vfid)) { in pf_handle_vf_pause_done()
1217 xe_gt_sriov_dbg(gt, "Received out of order 'VF%u PAUSE done'\n", vfid); in pf_handle_vf_pause_done()
1218 pf_enter_vf_mismatch(gt, vfid); in pf_handle_vf_pause_done()
1222 pf_enter_vf_pause_guc_done(gt, vfid); in pf_handle_vf_pause_done()
1225 static int pf_handle_vf_event(struct xe_gt *gt, u32 vfid, u32 eventid) in pf_handle_vf_event() argument
1227 xe_gt_sriov_dbg_verbose(gt, "received VF%u event %#x\n", vfid, eventid); in pf_handle_vf_event()
1229 if (vfid > xe_gt_sriov_pf_get_totalvfs(gt)) in pf_handle_vf_event()
1234 pf_handle_vf_flr(gt, vfid); in pf_handle_vf_event()
1237 pf_handle_vf_flr_done(gt, vfid); in pf_handle_vf_event()
1240 pf_handle_vf_pause_done(gt, vfid); in pf_handle_vf_event()
1250 static int pf_handle_pf_event(struct xe_gt *gt, u32 eventid) in pf_handle_pf_event() argument
1254 xe_gt_sriov_dbg_verbose(gt, "VFs %s/%s\n", in pf_handle_pf_event()
1266 * @gt: the &xe_gt
1274 int xe_gt_sriov_pf_control_process_guc2pf(struct xe_gt *gt, const u32 *msg, u32 len) in xe_gt_sriov_pf_control_process_guc2pf() argument
1279 xe_gt_assert(gt, len); in xe_gt_sriov_pf_control_process_guc2pf()
1280 xe_gt_assert(gt, FIELD_GET(GUC_HXG_MSG_0_ORIGIN, msg[0]) == GUC_HXG_ORIGIN_GUC); in xe_gt_sriov_pf_control_process_guc2pf()
1281 xe_gt_assert(gt, FIELD_GET(GUC_HXG_MSG_0_TYPE, msg[0]) == GUC_HXG_TYPE_EVENT); in xe_gt_sriov_pf_control_process_guc2pf()
1282 xe_gt_assert(gt, FIELD_GET(GUC_HXG_EVENT_MSG_0_ACTION, msg[0]) == in xe_gt_sriov_pf_control_process_guc2pf()
1285 if (unlikely(!xe_device_is_sriov_pf(gt_to_xe(gt)))) in xe_gt_sriov_pf_control_process_guc2pf()
1297 return vfid ? pf_handle_vf_event(gt, vfid, eventid) : pf_handle_pf_event(gt, eventid); in xe_gt_sriov_pf_control_process_guc2pf()
1300 static bool pf_process_vf_state_machine(struct xe_gt *gt, unsigned int vfid) in pf_process_vf_state_machine() argument
1302 if (pf_exit_vf_flr_send_start(gt, vfid)) in pf_process_vf_state_machine()
1305 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_FLR_WAIT_GUC)) { in pf_process_vf_state_machine()
1306 xe_gt_sriov_dbg_verbose(gt, "VF%u in %s\n", vfid, in pf_process_vf_state_machine()
1311 if (pf_exit_vf_flr_guc_done(gt, vfid)) in pf_process_vf_state_machine()
1314 if (pf_exit_vf_flr_reset_config(gt, vfid)) in pf_process_vf_state_machine()
1317 if (pf_exit_vf_flr_reset_data(gt, vfid)) in pf_process_vf_state_machine()
1320 if (pf_exit_vf_flr_reset_mmio(gt, vfid)) in pf_process_vf_state_machine()
1323 if (pf_exit_vf_flr_send_finish(gt, vfid)) in pf_process_vf_state_machine()
1326 if (pf_exit_vf_stop_send_stop(gt, vfid)) in pf_process_vf_state_machine()
1329 if (pf_exit_vf_pause_send_pause(gt, vfid)) in pf_process_vf_state_machine()
1332 if (pf_check_vf_state(gt, vfid, XE_GT_SRIOV_STATE_PAUSE_WAIT_GUC)) { in pf_process_vf_state_machine()
1333 xe_gt_sriov_dbg_verbose(gt, "VF%u in %s\n", vfid, in pf_process_vf_state_machine()
1338 if (pf_exit_vf_pause_guc_done(gt, vfid)) in pf_process_vf_state_machine()
1341 if (pf_exit_vf_resume_send_resume(gt, vfid)) in pf_process_vf_state_machine()
1347 static unsigned int pf_control_state_index(struct xe_gt *gt, in pf_control_state_index() argument
1350 return container_of(cs, struct xe_gt_sriov_metadata, control) - gt->sriov.pf.vfs; in pf_control_state_index()
1353 static void pf_worker_find_work(struct xe_gt *gt) in pf_worker_find_work() argument
1355 struct xe_gt_sriov_pf_control *pfc = &gt->sriov.pf.control; in pf_worker_find_work()
1372 vfid = pf_control_state_index(gt, cs); in pf_worker_find_work()
1373 xe_gt_assert(gt, vfid <= xe_gt_sriov_pf_get_totalvfs(gt)); in pf_worker_find_work()
1375 more = pf_process_vf_state_machine(gt, vfid); in pf_worker_find_work()
1377 pf_queue_vf(gt, vfid); in pf_worker_find_work()
1379 pf_queue_control_worker(gt); in pf_worker_find_work()
1384 struct xe_gt *gt = container_of(w, struct xe_gt, sriov.pf.control.worker); in control_worker_func() local
1386 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in control_worker_func()
1387 pf_worker_find_work(gt); in control_worker_func()
1390 static void pf_stop_worker(struct xe_gt *gt) in pf_stop_worker() argument
1392 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in pf_stop_worker()
1393 cancel_work_sync(&gt->sriov.pf.control.worker); in pf_stop_worker()
1398 struct xe_gt *gt = data; in control_fini_action() local
1400 pf_stop_worker(gt); in control_fini_action()
1405 * @gt: the &xe_gt
1411 int xe_gt_sriov_pf_control_init(struct xe_gt *gt) in xe_gt_sriov_pf_control_init() argument
1413 struct xe_device *xe = gt_to_xe(gt); in xe_gt_sriov_pf_control_init()
1416 xe_gt_assert(gt, IS_SRIOV_PF(xe)); in xe_gt_sriov_pf_control_init()
1420 struct xe_gt_sriov_control_state *cs = pf_pick_vf_control(gt, n); in xe_gt_sriov_pf_control_init()
1426 spin_lock_init(&gt->sriov.pf.control.lock); in xe_gt_sriov_pf_control_init()
1427 INIT_LIST_HEAD(&gt->sriov.pf.control.list); in xe_gt_sriov_pf_control_init()
1428 INIT_WORK(&gt->sriov.pf.control.worker, control_worker_func); in xe_gt_sriov_pf_control_init()
1430 return drmm_add_action_or_reset(&xe->drm, control_fini_action, gt); in xe_gt_sriov_pf_control_init()
1434 * xe_gt_sriov_pf_control_restart() - Restart SR-IOV control data after a GT reset.
1435 * @gt: the &xe_gt
1438 * performed by the PF must be reset or cancelled when the GT is reset.
1442 void xe_gt_sriov_pf_control_restart(struct xe_gt *gt) in xe_gt_sriov_pf_control_restart() argument
1444 struct xe_device *xe = gt_to_xe(gt); in xe_gt_sriov_pf_control_restart()
1447 xe_gt_assert(gt, IS_SRIOV_PF(xe)); in xe_gt_sriov_pf_control_restart()
1449 pf_stop_worker(gt); in xe_gt_sriov_pf_control_restart()
1453 pf_enter_vf_ready(gt, n); in xe_gt_sriov_pf_control_restart()