From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 00/10] arm64: stable UEFI mappings for kexec
Date: Thu, 6 Nov 2014 15:13:16 +0100 [thread overview]
Message-ID: <1415283206-14713-1-git-send-email-ard.biesheuvel@linaro.org> (raw)
This is v2 of the series to update the UEFI memory map handling for the arm64
architecture so that:
- virtual mappings of UEFI Runtime Services are stable across kexec
- userland mappings via /dev/mem use cache attributes that are compatible with
the memory type of the UEFI memory map entry
- code that can be reused for 32-bit ARM is moved to a common area.
Changes since v2 are primarily the move of reusable infrastructure to
drivers/firmware/efi/virtmap.c, and the newly added handling of /dev/mem
mappings.
The main premise of these patches is that, in order to support kexec, we need
to add code to the kernel that is able to deal with the state of the firmware
after SetVirtualAddressMap() [SVAM] has been called. However, if we are going to
deal with that anyway, why not make that the default state, and have only a
single code path for both cases.
This means SVAM() needs to move to the stub, and hence the code that invents
the virtual layout needs to move with it. The result is that the kernel proper
is entered with the virt_addr members of all EFI_MEMORY_RUNTIME regions
assigned, and the mapping installed into the firmware. The kernel proper needs
to set up the page tables, and switch to them while performing the runtime
services calls. Note that there is also an efi_to_phys() to translate the values
of the fw_vendor and tables fields of the EFI system table. Again, this is
something we need to do anyway under kexec, or we end up handing over state
between one kernel and the next, which implies different code paths between
non-kexec and kexec.
The layout is chosen such that it used the userland half of the virtual address
space (TTBR0), which means no additional alignment or reservation is required
to ensure that it will always be available.
One thing that may stand out is the reordering of the memory map. The reason
for doing this is that we can use the same memory map as input to SVAM(). The
alternative is allocating memory for it using boot services, but that clutters
up the existing logic a bit between getting the memory map, populating the fdt,
and loop again if it didn't fit.
Ard Biesheuvel (10):
arm64/mm: add explicit struct_mm argument to __create_mapping()
arm64/mm: add create_pgd_mapping() to create private page tables
efi: split off remapping code from efi_config_init()
efi: add common infrastructure for stub-installed virtual mapping
arm64/efi: move SetVirtualAddressMap() to UEFI stub
arm64/efi: remove free_boot_services() and friends
arm64/efi: remove idmap manipulations from UEFI code
arm64/efi: use UEFI memory map unconditionally if available
arm64/efi: ignore unusable regions instead of reserving them
arm64/efi: improve /dev/mem mmap() handling under UEFI
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/efi.h | 18 +-
arch/arm64/include/asm/mmu.h | 5 +-
arch/arm64/include/asm/pgtable.h | 5 +
arch/arm64/kernel/efi.c | 351 ++++++-------------------------------
arch/arm64/kernel/setup.c | 2 +-
arch/arm64/mm/mmu.c | 78 +++++----
drivers/firmware/efi/Kconfig | 3 +
drivers/firmware/efi/Makefile | 1 +
drivers/firmware/efi/efi.c | 49 ++++--
drivers/firmware/efi/libstub/fdt.c | 107 ++++++++++-
drivers/firmware/efi/virtmap.c | 224 +++++++++++++++++++++++
include/linux/efi.h | 17 +-
13 files changed, 496 insertions(+), 365 deletions(-)
create mode 100644 drivers/firmware/efi/virtmap.c
--
1.8.3.2
next reply other threads:[~2014-11-06 14:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 14:13 Ard Biesheuvel [this message]
2014-11-06 14:13 ` [PATCH v2 01/10] arm64/mm: add explicit struct_mm argument to __create_mapping() Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 02/10] arm64/mm: add create_pgd_mapping() to create private page tables Ard Biesheuvel
2014-11-07 15:08 ` Steve Capper
2014-11-07 15:12 ` Ard Biesheuvel
2014-11-07 15:21 ` Steve Capper
2014-11-06 14:13 ` [PATCH v2 03/10] efi: split off remapping code from efi_config_init() Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 04/10] efi: add common infrastructure for stub-installed virtual mapping Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 05/10] arm64/efi: move SetVirtualAddressMap() to UEFI stub Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 06/10] arm64/efi: remove free_boot_services() and friends Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 07/10] arm64/efi: remove idmap manipulations from UEFI code Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 08/10] arm64/efi: use UEFI memory map unconditionally if available Ard Biesheuvel
2014-11-06 14:13 ` [PATCH v2 09/10] arm64/efi: ignore unusable regions instead of reserving them Ard Biesheuvel
2014-11-10 4:11 ` Mark Salter
2014-11-10 7:31 ` Ard Biesheuvel
2014-11-11 15:42 ` Mark Salter
2014-11-11 17:12 ` Mark Salter
2014-11-11 17:44 ` Mark Rutland
2014-11-11 17:55 ` Ard Biesheuvel
2014-11-11 18:39 ` Mark Rutland
2014-11-11 18:23 ` Mark Salter
2014-11-06 14:13 ` [PATCH v2 10/10] arm64/efi: improve /dev/mem mmap() handling under UEFI 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=1415283206-14713-1-git-send-email-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).