Lines Matching full:snapshot
69 struct xe_guc_log_snapshot *snapshot; in xe_guc_log_snapshot_alloc() local
73 snapshot = kzalloc(sizeof(*snapshot), atomic ? GFP_ATOMIC : GFP_KERNEL); in xe_guc_log_snapshot_alloc()
74 if (!snapshot) in xe_guc_log_snapshot_alloc()
82 snapshot->size = log->bo->size; in xe_guc_log_snapshot_alloc()
83 snapshot->num_chunks = DIV_ROUND_UP(snapshot->size, GUC_LOG_CHUNK_SIZE); in xe_guc_log_snapshot_alloc()
85 snapshot->copy = kcalloc(snapshot->num_chunks, sizeof(*snapshot->copy), in xe_guc_log_snapshot_alloc()
87 if (!snapshot->copy) in xe_guc_log_snapshot_alloc()
90 remain = snapshot->size; in xe_guc_log_snapshot_alloc()
91 for (i = 0; i < snapshot->num_chunks; i++) { in xe_guc_log_snapshot_alloc()
94 snapshot->copy[i] = kmalloc(size, atomic ? GFP_ATOMIC : GFP_KERNEL); in xe_guc_log_snapshot_alloc()
95 if (!snapshot->copy[i]) in xe_guc_log_snapshot_alloc()
100 return snapshot; in xe_guc_log_snapshot_alloc()
103 for (i = 0; i < snapshot->num_chunks; i++) in xe_guc_log_snapshot_alloc()
104 kfree(snapshot->copy[i]); in xe_guc_log_snapshot_alloc()
105 kfree(snapshot->copy); in xe_guc_log_snapshot_alloc()
107 kfree(snapshot); in xe_guc_log_snapshot_alloc()
112 * xe_guc_log_snapshot_free - free a previously captured GuC log snapshot
113 * @snapshot: GuC log snapshot structure
115 * Return: pointer to a newly allocated snapshot object or null if out of memory. Caller is
116 * responsible for calling xe_guc_log_snapshot_free when done with the snapshot.
118 void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot) in xe_guc_log_snapshot_free() argument
122 if (!snapshot) in xe_guc_log_snapshot_free()
125 if (snapshot->copy) { in xe_guc_log_snapshot_free()
126 for (i = 0; i < snapshot->num_chunks; i++) in xe_guc_log_snapshot_free()
127 kfree(snapshot->copy[i]); in xe_guc_log_snapshot_free()
128 kfree(snapshot->copy); in xe_guc_log_snapshot_free()
131 kfree(snapshot); in xe_guc_log_snapshot_free()
135 * xe_guc_log_snapshot_capture - create a new snapshot copy the GuC log for later dumping
139 * Return: pointer to a newly allocated snapshot object or null if out of memory. Caller is
140 * responsible for calling xe_guc_log_snapshot_free when done with the snapshot.
144 struct xe_guc_log_snapshot *snapshot; in xe_guc_log_snapshot_capture() local
155 snapshot = xe_guc_log_snapshot_alloc(log, atomic); in xe_guc_log_snapshot_capture()
156 if (!snapshot) in xe_guc_log_snapshot_capture()
159 remain = snapshot->size; in xe_guc_log_snapshot_capture()
160 for (i = 0; i < snapshot->num_chunks; i++) { in xe_guc_log_snapshot_capture()
163 xe_map_memcpy_from(xe, snapshot->copy[i], &log->bo->vmap, in xe_guc_log_snapshot_capture()
170 snapshot->stamp = ~0ULL; in xe_guc_log_snapshot_capture()
172 snapshot->stamp = xe_mmio_read64_2x32(>->mmio, GUC_PMTIMESTAMP_LO); in xe_guc_log_snapshot_capture()
175 snapshot->ktime = ktime_get_boottime_ns(); in xe_guc_log_snapshot_capture()
176 snapshot->level = log->level; in xe_guc_log_snapshot_capture()
177 snapshot->ver_found = guc->fw.versions.found[XE_UC_FW_VER_RELEASE]; in xe_guc_log_snapshot_capture()
178 snapshot->ver_want = guc->fw.versions.wanted; in xe_guc_log_snapshot_capture()
179 snapshot->path = guc->fw.path; in xe_guc_log_snapshot_capture()
181 return snapshot; in xe_guc_log_snapshot_capture()
186 * @snapshot: a snapshot of the GuC log
189 void xe_guc_log_snapshot_print(struct xe_guc_log_snapshot *snapshot, struct drm_printer *p) in xe_guc_log_snapshot_print() argument
194 if (!snapshot) { in xe_guc_log_snapshot_print()
195 drm_printf(p, "GuC log snapshot not allocated!\n"); in xe_guc_log_snapshot_print()
199 drm_printf(p, "GuC firmware: %s\n", snapshot->path); in xe_guc_log_snapshot_print()
201 snapshot->ver_found.major, snapshot->ver_found.minor, snapshot->ver_found.patch, in xe_guc_log_snapshot_print()
202 snapshot->ver_want.major, snapshot->ver_want.minor, snapshot->ver_want.patch); in xe_guc_log_snapshot_print()
203 drm_printf(p, "Kernel timestamp: 0x%08llX [%llu]\n", snapshot->ktime, snapshot->ktime); in xe_guc_log_snapshot_print()
204 drm_printf(p, "GuC timestamp: 0x%08llX [%llu]\n", snapshot->stamp, snapshot->stamp); in xe_guc_log_snapshot_print()
205 drm_printf(p, "Log level: %u\n", snapshot->level); in xe_guc_log_snapshot_print()
207 drm_printf(p, "[LOG].length: 0x%zx\n", snapshot->size); in xe_guc_log_snapshot_print()
208 remain = snapshot->size; in xe_guc_log_snapshot_print()
209 for (i = 0; i < snapshot->num_chunks; i++) { in xe_guc_log_snapshot_print()
212 char suffix = i == snapshot->num_chunks - 1 ? '\n' : 0; in xe_guc_log_snapshot_print()
214 xe_print_blob_ascii85(p, prefix, suffix, snapshot->copy[i], 0, size); in xe_guc_log_snapshot_print()
244 struct xe_guc_log_snapshot *snapshot; in xe_guc_log_print() local
248 snapshot = xe_guc_log_snapshot_capture(log, false); in xe_guc_log_print()
250 xe_guc_log_snapshot_print(snapshot, p); in xe_guc_log_print()
251 xe_guc_log_snapshot_free(snapshot); in xe_guc_log_print()