Re: [PATCH v4 2/2] drm/xe/vm: Add srcid to xe_vm_get_property_ioctl fault report
From: Matthew Brost
Date: Tue Jun 23 2026 - 01:14:03 EST
On Thu, Jun 18, 2026 at 11:33:12PM +0800, Jonathan Cavitt wrote:
> Add the SRCID of the faulting hardware unit to the return of the
> xe_vm_get_property_ioctl fault report.
>
> v2:
> - Readd pad check, as the pad in the ioctl struct was not changed
> (jcavitt)
>
> v3:
> - Squash SRCID with ASID to keep the struct compact (Matthew)
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@xxxxxxxxx>
> Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
Reviewed-by: Matthew Brost <matthew.brost@xxxxxxxxx>
But also please get an ack from UMD teams.
Matt
> Cc: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxxx>
> Cc: Simona Vetter <simona@xxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
> ---
> drivers/gpu/drm/xe/xe_vm.c | 8 ++++++++
> drivers/gpu/drm/xe/xe_vm_types.h | 2 ++
> include/uapi/drm/xe_drm.h | 4 ++--
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 080c2fff0e95..acbfce19b356 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -636,6 +636,7 @@ void xe_vm_add_fault_entry_pf(struct xe_vm *vm, struct xe_pagefault *pf)
> pf->consumer.fault_type_level);
> e->fault_level = FIELD_GET(XE_PAGEFAULT_LEVEL_MASK,
> pf->consumer.fault_type_level);
> + e->srcid = FIELD_GET(XE_PAGEFAULT_SRCID_MASK, pf->consumer.id);
>
> list_add_tail(&e->list, &vm->faults.list);
> vm->faults.len++;
> @@ -4108,6 +4109,11 @@ static u8 xe_to_user_fault_level(u8 fault_level)
> return fault_level;
> }
>
> +static u8 xe_to_user_srcid(u8 srcid)
> +{
> + return srcid;
> +}
> +
> static int fill_faults(struct xe_vm *vm,
> struct drm_xe_vm_get_property *args)
> {
> @@ -4135,6 +4141,8 @@ static int fill_faults(struct xe_vm *vm,
> fault_entry.fault_type = xe_to_user_fault_type(entry->fault_type);
> fault_entry.fault_level = xe_to_user_fault_level(entry->fault_level);
>
> + fault_entry.srcid = xe_to_user_srcid(entry->srcid);
> +
> memcpy(&fault_list[i], &fault_entry, entry_size);
>
> i++;
> diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
> index 635ed29b9a69..e8aea75341cc 100644
> --- a/drivers/gpu/drm/xe/xe_vm_types.h
> +++ b/drivers/gpu/drm/xe/xe_vm_types.h
> @@ -196,6 +196,7 @@ struct xe_device;
> * @access_type: type of address access that resulted in fault
> * @fault_type: type of fault reported
> * @fault_level: fault level of the fault
> + * @srcid: ID of the faulting hardware unit
> */
> struct xe_vm_fault_entry {
> struct list_head list;
> @@ -204,6 +205,7 @@ struct xe_vm_fault_entry {
> u8 access_type;
> u8 fault_type;
> u8 fault_level;
> + u8 srcid;
> };
>
> struct xe_vm {
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 48e9f1fdb78d..2b45b691a032 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -1294,8 +1294,8 @@ struct xe_vm_fault {
> #define FAULT_LEVEL_PML4 3
> #define FAULT_LEVEL_PML5 4
> __u8 fault_level;
> - /** @pad: MBZ */
> - __u8 pad;
> + /** @srcid: ID of the faulting hardware unit */
> + __u8 srcid;
> /** @reserved: MBZ */
> __u64 reserved[4];
> };
> --
> 2.53.0
>