[RFC 15/15] drm/xe/pt: Set NC PTE bit for VMAs ineligible for access counting

Himal Prasad Ghimiray
2026-03-18T07:10:47Z

Set XE_PPGTT_PTE_NC on PTEs for VMAs that can't benefit from access
counter migration hints, avoiding wasteful slot allocation.

Bspec: 67095
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
drivers/gpu/drm/xe/regs/xe_gtt_defs.h | 2 +-
drivers/gpu/drm/xe/xe_pt.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/regs/xe_gtt_defs.h b/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
index 4d83461e538b..ace3cbcc13d8 100644
--- a/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
+++ b/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
@@ -28,11 +28,11 @@
#define XE_GGTT_PTE_DM BIT_ULL(1)
#define XE_USM_PPGTT_PTE_AE BIT_ULL(10)
#define XE_PPGTT_PTE_DM BIT_ULL(11)
+#define XE_PPGTT_PTE_NC BIT_ULL(5)
#define XE_PDE_64K BIT_ULL(6)
#define XE_PTE_PS64 BIT_ULL(8)
#define XE_PTE_NULL BIT_ULL(9)

#define XE_PAGE_PRESENT BIT_ULL(0)
#define XE_PAGE_RW BIT_ULL(1)
-
#endif
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
index 2d9ce2c4cb4f..cc8dcdb6649a 100644
--- a/drivers/gpu/drm/xe/xe_pt.c
+++ b/drivers/gpu/drm/xe/xe_pt.c
@@ -755,6 +755,17 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma,
XE_USM_PPGTT_PTE_AE : 0;
}

+ if (!xe_vma_supports_access_ctr(xe, vma, tile)) {
+ xe_walk.default_vram_pte |= XE_PPGTT_PTE_NC;
+ xe_walk.default_system_pte |= XE_PPGTT_PTE_NC;
+ }
+
+ if (range) {
+ xe_walk.default_vram_pte |= XE_PPGTT_PTE_NC;
+ if (!range->base.pages.flags.migrate_devmem)
+ xe_walk.default_system_pte |= XE_PPGTT_PTE_NC;
+ }
+
xe_walk.default_vram_pte |= XE_PPGTT_PTE_DM;
xe_walk.dma_offset = bo ? vram_region_gpu_offset(bo->ttm.resource) : 0;
if (!range)
--
2.34.1