Skip to content

Commit 05d013a

Browse files
committed
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
1 parent d1af2ab commit 05d013a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎arch/mips/mm/init.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ static inline void __init mem_init_free_highmem(void)
446446

447447
void __init mem_init(void)
448448
{
449+
/*
450+
* When _PFN_SHIFT is greater than PAGE_SHIFT we won't have enough PTE
451+
* bits to hold a full 32b physical address on MIPS32 systems.
452+
*/
453+
BUILD_BUG_ON(IS_ENABLED(CONFIG_32BIT) && (_PFN_SHIFT > PAGE_SHIFT));
454+
449455
#ifdef CONFIG_HIGHMEM
450456
#ifdef CONFIG_DISCONTIGMEM
451457
#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"

0 commit comments

Comments
 (0)