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