diff mbox series

[v8,4/6] drm/xe/xe_gt_pagefault: Add address_type field to pagefaults

Message ID 20250313183415.133863-5-jonathan.cavitt@intel.com (mailing list archive)
State New
Headers show
Series drm/xe/xe_vm: Implement xe_vm_get_property_ioctl | expand

Commit Message

Jonathan Cavitt March 13, 2025, 6:34 p.m. UTC
Add a new field to the xe_pagefault struct, address_type, that tracks
the type of fault the pagefault incurred.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c       | 3 +++
 drivers/gpu/drm/xe/xe_gt_pagefault_types.h | 2 ++
 2 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 06a4e3fdc11d..e67ee7ac3df7 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -206,11 +206,13 @@  static int handle_pagefault(struct xe_gt *gt, struct xe_gt_pagefault *pf)
 
 	vma = lookup_vma(vm, pf->page_addr);
 	if (!vma) {
+		pf->address_type = DRM_XE_FAULT_ADDRESS_TYPE_NONE_EXT;
 		err = -EINVAL;
 		goto unlock_vm;
 	}
 
 	if (xe_vma_read_only(vma) && pf->access_type != XE_GT_PAGEFAULT_ACCESS_TYPE_READ) {
+		pf->address_type = DRM_XE_FAULT_ADDRESS_TYPE_WRITE_INVALID_EXT;
 		err = -EPERM;
 		goto unlock_vm;
 	}
@@ -284,6 +286,7 @@  static bool get_pagefault(struct pf_queue *pf_queue, struct xe_gt_pagefault *pf)
 		pf->asid = FIELD_GET(PFD_ASID, desc->dw1);
 		pf->vfid = FIELD_GET(PFD_VFID, desc->dw2);
 		pf->access_type = FIELD_GET(PFD_ACCESS_TYPE, desc->dw2);
+		pf->address_type = 0;
 		pf->fault_type = FIELD_GET(PFD_FAULT_TYPE, desc->dw2);
 		pf->page_addr = (u64)(FIELD_GET(PFD_VIRTUAL_ADDR_HI, desc->dw3)) <<
 			PFD_VIRTUAL_ADDR_HI_SHIFT;
diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault_types.h b/drivers/gpu/drm/xe/xe_gt_pagefault_types.h
index 90b7085d4b8e..68721973debb 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault_types.h
@@ -24,6 +24,8 @@  struct xe_gt_pagefault {
 	 * from xe_gt_pagefault_access_type
 	 */
 	u8 access_type;
+	/** @address_type: Type of address access that resulted in fault */
+	u8 address_type;
 	/**
 	 * @fault_type: fault type of this pagefault, as a value
 	 * from xe_gt_pagefault_fault_type