git: 5bc46055983d - stable/15 - linuxkpi: Define `CONFIG_PGTABLE_LEVELS`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Apr 2026 21:08:31 UTC
The branch stable/15 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=5bc46055983ddf24570b3fdd2a66e6a50947e990
commit 5bc46055983ddf24570b3fdd2a66e6a50947e990
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-03-04 20:34:37 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-04-22 20:57:01 +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
(cherry picked from commit 7bf93680807e518853262f3f961f88eb8ec03c83)
---
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_ */