From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: stuart.summers@intel.com, francois.dugast@intel.com
Subject: [PATCH v2 3/7] drm/xe: Implement xe_pagefault_reset
Date: Fri, 24 Oct 2025 11:04:10 -0700 [thread overview]
Message-ID: <20251024180414.1379284-4-matthew.brost@intel.com> (raw)
In-Reply-To: <20251024180414.1379284-1-matthew.brost@intel.com>
Squash any pending faults on the GT being reset by setting the GT field
in struct xe_pagefault to NULL.
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_gt.c | 2 ++
drivers/gpu/drm/xe/xe_pagefault.c | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index 89808b33d0a8..e4852c4c90cd 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -49,6 +49,7 @@
#include "xe_map.h"
#include "xe_migrate.h"
#include "xe_mmio.h"
+#include "xe_pagefault.h"
#include "xe_pat.h"
#include "xe_pm.h"
#include "xe_mocs.h"
@@ -849,6 +850,7 @@ static int gt_reset(struct xe_gt *gt)
xe_uc_gucrc_disable(>->uc);
xe_uc_stop_prepare(>->uc);
+ xe_pagefault_reset(gt_to_xe(gt), gt);
xe_gt_pagefault_reset(gt);
xe_uc_stop(>->uc);
diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
index ea3813704242..e3d37e4ee205 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -124,6 +124,24 @@ int xe_pagefault_init(struct xe_device *xe)
return err;
}
+static void xe_pagefault_queue_reset(struct xe_device *xe, struct xe_gt *gt,
+ struct xe_pagefault_queue *pf_queue)
+{
+ u32 i;
+
+ /* Squash all pending faults on the GT */
+
+ spin_lock_irq(&pf_queue->lock);
+ for (i = pf_queue->tail; i != pf_queue->head;
+ i = (i + xe_pagefault_entry_size()) % pf_queue->size) {
+ struct xe_pagefault *pf = pf_queue->data + i;
+
+ if (pf->gt == gt)
+ pf->gt = NULL;
+ }
+ spin_unlock_irq(&pf_queue->lock);
+}
+
/**
* xe_pagefault_reset() - Page fault reset for a GT
* @xe: xe device instance
@@ -134,7 +152,10 @@ int xe_pagefault_init(struct xe_device *xe)
*/
void xe_pagefault_reset(struct xe_device *xe, struct xe_gt *gt)
{
- /* TODO - implement */
+ int i;
+
+ for (i = 0; i < XE_PAGEFAULT_QUEUE_COUNT; ++i)
+ xe_pagefault_queue_reset(xe, gt, xe->usm.pf_queue + i);
}
/**
--
2.34.1
next prev parent reply other threads:[~2025-10-24 18:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 18:04 [PATCH v2 0/7] Pagefault refactor Matthew Brost
2025-10-24 18:04 ` [PATCH v2 1/7] drm/xe: Stub out new pagefault layer Matthew Brost
2025-10-24 18:35 ` Summers, Stuart
2025-10-24 18:04 ` [PATCH v2 2/7] drm/xe: Implement xe_pagefault_init Matthew Brost
2025-10-24 18:55 ` Summers, Stuart
2025-10-24 19:18 ` Matthew Brost
2025-10-24 21:48 ` Matthew Brost
2025-10-24 18:04 ` Matthew Brost [this message]
2025-10-24 18:04 ` [PATCH v2 4/7] drm/xe: Implement xe_pagefault_handler Matthew Brost
2025-10-24 18:04 ` [PATCH v2 5/7] drm/xe: Implement xe_pagefault_queue_work Matthew Brost
2025-10-24 18:04 ` [PATCH v2 6/7] drm/xe: Add xe_guc_pagefault layer Matthew Brost
2025-10-24 18:04 ` [PATCH v2 7/7] drm/xe: Remove unused GT page fault code Matthew Brost
2025-10-24 18:10 ` ✗ CI.checkpatch: warning for Pagefault refactor Patchwork
2025-10-24 18:11 ` ✓ CI.KUnit: success " Patchwork
2025-10-24 19:04 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-10-25 7:17 ` ✗ Xe.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251024180414.1379284-4-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=stuart.summers@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox