From patchwork Mon Apr 25 20:07:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 66621 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1234334qge; Mon, 25 Apr 2016 13:10:43 -0700 (PDT) X-Received: by 10.98.24.88 with SMTP id 85mr18656674pfy.52.1461615043039; Mon, 25 Apr 2016 13:10:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kk8si4609836pab.26.2016.04.25.13.10.42; Mon, 25 Apr 2016 13:10:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeblueprint-co-uk.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965058AbcDYUKl (ORCPT + 29 others); Mon, 25 Apr 2016 16:10:41 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38867 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964773AbcDYUIX (ORCPT ); Mon, 25 Apr 2016 16:08:23 -0400 Received: by mail-wm0-f53.google.com with SMTP id u206so145172609wme.1 for ; Mon, 25 Apr 2016 13:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4Mil9BYKiX6Od3H3HysypTOy/qpsB1zCLJEiTlpn19g=; b=Tj7D/lRf/sOr3W3bb0OaMfu0Oqi+ZLPLjV3pGAGep4i77ZH7/9kJ2bFVRyRV9G4rcw baqpfKzsvya7mx4KCDkhh1ZeDHhb6WL8n84y2MrzFl4h4WgozK3M4DJYEBfa6yve8eEL bG9ePPVxAqgP94JCg4dJrILZzZ2feun/Xi/+whRSWEU4mP9gSPD1FJzBp1rti7Lq2CK8 cTIPoyJZ6raZW1Ea863h+iYV3vWBUfzbxUwhqo8coCi3z7m7OhOC5EsVZ+WxTvZWD/1P Y2p4ivZdt2bS2pbBCKYWYQZuce+drXKNdmHiKdbJWx6k+AbV8Yc3Y3WPdBf9istXffEB vLUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4Mil9BYKiX6Od3H3HysypTOy/qpsB1zCLJEiTlpn19g=; b=gcMmL4kboswSbyi1toxUhluZge7VWSfpXRMLoao7JwprPFFHal3fXpoThNv8NLXFkW LKUStd4zOZFpBgsFkXBFEINT+rSZUy136Hutkbf2gzN250z9KfWYHJ8ZiI09D6IhKMFU IAsjn1HlaceCOoIHhXgNzwIwOyEWhqprNMTWe9WXk7E7OFZyF8oW4/mQ4VjlxuMdeljg 60x3OEnPMHs5oOKxTF2wUiqAVhpDWp/4SjCwxYutg87145VE8g79a0H7u5rfWs1Mnh0u dyzarWS2PXV0IwQDzDXPMHxV37a2vpW9+iKP+w+eJAHxYcaP0zxD040Xl3ae7GMaDaF0 FBiA== X-Gm-Message-State: AOPr4FVPPT+OtP9D9EWMaffRhUOqLZmgECJ1nUsvWLTXoL1EzVi/TpbXy0YIJ8i5LqRXvg== X-Received: by 10.28.130.133 with SMTP id e127mr15248025wmd.48.1461614901802; Mon, 25 Apr 2016 13:08:21 -0700 (PDT) Received: from localhost (bcdc58e5.skybroadband.com. [188.220.88.229]) by smtp.gmail.com with ESMTPSA id ry15sm25201233wjb.19.2016.04.25.13.08.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 13:08:21 -0700 (PDT) From: Matt Fleming To: Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Mark Rutland , Ard Biesheuvel , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Matt Fleming , Catalin Marinas , Ingo Molnar , Leif Lindholm , Ricardo Neri , Russell King , Will Deacon Subject: [PATCH 34/40] x86/efi: Move to generic {__,}efi_call_virt Date: Mon, 25 Apr 2016 21:07:06 +0100 Message-Id: <1461614832-17633-35-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> References: <1461614832-17633-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Rutland Now there's a common template for {__,}efi_call_virt, remove the duplicate logic from the x86 efi code. Signed-off-by: Mark Rutland Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: Leif Lindholm Cc: Russell King Cc: Will Deacon Cc: Ricardo Neri Signed-off-by: Matt Fleming --- arch/x86/include/asm/efi.h | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) -- 2.7.3 diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 8747abe8872f..fb085ce00bd2 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h @@ -33,28 +33,16 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); +#define arch_efi_call_virt_setup() kernel_fpu_begin() +#define arch_efi_call_virt_teardown() kernel_fpu_end() + /* * Wrap all the virtual calls in a way that forces the parameters on the stack. */ - -/* Use this macro if your virtual returns a non-void value */ -#define efi_call_virt(f, args...) \ -({ \ - efi_status_t __s; \ - kernel_fpu_begin(); \ - __s = ((efi_##f##_t __attribute__((regparm(0)))*) \ - efi.systab->runtime->f)(args); \ - kernel_fpu_end(); \ - __s; \ -}) - -/* Use this macro if your virtual call does not return any value */ -#define __efi_call_virt(f, args...) \ +#define arch_efi_call_virt(f, args...) \ ({ \ - kernel_fpu_begin(); \ ((efi_##f##_t __attribute__((regparm(0)))*) \ efi.systab->runtime->f)(args); \ - kernel_fpu_end(); \ }) #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) @@ -78,10 +66,8 @@ struct efi_scratch { u64 phys_stack; } __packed; -#define efi_call_virt(f, ...) \ +#define arch_efi_call_virt_setup() \ ({ \ - efi_status_t __s; \ - \ efi_sync_low_kernel_mappings(); \ preempt_disable(); \ __kernel_fpu_begin(); \ @@ -91,9 +77,13 @@ struct efi_scratch { write_cr3((unsigned long)efi_scratch.efi_pgt); \ __flush_tlb_all(); \ } \ - \ - __s = efi_call((void *)efi.systab->runtime->f, __VA_ARGS__); \ - \ +}) + +#define arch_efi_call_virt(f, args...) \ + efi_call((void *)efi.systab->runtime->f, args) \ + +#define arch_efi_call_virt_teardown() \ +({ \ if (efi_scratch.use_pgd) { \ write_cr3(efi_scratch.prev_cr3); \ __flush_tlb_all(); \ @@ -101,15 +91,8 @@ struct efi_scratch { \ __kernel_fpu_end(); \ preempt_enable(); \ - __s; \ }) -/* - * All X86_64 virt calls return non-void values. Thus, use non-void call for - * virt calls that would be void on X86_32. - */ -#define __efi_call_virt(f, args...) efi_call_virt(f, args) - extern void __iomem *__init efi_ioremap(unsigned long addr, unsigned long size, u32 type, u64 attribute);