Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
	jonathan.cavitt@intel.com, joonas.lahtinen@linux.intel.com,
	matthew.brost@intel.com, jianxun.zhang@intel.com,
	shuicheng.lin@intel.com, dri-devel@lists.freedesktop.org,
	Michal.Wajdeczko@intel.com, michal.mrozek@intel.com,
	raag.jadav@intel.com, ivan.briano@intel.com,
	matthew.auld@intel.com, dafna.hirschfeld@intel.com
Subject: [PATCH v34 3/6] drm/xe/xe_pagefault: Track address precision per pagefault
Date: Fri, 13 Feb 2026 22:34:14 +0000	[thread overview]
Message-ID: <20260213223410.99613-11-jonathan.cavitt@intel.com> (raw)
In-Reply-To: <20260213223410.99613-8-jonathan.cavitt@intel.com>

Add an address precision field to the pagefault consumer.  This captures
the fact that pagefaults are reported on a SZ_4K granularity by GuC,
meaning the reported pagefault address is only the address of the page
where the faulting access occurred rather than the exact address of the
fault.  This field is necessary in case more reporters are added where
the granularity can be different.

v2:
- Keep u8 values together (Matt Brost)

Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_pagefault.c   |  1 +
 drivers/gpu/drm/xe/xe_pagefault.c       |  2 ++
 drivers/gpu/drm/xe/xe_pagefault_types.h | 11 ++++++-----
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c b/drivers/gpu/drm/xe/xe_guc_pagefault.c
index 8eaa1dfc1e66..ba6f8e8dbe4e 100644
--- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
@@ -75,6 +75,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
 				      << PFD_VIRTUAL_ADDR_HI_SHIFT) |
 		(FIELD_GET(PFD_VIRTUAL_ADDR_LO, msg[2]) <<
 		 PFD_VIRTUAL_ADDR_LO_SHIFT);
+	pf.consumer.addr_precision = 12;
 	pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]);
 	pf.consumer.access_type = FIELD_GET(PFD_ACCESS_TYPE, msg[2]);
 	if (FIELD_GET(XE2_PFD_TRVA_FAULT, msg[0]))
diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c
index 47b6a7628dc1..c2ab183ded29 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -233,6 +233,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
 					       pf->consumer.engine_class_instance);
 	xe_gt_info(pf->gt, "\n\tASID: %d\n"
 		   "\tFaulted Address: 0x%08x%08x\n"
+		   "\tAddress Precision: %lu\n"
 		   "\tFaultType: %lu\n"
 		   "\tAccessType: %d\n"
 		   "\tFaultLevel: %lu\n"
@@ -241,6 +242,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
 		   pf->consumer.asid,
 		   upper_32_bits(pf->consumer.page_addr),
 		   lower_32_bits(pf->consumer.page_addr),
+		   BIT(pf->consumer.addr_precision),
 		   FIELD_GET(XE_PAGEFAULT_TYPE_MASK,
 			     pf->consumer.fault_type_level),
 		   pf->consumer.access_type,
diff --git a/drivers/gpu/drm/xe/xe_pagefault_types.h b/drivers/gpu/drm/xe/xe_pagefault_types.h
index a14725a02f39..ce15fd8f46b5 100644
--- a/drivers/gpu/drm/xe/xe_pagefault_types.h
+++ b/drivers/gpu/drm/xe/xe_pagefault_types.h
@@ -67,6 +67,12 @@ struct xe_pagefault {
 		u64 page_addr;
 		/** @consumer.asid: address space ID */
 		u32 asid;
+		/**
+		 * @consumer.addr_precision: precision of the page fault address.
+		 * u8 rather than u32 to keep compact - actual precision is
+		 * BIT(consumer.addr_precision).  Currently only 12
+		 */
+		u8 addr_precision;
 		/**
 		 * @consumer.access_type: access type, u8 rather than enum to
 		 * keep size compact
@@ -87,11 +93,6 @@ struct xe_pagefault {
 		u8 engine_class_instance;
 #define XE_PAGEFAULT_ENGINE_CLASS_MASK		GENMASK(3, 0)
 #define XE_PAGEFAULT_ENGINE_INSTANCE_MASK	GENMASK(7, 4)
-		/**
-		 * consumer.align: buffer u8 to keep struct aligned to u64.
-		 * Will be used later to store data.
-		 */
-		u8 align;
 		/** consumer.reserved: reserved bits for future expansion */
 		u64 reserved;
 	} consumer;
-- 
2.43.0


  parent reply	other threads:[~2026-02-13 22:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 22:34 [PATCH v34 0/6] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2026-02-13 22:34 ` [PATCH v34 1/6] drm/xe/xe_pagefault: Disallow writes to read-only VMAs Jonathan Cavitt
2026-02-13 22:34 ` [PATCH v34 2/6] drm/xe/xe_pagefault: Pack engine class instance into u8 Jonathan Cavitt
2026-02-17 17:08   ` Matthew Brost
2026-02-13 22:34 ` Jonathan Cavitt [this message]
2026-02-20 23:20   ` [PATCH v34 3/6] drm/xe/xe_pagefault: Track address precision per pagefault Matthew Brost
2026-02-13 22:34 ` [PATCH v34 4/6] drm/xe/uapi: Define drm_xe_vm_get_property Jonathan Cavitt
2026-02-20 23:18   ` Matthew Brost
2026-02-13 22:34 ` [PATCH v34 5/6] drm/xe/xe_vm: Add per VM fault info Jonathan Cavitt
2026-02-13 22:34 ` [PATCH v34 6/6] drm/xe/xe_vm: Implement xe_vm_get_property_ioctl Jonathan Cavitt
2026-02-13 23:25 ` ✗ CI.checkpatch: warning for " Patchwork
2026-02-13 23:27 ` ✓ CI.KUnit: success " Patchwork
2026-02-14  0:24 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-14 23:33 ` ✗ Xe.CI.FULL: failure " 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=20260213223410.99613-11-jonathan.cavitt@intel.com \
    --to=jonathan.cavitt@intel.com \
    --cc=Michal.Wajdeczko@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=dafna.hirschfeld@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ivan.briano@intel.com \
    --cc=jianxun.zhang@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=michal.mrozek@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=saurabhg.gupta@intel.com \
    --cc=shuicheng.lin@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