From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Arvind Sankar <nivedita@alum.mit.edu>,
Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 5/7] efi/x86: avoid redundant cast of EFI firmware service pointer
Date: Sat, 28 Dec 2019 16:21:07 +0100 [thread overview]
Message-ID: <20191228152109.6301-6-ardb@kernel.org> (raw)
In-Reply-To: <20191228152109.6301-1-ardb@kernel.org>
All EFI firmware call prototypes have been annotated as __efiapi,
permitting us to attach attributes regarding the calling convention
by overriding __efiapi to an architecture specific value.
On 32-bit x86, EFI firmware calls use the plain calling convention
where all arguments are passed via the stack, and cleaned up by the
caller. Let's add this to the __efiapi definition so we no longer
need to cast the function pointers before invoking them.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/include/asm/efi.h | 8 +-------
include/linux/efi.h | 4 +++-
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 9f4281aae779..9d25fc2ddc50 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -51,13 +51,7 @@ extern asmlinkage unsigned long efi_call_phys(void *, ...);
})
-/*
- * Wrap all the virtual calls in a way that forces the parameters on the stack.
- */
-#define arch_efi_call_virt(p, f, args...) \
-({ \
- ((efi_##f##_t __attribute__((regparm(0)))*) p->f)(args); \
-})
+#define arch_efi_call_virt(p, f, args...) p->f(args)
#define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size)
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 726673e98990..952c1659dfd9 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -48,8 +48,10 @@ typedef u16 efi_char16_t; /* UNICODE character */
typedef u64 efi_physical_addr_t;
typedef void *efi_handle_t;
-#ifdef CONFIG_X86_64
+#if defined(CONFIG_X86_64)
#define __efiapi __attribute__((ms_abi))
+#elif defined(CONFIG_X86_32)
+#define __efiapi __attribute__((regparm(0)))
#else
#define __efiapi
#endif
--
2.17.1
next prev parent reply other threads:[~2019-12-28 15:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-28 15:21 [PATCH 0/7] efi: more fixes and general cleanups for v5.6 Ard Biesheuvel
2019-12-28 15:21 ` [PATCH 1/7] efi/libstub: fix boot argument handling in mixed mode entry code Ard Biesheuvel
2019-12-28 15:21 ` [PATCH 2/7] efi/libstub: use correct system table pointer in mixed mode efi_free() Ard Biesheuvel
2019-12-28 15:21 ` [PATCH 3/7] efi/x86: re-disable RT services for 32-bit kernels running on 64-bit EFI Ard Biesheuvel
2019-12-28 15:21 ` [PATCH 4/7] efi/x86: map the entire EFI vendor string before copying it Ard Biesheuvel
2019-12-28 15:21 ` Ard Biesheuvel [this message]
2019-12-28 15:21 ` [PATCH 6/7] efi/x86: merge two near identical versions of efi_runtime_init() Ard Biesheuvel
2019-12-28 15:21 ` [PATCH 7/7] efi/x86: clean up efi_systab_init() routine for legibility 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=20191228152109.6301-6-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=hdegoede@redhat.com \
--cc=linux-efi@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nivedita@alum.mit.edu \
/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.