1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2020-2024 Intel Corporation
6 #include <linux/devcoredump.h>
7 #include <linux/firmware.h>
9 #include "ivpu_coredump.h"
12 #include "vpu_boot_api.h"
14 #define CRASH_DUMP_HEADER "Intel NPU crash dump"
15 #define CRASH_DUMP_HEADERS_SIZE SZ_4K
17 void ivpu_dev_coredump(struct ivpu_device
*vdev
)
19 struct drm_print_iterator pi
= {};
24 coredump_size
= CRASH_DUMP_HEADERS_SIZE
+ FW_VERSION_HEADER_SIZE
+
25 ivpu_bo_size(vdev
->fw
->mem_log_crit
) + ivpu_bo_size(vdev
->fw
->mem_log_verb
);
26 coredump
= vmalloc(coredump_size
);
31 pi
.remain
= coredump_size
;
32 p
= drm_coredump_printer(&pi
);
34 drm_printf(&p
, "%s\n", CRASH_DUMP_HEADER
);
35 drm_printf(&p
, "FW version: %s\n", vdev
->fw
->version
);
36 ivpu_fw_log_print(vdev
, false, &p
);
38 dev_coredumpv(vdev
->drm
.dev
, coredump
, pi
.offset
, GFP_KERNEL
);