From patchwork Thu Jun 26 10:09:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 4426861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 438B6BEEAA for ; Thu, 26 Jun 2014 10:12:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 746D42038C for ; Thu, 26 Jun 2014 10:12:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E9FB20381 for ; Thu, 26 Jun 2014 10:12:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X06d1-0007UG-SF; Thu, 26 Jun 2014 10:10:03 +0000 Received: from mail-wi0-f174.google.com ([209.85.212.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X06cg-000728-Cg for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 10:09:43 +0000 Received: by mail-wi0-f174.google.com with SMTP id bs8so719837wib.13 for ; Thu, 26 Jun 2014 03:09:19 -0700 (PDT) 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=PCpRH+4VlWqIryXcCoRIqbS+KH4aEJc+RfnmpMDpQLg=; b=fYybHQEMDeqHm5yf3hA4tK+5Jv9hjh790SVbkGbDhzfZLGhJXb0W/WvBiHqbw3QP7x 2qrMA67tyrk+rk8Lbp+sYemf6rHf9GM2u58K5RS3sT75IBUQtOPYzNwvkHXaPawmMITi rDAI2uFR2GmXdCBzZj9UGoXgQD1snM9iEDvD32JCJdj5daYsbQDpCwLHWPkMY2uVY+Uo hp4roToViaBT1sFKgwWGUs1zuPwsVRuHy9cJYVRb3iNSuFkb/EvPN03yt45QKB+1FEEl QNyxFsdDWx9/6c4qDtTZ0XHA9nMNimplPs2+PsQS1kiPFHZUcfue8X9yUdnb8NlKa4rq IriA== X-Gm-Message-State: ALoCoQnj0TkLWGMl4/yb6f2SlyDurCfHjGSEWzHTeBMU+gS4Se7UeCdKgQZj0W0f83AD5IRzZ4gX X-Received: by 10.180.208.13 with SMTP id ma13mr3074200wic.45.1403777359831; Thu, 26 Jun 2014 03:09:19 -0700 (PDT) Received: from ards-macbook-pro.local ([109.114.99.252]) by mx.google.com with ESMTPSA id ch5sm13450380wjb.18.2014.06.26.03.09.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 03:09:19 -0700 (PDT) From: Ard Biesheuvel To: matt.fleming@intel.com, x86@kernel.org Subject: [PATCH v2 2/2] efi/arm64: preserve FP/SIMD registers on UEFI runtime services calls Date: Thu, 26 Jun 2014 12:09:06 +0200 Message-Id: <1403777346-28629-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1403777346-28629-1-git-send-email-ard.biesheuvel@linaro.org> References: <1403777346-28629-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_030942_621491_43AA1946 X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -0.7 (/) Cc: linux-efi@vger.kernel.org, olivier.martin@arm.com, Ard Biesheuvel , catalin.marinas@arm.com, msalter@redhat.com, leif.lindholm@linaro.org, roy.franz@linaro.org, hpa@zytor.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to the UEFI spec section 2.3.6.4, the use of FP/SIMD instructions is allowed, and should adhere to the AAPCS64 calling convention, which states that 'only the bottom 64 bits of each value stored in registers v8-v15 need to be preserved' (section 5.1.2). This applies equally to UEFI Runtime Services called by the kernel, so make sure the FP/SIMD register file is preserved in this case. Signed-off-by: Ard Biesheuvel Acked-by: Catalin Marinas --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/efi.h | 21 +++++++++++++++++++++ arch/arm64/kernel/efi.c | 14 +------------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a474de346be6..93e11f4d9513 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -299,6 +299,7 @@ config EFI select LIBFDT select UCS2_STRING select EFI_PARAMS_FROM_FDT + select EFI_RUNTIME_WRAPPERS default y help This option provides support for runtime services provided diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h index 5a46c4e7f539..375ba342dca6 100644 --- a/arch/arm64/include/asm/efi.h +++ b/arch/arm64/include/asm/efi.h @@ -2,6 +2,7 @@ #define _ASM_EFI_H #include +#include #ifdef CONFIG_EFI extern void efi_init(void); @@ -11,4 +12,24 @@ extern void efi_idmap_init(void); #define efi_idmap_init() #endif +#define efi_call_virt(f, ...) \ +({ \ + efi_##f##_t *__f = efi.systab->runtime->f; \ + efi_status_t __s; \ + \ + kernel_neon_begin(); \ + __s = __f(__VA_ARGS__); \ + kernel_neon_end(); \ + __s; \ +}) + +#define __efi_call_virt(f, ...) \ +({ \ + efi_##f##_t *__f = efi.systab->runtime->f; \ + \ + kernel_neon_begin(); \ + __f(__VA_ARGS__); \ + kernel_neon_end(); \ +}) + #endif /* _ASM_EFI_H */ diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 14db1f6e8d7f..56c3327bbf79 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -449,19 +449,7 @@ static int __init arm64_enter_virtual_mode(void) /* Set up runtime services function pointers */ runtime = efi.systab->runtime; - efi.get_time = runtime->get_time; - efi.set_time = runtime->set_time; - efi.get_wakeup_time = runtime->get_wakeup_time; - efi.set_wakeup_time = runtime->set_wakeup_time; - efi.get_variable = runtime->get_variable; - efi.get_next_variable = runtime->get_next_variable; - efi.set_variable = runtime->set_variable; - efi.query_variable_info = runtime->query_variable_info; - efi.update_capsule = runtime->update_capsule; - efi.query_capsule_caps = runtime->query_capsule_caps; - efi.get_next_high_mono_count = runtime->get_next_high_mono_count; - efi.reset_system = runtime->reset_system; - + efi_native_runtime_setup(); set_bit(EFI_RUNTIME_SERVICES, &efi.flags); return 0;