Commit f3fb5f1e authored by Tomasz Lis's avatar Tomasz Lis Committed by Michal Wajdeczko
Browse files

drm/xe/vf: Wait for all fixups before using default LRCs



When a context is being created during save/restore, the LRC creation
needs to wait for GGTT address space to be shifted. But it also needs
to have fixed default LRCs. This is mandatory to avoid the situation
where LRC will be created based on data from before the fixups, but
reference within exec queue will be set too late for fixups.

This fixes an issue where contexts created during save/restore have
a large chance of having one unfixed LRC, due to the xe_lrc_create()
being synced for equal start to race with default LRC fixups.

v2: Move the fixups confirmation further, behind all fixups.
  Revert some renames.

Signed-off-by: default avatarTomasz Lis <tomasz.lis@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patch.msgid.link/20260226212701.2937065-4-tomasz.lis@intel.com
parent ec172c7b
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -536,12 +536,6 @@ static int vf_get_ggtt_info(struct xe_gt *gt)
	 */
	xe_ggtt_shift_nodes(tile->mem.ggtt, start);

	if (xe_sriov_vf_migration_supported(gt_to_xe(gt))) {
		WRITE_ONCE(gt->sriov.vf.migration.ggtt_need_fixes, false);
		smp_wmb();	/* Ensure above write visible before wake */
		wake_up_all(&gt->sriov.vf.migration.wq);
	}

	return 0;
}

@@ -846,6 +840,13 @@ static void xe_gt_sriov_vf_default_lrcs_hwsp_rebase(struct xe_gt *gt)
		xe_default_lrc_update_memirq_regs_with_address(hwe);
}

static void vf_post_migration_mark_fixups_done(struct xe_gt *gt)
{
	WRITE_ONCE(gt->sriov.vf.migration.ggtt_need_fixes, false);
	smp_wmb();	/* Ensure above write visible before wake */
	wake_up_all(&gt->sriov.vf.migration.wq);
}

static void vf_start_migration_recovery(struct xe_gt *gt)
{
	bool started;
@@ -1380,6 +1381,7 @@ static void vf_post_migration_recovery(struct xe_gt *gt)
	if (err)
		goto fail;

	vf_post_migration_mark_fixups_done(gt);
	vf_post_migration_rearm(gt);

	err = vf_post_migration_resfix_done(gt, marker);
@@ -1514,7 +1516,7 @@ static bool vf_valid_ggtt(struct xe_gt *gt)
}

/**
 * xe_gt_sriov_vf_wait_valid_ggtt() - VF wait for valid GGTT addresses
 * xe_gt_sriov_vf_wait_valid_ggtt() - wait for valid GGTT nodes and address refs
 * @gt: the &xe_gt
 */
void xe_gt_sriov_vf_wait_valid_ggtt(struct xe_gt *gt)
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ struct xe_gt_sriov_vf_migration {
	bool recovery_queued;
	/** @recovery_inprogress: VF post migration recovery in progress */
	bool recovery_inprogress;
	/** @ggtt_need_fixes: VF GGTT needs fixes */
	/** @ggtt_need_fixes: VF GGTT and references to it need fixes */
	bool ggtt_need_fixes;
};