Commit 4d33ed64 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-xe-fixes-2025-07-17' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes



Driver Changes:
- SR-IOV fixes for GT reset and TLB invalidation
- Fix memory copy direction during migration
- Fix alignment check on migration
- Fix MOCS and page fault init order to correctly
  account for topology

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/6jworkgupwstm4v7aohbuzod3dyz4u7pyfhshr5ifgf2xisgj3@cm5em5yupjiu
parents 4399e3d8 5c244eec
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -417,6 +417,8 @@ int xe_gt_init_early(struct xe_gt *gt)
	if (err)
		return err;

	xe_mocs_init_early(gt);

	return 0;
}

@@ -630,17 +632,15 @@ int xe_gt_init(struct xe_gt *gt)
	if (err)
		return err;

	err = xe_gt_pagefault_init(gt);
	err = xe_gt_sysfs_init(gt);
	if (err)
		return err;

	xe_mocs_init_early(gt);

	err = xe_gt_sysfs_init(gt);
	err = gt_fw_domain_init(gt);
	if (err)
		return err;

	err = gt_fw_domain_init(gt);
	err = xe_gt_pagefault_init(gt);
	if (err)
		return err;

@@ -839,6 +839,9 @@ static int gt_reset(struct xe_gt *gt)
		goto err_out;
	}

	if (IS_SRIOV_PF(gt_to_xe(gt)))
		xe_gt_sriov_pf_stop_prepare(gt);

	xe_uc_gucrc_disable(&gt->uc);
	xe_uc_stop_prepare(&gt->uc);
	xe_gt_pagefault_reset(gt);
+19 −0
Original line number Diff line number Diff line
@@ -172,6 +172,25 @@ void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid)
	pf_clear_vf_scratch_regs(gt, vfid);
}

static void pf_cancel_restart(struct xe_gt *gt)
{
	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));

	if (cancel_work_sync(&gt->sriov.pf.workers.restart))
		xe_gt_sriov_dbg_verbose(gt, "pending restart canceled!\n");
}

/**
 * xe_gt_sriov_pf_stop_prepare() - Prepare to stop SR-IOV support.
 * @gt: the &xe_gt
 *
 * This function can only be called on the PF.
 */
void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt)
{
	pf_cancel_restart(gt);
}

static void pf_restart(struct xe_gt *gt)
{
	struct xe_device *xe = gt_to_xe(gt);
+5 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt);
int xe_gt_sriov_pf_init(struct xe_gt *gt);
void xe_gt_sriov_pf_init_hw(struct xe_gt *gt);
void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid);
void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt);
void xe_gt_sriov_pf_restart(struct xe_gt *gt);
#else
static inline int xe_gt_sriov_pf_init_early(struct xe_gt *gt)
@@ -29,6 +30,10 @@ static inline void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)
{
}

static inline void xe_gt_sriov_pf_stop_prepare(struct xe_gt *gt)
{
}

static inline void xe_gt_sriov_pf_restart(struct xe_gt *gt)
{
}
+27 −0
Original line number Diff line number Diff line
@@ -2364,6 +2364,21 @@ int xe_gt_sriov_pf_config_restore(struct xe_gt *gt, unsigned int vfid,
	return err;
}

static int pf_push_self_config(struct xe_gt *gt)
{
	int err;

	err = pf_push_full_vf_config(gt, PFID);
	if (err) {
		xe_gt_sriov_err(gt, "Failed to push self configuration (%pe)\n",
				ERR_PTR(err));
		return err;
	}

	xe_gt_sriov_dbg_verbose(gt, "self configuration completed\n");
	return 0;
}

static void fini_config(void *arg)
{
	struct xe_gt *gt = arg;
@@ -2387,9 +2402,17 @@ static void fini_config(void *arg)
int xe_gt_sriov_pf_config_init(struct xe_gt *gt)
{
	struct xe_device *xe = gt_to_xe(gt);
	int err;

	xe_gt_assert(gt, IS_SRIOV_PF(xe));

	mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
	err = pf_push_self_config(gt);
	mutex_unlock(xe_gt_sriov_pf_master_mutex(gt));

	if (err)
		return err;

	return devm_add_action_or_reset(xe->drm.dev, fini_config, gt);
}

@@ -2407,6 +2430,10 @@ void xe_gt_sriov_pf_config_restart(struct xe_gt *gt)
	unsigned int n, total_vfs = xe_sriov_pf_get_totalvfs(gt_to_xe(gt));
	unsigned int fail = 0, skip = 0;

	mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
	pf_push_self_config(gt);
	mutex_unlock(xe_gt_sriov_pf_master_mutex(gt));

	for (n = 1; n <= total_vfs; n++) {
		if (xe_gt_sriov_pf_config_is_empty(gt, n))
			skip++;
+3 −3
Original line number Diff line number Diff line
@@ -1817,8 +1817,8 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
	xe_bo_assert_held(bo);

	/* Use bounce buffer for small access and unaligned access */
	if (len & XE_CACHELINE_MASK ||
	    ((uintptr_t)buf | offset) & XE_CACHELINE_MASK) {
	if (!IS_ALIGNED(len, XE_CACHELINE_BYTES) ||
	    !IS_ALIGNED((unsigned long)buf + offset, XE_CACHELINE_BYTES)) {
		int buf_offset = 0;

		/*
@@ -1848,7 +1848,7 @@ int xe_migrate_access_memory(struct xe_migrate *m, struct xe_bo *bo,
				err = xe_migrate_access_memory(m, bo,
							       offset & ~XE_CACHELINE_MASK,
							       (void *)ptr,
							       sizeof(bounce), 0);
							       sizeof(bounce), write);
				if (err)
					return err;
			} else {
Loading