From: Ard Biesheuvel <ardb@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Nicolas Pitre <nico@fluxnic.net>,
Linus Walleij <linus.walleij@linaro.org>,
Russell King <linux@armlinux.org.uk>,
Rob Herring <robh+dt@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH v2 0/2] ARM: move FDT mapping out of linear region
Date: Wed, 7 Oct 2020 10:39:42 +0200 [thread overview]
Message-ID: <20201007083944.27910-1-ardb@kernel.org> (raw)
For the ARM kernel, setting up the kernel's virtual address space at boot
is tricky, given the risk of collision between 1:1 mapped regions and
virtually remapped regions. There is also a concern regarding the exact
mapping attributes that are needed for each region, which differs between
ARM architecture revisions, UP vs SMP etc
For this reason, the kernel VA space is set up in two stages: at early
boot, only the kernel itself and the DT are mapped using section mappings
and later on, all existing mappings are torn down except the one covering
the first memblock covering the kernel, and remapped again using the full
fledged mapping routines that can map at page granularity and use all the
right mapping attributes.
There are cases where this may result in the DT getting unmapped at
this point, and not remapped again. For instance, if the first memblock
is not PMD aligned, we will align it up, and mark the memory below it
as MEMBLOCK_NOMAP, to avoid having to allocate page tables to create
the mapping before we have a mapped memblock to allocate from. If the
DT happens to reside in this region, it will not be mapped at all when
the permanent kernel VA mappings are in place, resulting in crashes.
As we happen to have a 4 MB hole in the kernel VA space (between the
end of the VMALLOC space and the start of the FIXMAP region), let's
use it to create a permanent, read-only mapping of the DT that is not
affected by any such issues.
Changes since v1:
- bump the start of the fixmap region by 512 KB so we still have a full
guard region even on LPAE builds, which will use the entire 4 MB window
for the read-only mapping of the DT
- update Documentation/arm/memory.rst accordingly
- add Linus's ack
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Rob Herring <robh+dt@kernel.org>
Ard Biesheuvel (2):
ARM: centralize phys-to-virt conversion of DT/ATAGS address
ARM: move device tree mapping out of linear region
Documentation/arm/memory.rst | 7 ++++++-
arch/arm/include/asm/fixmap.h | 2 +-
arch/arm/include/asm/memory.h | 5 +++++
arch/arm/include/asm/prom.h | 4 ++--
arch/arm/kernel/atags.h | 4 ++--
arch/arm/kernel/atags_parse.c | 6 +++---
arch/arm/kernel/devtree.c | 6 +++---
arch/arm/kernel/head.S | 5 ++---
arch/arm/kernel/setup.c | 19 ++++++++++++++-----
arch/arm/mm/init.c | 1 -
arch/arm/mm/mmu.c | 20 ++++++++++++++------
arch/arm/mm/pv-fixup-asm.S | 4 ++--
12 files changed, 54 insertions(+), 29 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-10-07 8:41 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 8:39 Ard Biesheuvel [this message]
2020-10-07 8:39 ` [PATCH v2 1/2] ARM: centralize phys-to-virt conversion of DT/ATAGS address Ard Biesheuvel
2020-10-07 15:28 ` Nicolas Pitre
2020-10-07 8:39 ` [PATCH v2 2/2] ARM: move device tree mapping out of linear region Ard Biesheuvel
2020-10-07 15:28 ` Nicolas Pitre
2020-10-07 15:32 ` Ard Biesheuvel
2020-10-07 16:38 ` Nicolas Pitre
2020-10-07 16:40 ` Nicolas Pitre
2020-10-07 21:32 ` Russell King - ARM Linux admin
2020-10-07 22:05 ` Nicolas Pitre
[not found] ` <CGME20201028091912eucas1p13fb9cd947faa6bfd79199ea79648b6af@eucas1p1.samsung.com>
2020-10-28 9:19 ` Marek Szyprowski
2020-10-28 9:19 ` Marek Szyprowski
2020-10-28 9:22 ` Ard Biesheuvel
2020-10-28 9:22 ` Ard Biesheuvel
2020-10-28 9:24 ` Ard Biesheuvel
2020-10-28 9:24 ` Ard Biesheuvel
2020-10-28 9:43 ` Marek Szyprowski
2020-10-28 9:43 ` Marek Szyprowski
2020-10-28 12:05 ` Joel Stanley
2020-10-28 12:05 ` Joel Stanley
2020-10-28 12:52 ` Ard Biesheuvel
2020-10-28 12:52 ` Ard Biesheuvel
2020-10-28 12:59 ` Joel Stanley
2020-10-28 12:59 ` Joel Stanley
2020-10-28 13:00 ` Ard Biesheuvel
2020-10-28 13:00 ` Ard Biesheuvel
2020-10-28 13:06 ` Joel Stanley
2020-10-28 13:06 ` Joel Stanley
2020-10-28 13:00 ` Russell King - ARM Linux admin
2020-10-28 13:00 ` Russell King - ARM Linux admin
2020-10-28 13:04 ` Ard Biesheuvel
2020-10-28 13:04 ` Ard Biesheuvel
2020-10-28 13:09 ` Russell King - ARM Linux admin
2020-10-28 13:09 ` Russell King - ARM Linux admin
2020-10-28 13:16 ` Marek Szyprowski
2020-10-28 13:16 ` Marek Szyprowski
2020-10-11 16:39 ` [PATCH v2 0/2] ARM: move FDT " Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201007083944.27910-1-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=nico@fluxnic.net \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.