The branch main has been updated by dumbbell:

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

commit 7bf93680807e518853262f3f961f88eb8ec03c83
Author:     Jean-Sébastien Pédron <[email protected]>
AuthorDate: 2026-03-04 20:34:37 +0000
Commit:     Jean-Sébastien Pédron <[email protected]>
CommitDate: 2026-04-06 19:28:09 +0000

    linuxkpi: Define `CONFIG_PGTABLE_LEVELS`
    
    This is a kernel configuration constant that is expected to be defined.
    
    The DRM generic code started to use it in Linux 6.11.
    
    Reviewed by:    bz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D55733
---
 sys/compat/linuxkpi/common/include/linux/kconfig.h | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kconfig.h 
b/sys/compat/linuxkpi/common/include/linux/kconfig.h
index c1d186b56e1f..529d41991900 100644
--- a/sys/compat/linuxkpi/common/include/linux/kconfig.h
+++ b/sys/compat/linuxkpi/common/include/linux/kconfig.h
@@ -73,4 +73,39 @@
 #define        IS_REACHABLE(_x)        (IS_BUILTIN(_x) || \
                                    (IS_MODULE(_x) && IS_BUILTIN(MODULE)))
 
+/*
+ * On Linux, the CONFIG_PGTABLE_LEVELS value is defined by the config/build
+ * system. Here, we take the per-architecture default value defined in
+ * `arch/$ARCH/Kconfig` files upstream.
+ */
+#if defined(__amd64__)
+
+#define        CONFIG_PGTABLE_LEVELS   4
+
+#elif defined(__aarch64__)
+
+#define        CONFIG_PGTABLE_LEVELS   4
+
+#elif defined(__i386__)
+
+#define        CONFIG_PGTABLE_LEVELS   2
+
+#elif defined(__powerpc__)
+
+#if defined(__powerpc64__)
+#define        CONFIG_PGTABLE_LEVELS   4
+#else
+#define        CONFIG_PGTABLE_LEVELS   2
+#endif
+
+#elif defined(__riscv)
+
+#if defined(__riscv_xlen) && __riscv_xlen == 64
+#define        CONFIG_PGTABLE_LEVELS   5
+#else
+#define        CONFIG_PGTABLE_LEVELS   2
+#endif
+
+#endif
+
 #endif /* _LINUXKPI_LINUX_KCONFIG_H_ */

Reply via email to