From patchwork Fri Jan 3 11:39:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 206664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A47EC2D0C2 for ; Fri, 3 Jan 2020 11:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F08E21D7D for ; Fri, 3 Jan 2020 11:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578051630; bh=Yy+0Y26bNsBKW5pM0oJe/s001o5+q6lON5VgSvebl0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uFQvTgDDGytMAn3OKwSOriaPgQ53j6NWCJ00zEtoYPrDl/Ek86Czpz/xiS8f5mvLS CQDqhGByzyuWVltegt5IX9S/N+2ytXPt2ERkXvhCOsmeOt6XwtHZFd8Sk73uT2IiUK r7hf2nH295u3KRAPeUELs07sH1suG/6Jso3snPm0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727754AbgACLk3 (ORCPT ); Fri, 3 Jan 2020 06:40:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:39778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727737AbgACLk1 (ORCPT ); Fri, 3 Jan 2020 06:40:27 -0500 Received: from localhost.localdomain (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C66B22314; Fri, 3 Jan 2020 11:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578051626; bh=Yy+0Y26bNsBKW5pM0oJe/s001o5+q6lON5VgSvebl0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2Eexyl5EQImX/YyREv+qTf2pRTcYk0EFNNc1DA+7PteX+s0KvoQH67gnjo1iHzg7 FW+BvYzccW/tnp8/QhqycRdjVam3n8H8op4qpNl8OLrMY4WxNfD79yBdoxP+LeucSg q3ehJSBPeI1vZiSvpB0qOTooI+09HIJ8yGRUEx9U= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Lutomirski , Arvind Sankar , Matthew Garrett Subject: [PATCH 05/20] efi/x86: avoid redundant cast of EFI firmware service pointer Date: Fri, 3 Jan 2020 12:39:38 +0100 Message-Id: <20200103113953.9571-6-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103113953.9571-1-ardb@kernel.org> References: <20200103113953.9571-1-ardb@kernel.org> MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.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 --- 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 b35b5d423e9d..09c3fc468793 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