From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Cc: Ard Biesheuvel <ardb@kernel.org>,
linux-kernel@vger.kernel.org,
Arvind Sankar <nivedita@alum.mit.edu>
Subject: [PATCH 06/25] efi/x86: rename efi_is_native() to efi_is_mixed()
Date: Tue, 24 Dec 2019 16:10:06 +0100 [thread overview]
Message-ID: <20191224151025.32482-7-ardb@kernel.org> (raw)
In-Reply-To: <20191224151025.32482-1-ardb@kernel.org>
The ARM architecture does not permit combining 32-bit and 64-bit code
at the same privilege level, and so EFI mixed mode is strictly a x86
concept.
In preparation of turning the 32/64 bit distinction in shared stub
code to a native vs mixed one, refactor x86's current use of the
helper function efi_is_native() into efi_is_mixed().
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/include/asm/efi.h | 10 ++++++----
arch/x86/platform/efi/efi.c | 8 ++++----
arch/x86/platform/efi/efi_64.c | 4 ++--
arch/x86/platform/efi/quirks.c | 2 +-
4 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 59c19e0b6027..6094e7f49a99 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -153,17 +153,19 @@ extern u64 efi_setup;
#ifdef CONFIG_EFI
-static inline bool efi_is_native(void)
+static inline bool efi_is_mixed(void)
{
- return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
+ if (!IS_ENABLED(CONFIG_EFI_MIXED))
+ return false;
+ return IS_ENABLED(CONFIG_X86_64) && !efi_enabled(EFI_64BIT);
}
static inline bool efi_runtime_supported(void)
{
- if (efi_is_native())
+ if (!efi_is_mixed())
return true;
- if (IS_ENABLED(CONFIG_EFI_MIXED) && !efi_enabled(EFI_OLD_MEMMAP))
+ if (!efi_enabled(EFI_OLD_MEMMAP))
return true;
return false;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 38d44f36d5ed..e188b7ce0796 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -828,7 +828,7 @@ static bool should_map_region(efi_memory_desc_t *md)
* Map all of RAM so that we can access arguments in the 1:1
* mapping when making EFI runtime calls.
*/
- if (IS_ENABLED(CONFIG_EFI_MIXED) && !efi_is_native()) {
+ if (efi_is_mixed()) {
if (md->type == EFI_CONVENTIONAL_MEMORY ||
md->type == EFI_LOADER_DATA ||
md->type == EFI_LOADER_CODE)
@@ -903,7 +903,7 @@ static void __init kexec_enter_virtual_mode(void)
* kexec kernel because in the initial boot something else might
* have been mapped at these virtual addresses.
*/
- if (!efi_is_native() || efi_enabled(EFI_OLD_MEMMAP)) {
+ if (efi_is_mixed() || efi_enabled(EFI_OLD_MEMMAP)) {
efi_memmap_unmap();
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
return;
@@ -1040,7 +1040,7 @@ static void __init __efi_enter_virtual_mode(void)
efi_sync_low_kernel_mappings();
- if (efi_is_native()) {
+ if (!efi_is_mixed()) {
status = phys_efi_set_virtual_address_map(
efi.memmap.desc_size * count,
efi.memmap.desc_size,
@@ -1071,7 +1071,7 @@ static void __init __efi_enter_virtual_mode(void)
*/
efi.runtime_version = efi_systab.hdr.revision;
- if (efi_is_native())
+ if (!efi_is_mixed())
efi_native_runtime_setup();
else
efi_thunk_runtime_setup();
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 08ce8177c3af..885e50a707a6 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -388,7 +388,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
* text and allocate a new stack because we can't rely on the
* stack pointer being < 4GB.
*/
- if (!IS_ENABLED(CONFIG_EFI_MIXED) || efi_is_native())
+ if (!efi_is_mixed())
return 0;
page = alloc_page(GFP_KERNEL|__GFP_DMA32);
@@ -449,7 +449,7 @@ void __init efi_map_region(efi_memory_desc_t *md)
* booting in EFI mixed mode, because even though we may be
* running a 64-bit kernel, the firmware may only be 32-bit.
*/
- if (!efi_is_native () && IS_ENABLED(CONFIG_EFI_MIXED)) {
+ if (efi_is_mixed()) {
md->virt_addr = md->phys_addr;
return;
}
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 7675cf754d90..84d7176983d2 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -397,7 +397,7 @@ static void __init efi_unmap_pages(efi_memory_desc_t *md)
* EFI runtime calls, hence don't unmap EFI boot services code/data
* regions.
*/
- if (!efi_is_native())
+ if (efi_is_mixed())
return;
if (kernel_unmap_pages_in_pgd(pgd, pa, md->num_pages))
--
2.20.1
next prev parent reply other threads:[~2019-12-24 15:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-24 15:10 [GIT PULL 00/25] EFI updates for v5.6 Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 01/25] efi/gop: Remove bogus packed attribute from GOP structures Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 02/25] efi/gop: Remove unused typedef Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 03/25] efi/gop: Convert GOP structures to typedef and cleanup some types Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 04/25] efi/gop: Unify 32/64-bit functions Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 05/25] efi/libstub: remove unused __efi_call_early() macro Ard Biesheuvel
2019-12-24 15:10 ` Ard Biesheuvel [this message]
2019-12-24 15:10 ` [PATCH 07/25] efi/libstub: use a helper to iterate over a EFI handle array Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 08/25] efi/libstub: extend native protocol definitions with mixed_mode aliases Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 09/25] efi/libstub: distinguish between native/mixed not 32/64 bit Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 10/25] efi/libstub: drop explicit 32/64-bit protocol definitions Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 11/25] efi/libstub: use stricter typing for firmware function pointers Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 12/25] efi/libstub: annotate firmware routines as __efiapi Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 13/25] efi/libstub/x86: avoid thunking for native firmware calls Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 14/25] efi/libstub: avoid protocol wrapper for file I/O routines Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 15/25] efi/libstub: get rid of 'sys_table_arg' macro parameter Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 16/25] efi/libstub: unify the efi_char16_printk implementations Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 17/25] efi/libstub/x86: drop __efi_early() export and efi_config struct Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 18/25] efi/libstub: drop sys_table_arg from printk routines Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 19/25] efi/libstub: remove 'sys_table_arg' from all function prototypes Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 20/25] efi/libstub/x86: work around page freeing issue in mixed mode Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 21/25] efi/libstub: drop protocol argument from efi_call_proto() macro Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 22/25] efi/libstub: drop 'table' argument from efi_table_attr() macro Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 23/25] efi/libstub: rename efi_call_early/_runtime macros to be more intuitive Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 24/25] efi/libstub: tidy up types and names of global cmdline variables Ard Biesheuvel
2019-12-24 15:10 ` [PATCH 25/25] efi/libstub/x86: avoid globals to store context during mixed mode calls Ard Biesheuvel
2019-12-25 9:50 ` [GIT PULL 00/25] EFI updates for v5.6 Ingo Molnar
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=20191224151025.32482-7-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nivedita@alum.mit.edu \
--cc=tglx@linutronix.de \
/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).