[PATCH v9 4/6] drm/xe/xe_gt_pagefault: Add address_type field to pagefaults
Jonathan Cavitt
jonathan.cavitt at intel.com
Tue Mar 18 17:11:31 UTC 2025
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 at 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 --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 37b4ab5135a8..483820be4e0a 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -207,11 +207,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;
}
@@ -285,6 +287,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 55c598c4a1bc..87ed7f54e050 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault_types.h
@@ -26,6 +26,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
--
2.43.0
More information about the Intel-xe
mailing list