ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation

Actually in no-MMU SoCs(i.e. i.MXRT) ZERO_PAGE(vaddr) expands to
that in order expands to:
and then virt_to_pfn(0) to:
        ((((unsigned long)(0) - PAGE_OFFSET) >> PAGE_SHIFT) +
where PAGE_OFFSET and PHYS_PFN_OFFSET are the DRAM offset(0x80000000) and
PAGE_SHIFT is 12. This way we obtain 16MB(0x01000000) summed to the base of
When ZERO_PAGE(0) is then used, for example in bio_add_page(), the page
gets an address that is out of DRAM bounds.
So instead of using fake virtual page 0 let's allocate a dedicated
zero_page during paging_init() and assign it to a global 'struct page *
empty_zero_page' the same way mmu.c does and it's the same approach used
in m68k with commit dc068f462179 as discussed here[0]. Then let's move
ZERO_PAGE() definition to the top of pgtable.h to be in common between
mmu.c and nommu.c.


Signed-off-by: Giulio Benetti <>
Reviewed-by: Arnd Bergmann <>
Signed-off-by: Russell King (Oracle) <>
3 files changed