Add SRCID information to pagefault struct for the purpose of reporting
the hardware unit that resulted in the pagefault.

Signed-off-by: Jonathan Cavitt <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Thomas Hellström <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Simona Vetter <[email protected]>
---
 drivers/gpu/drm/xe/xe_guc_pagefault.c   | 1 +
 drivers/gpu/drm/xe/xe_pagefault.c       | 6 ++++--
 drivers/gpu/drm/xe/xe_pagefault_types.h | 4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_pagefault.c 
b/drivers/gpu/drm/xe/xe_guc_pagefault.c
index 607e32392f46..17cb7f359261 100644
--- a/drivers/gpu/drm/xe/xe_guc_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_guc_pagefault.c
@@ -91,6 +91,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, 
u32 len)
                                   FIELD_GET(PFD_FAULT_TYPE, msg[2]));
        pf.consumer.engine_class = FIELD_GET(PFD_ENG_CLASS, msg[0]);
        pf.consumer.engine_instance = FIELD_GET(PFD_ENG_INSTANCE, msg[0]);
+       pf.consumer.srcid = FIELD_GET(PFD_SRC_ID, msg[0]);
 
        pf.producer.private = guc;
        pf.producer.ops = &guc_pagefault_ops;
diff --git a/drivers/gpu/drm/xe/xe_pagefault.c 
b/drivers/gpu/drm/xe/xe_pagefault.c
index dd3c068e1a39..42b682ba5f9b 100644
--- a/drivers/gpu/drm/xe/xe_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_pagefault.c
@@ -248,7 +248,8 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
                   "\tAccessType: %lu\n"
                   "\tFaultLevel: %lu\n"
                   "\tEngineClass: %d %s\n"
-                  "\tEngineInstance: %d\n",
+                  "\tEngineInstance: %d\n"
+                  "\tSRCID: 0x%02x\n",
                   pf->consumer.asid,
                   upper_32_bits(pf->consumer.page_addr),
                   lower_32_bits(pf->consumer.page_addr),
@@ -260,7 +261,8 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
                             pf->consumer.fault_type_level),
                   pf->consumer.engine_class,
                   xe_hw_engine_class_to_str(pf->consumer.engine_class),
-                  pf->consumer.engine_instance);
+                  pf->consumer.engine_instance,
+                  pf->consumer.srcid);
 }
 
 static void xe_pagefault_save_to_vm(struct xe_device *xe, struct xe_pagefault 
*pf)
diff --git a/drivers/gpu/drm/xe/xe_pagefault_types.h 
b/drivers/gpu/drm/xe/xe_pagefault_types.h
index c4ee625b93dd..60cc269aeea3 100644
--- a/drivers/gpu/drm/xe/xe_pagefault_types.h
+++ b/drivers/gpu/drm/xe/xe_pagefault_types.h
@@ -86,8 +86,10 @@ struct xe_pagefault {
                u8 engine_class;
                /** @consumer.engine_instance: engine instance */
                u8 engine_instance;
+               /** @consumer.srcid: ID of hardware unit producing fault */
+               u8 srcid;
                /** @consumer.reserved: reserved bits for future expansion */
-               u64 reserved;
+               u8 reserved[7];
        } consumer;
        /**
         * @producer: State for the producer (i.e., HW/FW interface). Populated
-- 
2.53.0

Reply via email to