aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/init.c
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2019-09-18 22:03:30 +0000
committerPaul Burton <paul.burton@mips.com>2019-09-20 14:55:07 -0700
commit05d013a0366d50f4f0dbebf8c1b22b42020bf49a (patch)
tree69811af11e7de96a88d2aac71356031142b12ada /arch/mips/mm/init.c
parentMIPS: Disable pte_special() for MIPS32 with RiXi (diff)
downloadlinux-dev-05d013a0366d50f4f0dbebf8c1b22b42020bf49a.tar.xz
linux-dev-05d013a0366d50f4f0dbebf8c1b22b42020bf49a.zip
MIPS: Detect bad _PFN_SHIFT values
2 recent commits have fixed issues where _PFN_SHIFT grew too large due to the introduction of too many pgprot bits in our PTEs for some MIPS32 kernel configurations. Tracking down such issues can be tricky, so add a BUILD_BUG_ON() to help. Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org
Diffstat (limited to 'arch/mips/mm/init.c')
-rw-r--r--arch/mips/mm/init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 6fea3b54c961..090fa653dfa9 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -446,6 +446,12 @@ static inline void __init mem_init_free_highmem(void)
void __init mem_init(void)
{
+ /*
+ * When _PFN_SHIFT is greater than PAGE_SHIFT we won't have enough PTE
+ * bits to hold a full 32b physical address on MIPS32 systems.
+ */
+ BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
+
#ifdef CONFIG_HIGHMEM
#ifdef CONFIG_DISCONTIGMEM
#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"