Commit 5ed53446 authored by Rodrigo Vivi's avatar Rodrigo Vivi

drm/xe: Add GuC CT snapshot to xe_devcoredump.

Let's start to move our existent logs to devcoredump one by
one. Any format change should come on follow-up work.

v2: Rebase and add the dma_fence locking annotation here.
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
parent 513260df
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "xe_engine.h" #include "xe_engine.h"
#include "xe_gt.h" #include "xe_gt.h"
#include "xe_guc_ct.h"
/** /**
* DOC: Xe device coredump * DOC: Xe device coredump
...@@ -48,6 +49,11 @@ static struct xe_device *coredump_to_xe(const struct xe_devcoredump *coredump) ...@@ -48,6 +49,11 @@ static struct xe_device *coredump_to_xe(const struct xe_devcoredump *coredump)
return container_of(coredump, struct xe_device, devcoredump); return container_of(coredump, struct xe_device, devcoredump);
} }
static struct xe_guc *engine_to_guc(struct xe_engine *e)
{
return &e->gt->uc.guc;
}
static ssize_t xe_devcoredump_read(char *buffer, loff_t offset, static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
size_t count, void *data, size_t datalen) size_t count, void *data, size_t datalen)
{ {
...@@ -78,6 +84,9 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset, ...@@ -78,6 +84,9 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
ts = ktime_to_timespec64(ss->boot_time); ts = ktime_to_timespec64(ss->boot_time);
drm_printf(&p, "Uptime: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec); drm_printf(&p, "Uptime: %lld.%09ld\n", ts.tv_sec, ts.tv_nsec);
drm_printf(&p, "\n**** GuC CT ****\n");
xe_guc_ct_snapshot_print(coredump->snapshot.ct, &p);
return count - iter.remain; return count - iter.remain;
} }
...@@ -89,6 +98,8 @@ static void xe_devcoredump_free(void *data) ...@@ -89,6 +98,8 @@ static void xe_devcoredump_free(void *data)
if (!data || !coredump_to_xe(coredump)) if (!data || !coredump_to_xe(coredump))
return; return;
xe_guc_ct_snapshot_free(coredump->snapshot.ct);
coredump->captured = false; coredump->captured = false;
drm_info(&coredump_to_xe(coredump)->drm, drm_info(&coredump_to_xe(coredump)->drm,
"Xe device coredump has been deleted.\n"); "Xe device coredump has been deleted.\n");
...@@ -98,9 +109,15 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump, ...@@ -98,9 +109,15 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
struct xe_engine *e) struct xe_engine *e)
{ {
struct xe_devcoredump_snapshot *ss = &coredump->snapshot; struct xe_devcoredump_snapshot *ss = &coredump->snapshot;
struct xe_guc *guc = engine_to_guc(e);
bool cookie;
ss->snapshot_time = ktime_get_real(); ss->snapshot_time = ktime_get_real();
ss->boot_time = ktime_get_boottime(); ss->boot_time = ktime_get_boottime();
cookie = dma_fence_begin_signalling();
coredump->snapshot.ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
dma_fence_end_signalling(cookie);
} }
/** /**
......
...@@ -23,6 +23,10 @@ struct xe_devcoredump_snapshot { ...@@ -23,6 +23,10 @@ struct xe_devcoredump_snapshot {
ktime_t snapshot_time; ktime_t snapshot_time;
/** @boot_time: Relative boot time so the uptime can be calculated. */ /** @boot_time: Relative boot time so the uptime can be calculated. */
ktime_t boot_time; ktime_t boot_time;
/* GuC snapshots */
/** @ct_snapshot: GuC CT snapshot */
struct xe_guc_ct_snapshot *ct;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment