git: e86e4f161e72 - main - linuxkpi: Add <linux/kmsg_dump.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 07 Jan 2026 21:50:27 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=e86e4f161e7232b7ac19af906368c664d6167cdc

commit e86e4f161e7232b7ac19af906368c664d6167cdc
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2025-08-12 22:02:18 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-01-07 21:38:40 +0000

    linuxkpi: Add <linux/kmsg_dump.h>
    
    This header declares register/unregister functions to allow a piece of
    code to tell what function to call in case of a panic. Several panic
    handlers may be registered.
    
    The DRM generic code started to use it in Linux 6.10 as part of the
    panic handler.
    
    Reviewed by:    bz, christos
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D54492
---
 .../linuxkpi/common/include/linux/kmsg_dump.h      | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kmsg_dump.h b/sys/compat/linuxkpi/common/include/linux/kmsg_dump.h
new file mode 100644
index 000000000000..25f96b304f59
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/kmsg_dump.h
@@ -0,0 +1,51 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2025-2026 The FreeBSD Foundation
+ * Copyright (c) 2025-2026 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
+ *
+ * This software was developed by Jean-Sébastien Pédron under sponsorship
+ * from the FreeBSD Foundation.
+ */
+
+#ifndef _LINUXKPI_LINUX_KMSG_DUMP_H_
+#define	_LINUXKPI_LINUX_KMSG_DUMP_H_
+
+#include <linux/errno.h>
+#include <linux/list.h>
+
+#include <linux/kernel.h> /* For pr_debug() */
+
+enum kmsg_dump_reason {
+	KMSG_DUMP_UNDEF,
+	KMSG_DUMP_PANIC,
+	KMSG_DUMP_OOPS,
+	KMSG_DUMP_EMERG,
+	KMSG_DUMP_SHUTDOWN,
+	KMSG_DUMP_MAX
+};
+
+struct kmsg_dumper {
+	struct list_head list;
+	void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
+	enum kmsg_dump_reason max_reason;
+	bool registered;
+};
+
+static inline int
+kmsg_dump_register(struct kmsg_dumper *dumper)
+{
+	pr_debug("TODO");
+
+	return (-EINVAL);
+}
+
+static inline int
+kmsg_dump_unregister(struct kmsg_dumper *dumper)
+{
+	pr_debug("TODO");
+
+	return (-EINVAL);
+}
+
+#endif