|
6 | 6 | #include "xe_guc_log.h"
|
7 | 7 |
|
8 | 8 | #include <drm/drm_managed.h>
|
| 9 | +#include <linux/vmalloc.h> |
9 | 10 |
|
10 | 11 | #include "xe_bo.h"
|
| 12 | +#include "xe_devcoredump.h" |
11 | 13 | #include "xe_gt.h"
|
| 14 | +#include "xe_gt_printk.h" |
12 | 15 | #include "xe_map.h"
|
13 | 16 | #include "xe_module.h"
|
14 | 17 |
|
@@ -49,32 +52,35 @@ static size_t guc_log_size(void)
|
49 | 52 | CAPTURE_BUFFER_SIZE;
|
50 | 53 | }
|
51 | 54 |
|
| 55 | +/** |
| 56 | + * xe_guc_log_print - dump a copy of the GuC log to some useful location |
| 57 | + * @log: GuC log structure |
| 58 | + * @p: the printer object to output to |
| 59 | + */ |
52 | 60 | void xe_guc_log_print(struct xe_guc_log *log, struct drm_printer *p)
|
53 | 61 | {
|
54 | 62 | struct xe_device *xe = log_to_xe(log);
|
55 | 63 | size_t size;
|
56 |
| - int i, j; |
| 64 | + void *copy; |
57 | 65 |
|
58 |
| - xe_assert(xe, log->bo); |
| 66 | + if (!log->bo) { |
| 67 | + drm_puts(p, "GuC log buffer not allocated"); |
| 68 | + return; |
| 69 | + } |
59 | 70 |
|
60 | 71 | size = log->bo->size;
|
61 | 72 |
|
62 |
| -#define DW_PER_READ 128 |
63 |
| - xe_assert(xe, !(size % (DW_PER_READ * sizeof(u32)))); |
64 |
| - for (i = 0; i < size / sizeof(u32); i += DW_PER_READ) { |
65 |
| - u32 read[DW_PER_READ]; |
66 |
| - |
67 |
| - xe_map_memcpy_from(xe, read, &log->bo->vmap, i * sizeof(u32), |
68 |
| - DW_PER_READ * sizeof(u32)); |
69 |
| -#define DW_PER_PRINT 4 |
70 |
| - for (j = 0; j < DW_PER_READ / DW_PER_PRINT; ++j) { |
71 |
| - u32 *print = read + j * DW_PER_PRINT; |
72 |
| - |
73 |
| - drm_printf(p, "0x%08x 0x%08x 0x%08x 0x%08x\n", |
74 |
| - *(print + 0), *(print + 1), |
75 |
| - *(print + 2), *(print + 3)); |
76 |
| - } |
| 73 | + copy = vmalloc(size); |
| 74 | + if (!copy) { |
| 75 | + drm_printf(p, "Failed to allocate %zu", size); |
| 76 | + return; |
77 | 77 | }
|
| 78 | + |
| 79 | + xe_map_memcpy_from(xe, copy, &log->bo->vmap, 0, size); |
| 80 | + |
| 81 | + xe_print_blob_ascii85(p, "Log data", copy, 0, size); |
| 82 | + |
| 83 | + vfree(copy); |
78 | 84 | }
|
79 | 85 |
|
80 | 86 | int xe_guc_log_init(struct xe_guc_log *log)
|
|
0 commit comments