[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c22886e4-d6b0-4f57-8fdb-91814dd8b8c9@app.fastmail.com>
Date: Fri, 04 Nov 2022 21:16:19 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Giulio Benetti" <giulio.benetti@...ettiengineering.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: "Russell King" <linux@...linux.org.uk>,
"Anshuman Khandual" <anshuman.khandual@....com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Kefeng Wang" <wangkefeng.wang@...wei.com>,
"Russell King" <rmk+kernel@...linux.org.uk>,
"Will Deacon" <will@...nel.org>
Subject: Re: [PATCH v2 1/2] ARM: mm: fix no-MMU ZERO_PAGE() implementation
On Wed, Oct 19, 2022, at 00:25, Giulio Benetti wrote:
> Actually in no-MMU SoCs(i.e. i.MXRT) ZERO_PAGE(vaddr) expands to
> ```
> virt_to_page(0)
> ```
> that in order expands to:
> ```
> pfn_to_page(virt_to_pfn(0))
> ```
> and then virt_to_pfn(0) to:
> ```
> #define virt_to_pfn(0) \
> ((((unsigned long)(0) - PAGE_OFFSET) >> PAGE_SHIFT) + \
> PHYS_PFN_OFFSET)
> ```
> 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
> DRAM(0x80000000).
> 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.
>
> [0]:
> https://lore.kernel.org/linux-m68k/2a462b23-5b8e-bbf4-ec7d-778434a3b9d7@google.com/T/#m1266ceb63ad140743174d6b3070364d3c9a5179b
>
> Signed-off-by: Giulio Benetti <giulio.benetti@...ettiengineering.com>
Reviewed-by: Arnd Bergmann <arnd@...db.de>
Powered by blists - more mailing lists