drm/xe: Print more device information in devcoredump
authorJosé Roberto de Souza <jose.souza@intel.com>
Tue, 23 Jan 2024 20:44:50 +0000 (12:44 -0800)
committerJosé Roberto de Souza <jose.souza@intel.com>
Wed, 24 Jan 2024 19:08:25 +0000 (11:08 -0800)
To properly decode batch buffer Mesa tools needs to know what
platform is this one, for now we can do that with PCI id but
already making it future proof by also printing GTs GMD version.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240123204454.246788-5-jose.souza@intel.com
drivers/gpu/drm/xe/xe_devcoredump.c
drivers/gpu/drm/xe/xe_device.c
drivers/gpu/drm/xe/xe_device.h

index fd74dae292433971091cc79be77730993e0d689c..e701f0d07b6767f847717e6884f7391fdbe794a1 100644 (file)
@@ -63,6 +63,7 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
                                   size_t count, void *data, size_t datalen)
 {
        struct xe_devcoredump *coredump = data;
+       struct xe_device *xe = coredump_to_xe(coredump);
        struct xe_devcoredump_snapshot *ss;
        struct drm_printer p;
        struct drm_print_iterator iter;
@@ -89,6 +90,7 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
        drm_printf(&p, "Snapshot time: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
        ts = ktime_to_timespec64(ss->boot_time);
        drm_printf(&p, "Uptime: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
+       xe_device_snapshot_print(xe, &p);
 
        drm_printf(&p, "\n**** GuC CT ****\n");
        xe_guc_ct_snapshot_print(coredump->snapshot.ct, &p);
index ab417f4f7d2a771b18f708cb79e7b68b719fe127..6faa7865b1aabcc852a29443d62364e46b71ef79 100644 (file)
@@ -727,3 +727,23 @@ void xe_device_mem_access_put(struct xe_device *xe)
 
        xe_assert(xe, ref >= 0);
 }
+
+void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p)
+{
+       struct xe_gt *gt;
+       u8 id;
+
+       drm_printf(p, "PCI ID: 0x%04x\n", xe->info.devid);
+       drm_printf(p, "PCI revision: 0x%02x\n", xe->info.revid);
+
+       for_each_gt(gt, xe, id) {
+               drm_printf(p, "GT id: %u\n", id);
+               drm_printf(p, "\tType: %s\n",
+                          gt->info.type == XE_GT_TYPE_MAIN ? "main" : "media");
+               drm_printf(p, "\tIP ver: %u.%u.%u\n",
+                          REG_FIELD_GET(GMD_ID_ARCH_MASK, gt->info.gmdid),
+                          REG_FIELD_GET(GMD_ID_RELEASE_MASK, gt->info.gmdid),
+                          REG_FIELD_GET(GMD_ID_REVID, gt->info.gmdid));
+               drm_printf(p, "\tCS reference clock: %u\n", gt->info.reference_clock);
+       }
+}
index af8ac2e9e270956ed4027a4ebe2cc2b6e07e082d..270124da1e00e65dd1455765127942763c38efcc 100644 (file)
@@ -175,4 +175,6 @@ static inline bool xe_device_has_memirq(struct xe_device *xe)
 
 u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size);
 
+void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p);
+
 #endif