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

Merge tag 'drm-xe-fixes-2024-10-24-1' of...

Merge tag 'drm-xe-fixes-2024-10-24-1' of https://gitlab.freedesktop.org/drm/xe/kernel

 into drm-fixes

Driver Changes:
- Increase invalidation timeout to avoid errors in some hosts (Shuicheng)
- Flush worker on timeout (Badal)
- Better handling for force wake failure (Shuicheng)
- Improve argument check on user fence creation (Nirmoy)
- Don't restart parallel queues multiple times on GT reset (Nirmoy)

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

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/trlkoiewtc4x2cyhsxmj3atayyq4zwto4iryea5pvya2ymc3yp@fdx5nhwmiyem
parents e3e1cfe3 cdc21021
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -890,7 +890,7 @@ void xe_device_l2_flush(struct xe_device *xe)
	spin_lock(&gt->global_invl_lock);
	xe_mmio_write32(gt, XE2_GLOBAL_INVAL, 0x1);

	if (xe_mmio_wait32(gt, XE2_GLOBAL_INVAL, 0x1, 0x0, 150, NULL, true))
	if (xe_mmio_wait32(gt, XE2_GLOBAL_INVAL, 0x1, 0x0, 500, NULL, true))
		xe_gt_err_once(gt, "Global invalidation timeout\n");
	spin_unlock(&gt->global_invl_lock);

+9 −3
Original line number Diff line number Diff line
@@ -115,9 +115,15 @@ static int __domain_wait(struct xe_gt *gt, struct xe_force_wake_domain *domain,
			     XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
			     &value, true);
	if (ret)
		xe_gt_notice(gt, "Force wake domain %d failed to ack %s (%pe) reg[%#x] = %#x\n",
		xe_gt_err(gt, "Force wake domain %d failed to ack %s (%pe) reg[%#x] = %#x\n",
			  domain->id, str_wake_sleep(wake), ERR_PTR(ret),
			  domain->reg_ack.addr, value);
	if (value == ~0) {
		xe_gt_err(gt,
			  "Force wake domain %d: %s. MMIO unreliable (forcewake register returns 0xFFFFFFFF)!\n",
			  domain->id, str_wake_sleep(wake));
		ret = -EIO;
	}

	return ret;
}
+18 −0
Original line number Diff line number Diff line
@@ -897,6 +897,24 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,

	ret = wait_event_timeout(ct->g2h_fence_wq, g2h_fence.done, HZ);

	/*
	 * Occasionally it is seen that the G2H worker starts running after a delay of more than
	 * a second even after being queued and activated by the Linux workqueue subsystem. This
	 * leads to G2H timeout error. The root cause of issue lies with scheduling latency of
	 * Lunarlake Hybrid CPU. Issue dissappears if we disable Lunarlake atom cores from BIOS
	 * and this is beyond xe kmd.
	 *
	 * TODO: Drop this change once workqueue scheduling delay issue is fixed on LNL Hybrid CPU.
	 */
	if (!ret) {
		flush_work(&ct->g2h_worker);
		if (g2h_fence.done) {
			xe_gt_warn(gt, "G2H fence %u, action %04x, done\n",
				   g2h_fence.seqno, action[0]);
			ret = 1;
		}
	}

	/*
	 * Ensure we serialize with completion side to prevent UAF with fence going out of scope on
	 * the stack, since we have no clue if it will fire after the timeout before we can erase
+12 −2
Original line number Diff line number Diff line
@@ -1726,8 +1726,13 @@ void xe_guc_submit_stop(struct xe_guc *guc)

	mutex_lock(&guc->submission_state.lock);

	xa_for_each(&guc->submission_state.exec_queue_lookup, index, q)
	xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) {
		/* Prevent redundant attempts to stop parallel queues */
		if (q->guc->id != index)
			continue;

		guc_exec_queue_stop(guc, q);
	}

	mutex_unlock(&guc->submission_state.lock);

@@ -1765,8 +1770,13 @@ int xe_guc_submit_start(struct xe_guc *guc)

	mutex_lock(&guc->submission_state.lock);
	atomic_dec(&guc->submission_state.stopped);
	xa_for_each(&guc->submission_state.exec_queue_lookup, index, q)
	xa_for_each(&guc->submission_state.exec_queue_lookup, index, q) {
		/* Prevent redundant attempts to start parallel queues */
		if (q->guc->id != index)
			continue;

		guc_exec_queue_start(q);
	}
	mutex_unlock(&guc->submission_state.lock);

	wake_up_all(&guc->ct.wq);
+2 −1
Original line number Diff line number Diff line
@@ -54,8 +54,9 @@ static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,
{
	struct xe_user_fence *ufence;
	u64 __user *ptr = u64_to_user_ptr(addr);
	u64 __maybe_unused prefetch_val;

	if (!access_ok(ptr, sizeof(*ptr)))
	if (get_user(prefetch_val, ptr))
		return ERR_PTR(-EFAULT);

	ufence = kzalloc(sizeof(*ufence), GFP_KERNEL);