[PATCH 2/2] ARM: move device tree mapping out of linear region

Ard Biesheuvel ardb at kernel.org
Tue Oct 6 12:11:11 EDT 2020


On Tue, 6 Oct 2020 at 17:59, Nicolas Pitre <nico at fluxnic.net> wrote:
>
> On Tue, 6 Oct 2020, Ard Biesheuvel wrote:
>
> > On ARM, setting up the linear region is tricky, given the constraints
> > around placement and alignment of the memblocks, and how the kernel
> > itself as well as the DT are placed in physical memory.
> >
> > Let's simplify matters a bit, by moving the device tree mapping to the
> > top of the address space, right below the fixmap region, and create a
> > read-only mapping for it that is independent of the size of the linear
> > region, and how it is organized.
>
> You say this is below the fixmap region but it is also worth mentioning
> it is right above the vmalloc region, and in doing so we lose the
> vmalloc access overflow guard area.
>

Not entirely,
- in the !LPAE case, we only use 2 out of 4 MB,
- the mapping is read-only, so any stray writes will still be caught.

But I take your point: given the de facto constraints imposed by the
!LPAE case, i.e., that a DT can be at most 1 MB in the general case,
or up to 2 MB but only if it is 1 MB aligned in memory, we could make
the actual size of the permanent mapping dependent on the actual size
of the DT blob, in which case we should be able to preserve 2-3 MB of
the guard region.

> Also you should document your static mapping usage in
> Documentation/arm/memory.rst.
>

Ack. Linus mentioned that too.



More information about the linux-arm-kernel mailing list