diff mbox series

[3/6] accel/ivpu: Fix missing MMU events if file_priv is unbound

Message ID 20250129125636.1047413-4-jacek.lawrynowicz@linux.intel.com (mailing list archive)
State New
Headers show
Series accel/ivpu: Changes for 6.15 | expand

Commit Message

Jacek Lawrynowicz Jan. 29, 2025, 12:56 p.m. UTC
From: Karol Wachowski <karol.wachowski@intel.com>

Move the ivpu_mmu_discard_events() function to the common portion of
the abort work function. This ensures it is called only once, even if
there are no faulty contexts in context_xa, to guarantee that MMU events
are discarded and new events are not missed.

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_job.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jeffrey Hugo Jan. 31, 2025, 6:45 p.m. UTC | #1
On 1/29/2025 5:56 AM, Jacek Lawrynowicz wrote:
> From: Karol Wachowski <karol.wachowski@intel.com>
> 
> Move the ivpu_mmu_discard_events() function to the common portion of
> the abort work function. This ensures it is called only once, even if
> there are no faulty contexts in context_xa, to guarantee that MMU events
> are discarded and new events are not missed.
> 
> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
> Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/accel/ivpu/ivpu_job.c b/drivers/accel/ivpu/ivpu_job.c
index 3c162ac41a1dc..c1013f511efa6 100644
--- a/drivers/accel/ivpu/ivpu_job.c
+++ b/drivers/accel/ivpu/ivpu_job.c
@@ -375,7 +375,6 @@  void ivpu_context_abort_locked(struct ivpu_file_priv *file_priv)
 		ivpu_jsm_context_release(vdev, file_priv->ctx.id);
 
 	ivpu_mmu_disable_ssid_events(vdev, file_priv->ctx.id);
-	ivpu_mmu_discard_events(vdev);
 
 	file_priv->aborted = true;
 }
@@ -980,6 +979,13 @@  void ivpu_context_abort_work_fn(struct work_struct *work)
 	}
 	mutex_unlock(&vdev->context_list_lock);
 
+	/*
+	 * We will not receive new MMU event interrupts until existing events are discarded
+	 * however, we want to discard these events only after aborting the faulty context
+	 * to avoid generating new faults from that context
+	 */
+	ivpu_mmu_discard_events(vdev);
+
 	if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
 		return;