From patchwork Tue Feb 27 11:34:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10244861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9384860208 for ; Tue, 27 Feb 2018 11:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86A7528833 for ; Tue, 27 Feb 2018 11:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7984A28845; Tue, 27 Feb 2018 11:35:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7588128833 for ; Tue, 27 Feb 2018 11:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbeB0LfX (ORCPT ); Tue, 27 Feb 2018 06:35:23 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37099 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753139AbeB0LfS (ORCPT ); Tue, 27 Feb 2018 06:35:18 -0500 Received: by mail-wm0-f68.google.com with SMTP id 139so9999726wmn.2 for ; Tue, 27 Feb 2018 03:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dNrNEHXjIAleHHymbH+QKbnbEEBic0KBg6BuLZ+nZ1A=; b=xKXKlt/yBQxeIjaTdevxspl4VbgCajASH1p+LUOHHhIC+OdDbx2d8AWu+kHkuSr8iM FigTpz+s6/wzPiCav2nXF7SXDNQFRuGFZriybhB+HMHEg+zgJYjrCiUE3PWb6NsEB/yf IqGlEQjOvGdfwGw/LYT0r01gC9q0JHQeGdwrDCekyIo1llWrJJ7Wlrhp7O6YUq6Y341j VCutvq8wDoOdnAcYa2+beW00dw9mbE9CRugo250tXDQ6Olzb91UNEbdOkSeFzJ+MwWaB U4GmBAZebalKGOzz+ZDFGC8kjtv+tNjEZveWCjNXL8Q8KotBtWWXxJWqtZGM6TRP7f0w GGfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dNrNEHXjIAleHHymbH+QKbnbEEBic0KBg6BuLZ+nZ1A=; b=fqkjsQQSLdaiaHQ+fJpC9K2DWVL4ssNIFFE71fL4rsRpF0BQp785XLfVE5MDu/FT4p KXqgZxYZLYCZxGzHUw8X+Gn4Nn7vcctH1uQZtLrWLLZxX6B8q7CXxtLwlDwLC8L417jZ zZJJmW9G3pdkAsPFpjCjU55PYOaXs4DdgrNWAwy4Por0vbBG83ZK+cqeFTAQupignPvG UHCLnkcpapmWKNJwPa7Z1YeEQCkCIhI/jq5JueMBHy/haC8iOrVJPZuyyoEno1onKG0n n5jYYlq8X9qc+vbezMqf3DlD6ZorWu8QRSPVAWc9Hv9eaYwxiYlBt+X5qlYRUq6KAW1f PXZQ== X-Gm-Message-State: APf1xPB7jcV5z21JyVEIcG6iPkEcBPANVlS2KtSlj1yos8cFpuxFc48Q /HPSP09uTXbUkMpWOhYG0pUrtg== X-Google-Smtp-Source: AH8x2275FTJDRnpjKOOL8M9gElxl0nm7B8Cu3y5+19MT99eg5SXA93+/rtZdwaxNn8IJY7X3tnPtlg== X-Received: by 10.80.153.143 with SMTP id m15mr18454896edb.145.1519731317048; Tue, 27 Feb 2018 03:35:17 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id m1sm9176786ede.39.2018.02.27.03.35.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 03:35:16 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Marc Zyngier , Andrew Jones , Shih-Wei Li , Dave Martin , Julien Grall , Tomasz Nowicki , Yury Norov Subject: [PATCH v5 32/40] KVM: arm64: Directly call VHE and non-VHE FPSIMD enabled functions Date: Tue, 27 Feb 2018 12:34:21 +0100 Message-Id: <20180227113429.637-33-cdall@kernel.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180227113429.637-1-cdall@kernel.org> References: <20180227113429.637-1-cdall@kernel.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoffer Dall There is no longer a need for an alternative to choose the right function to tell us whether or not FPSIMD was enabled for the VM, because we can simply can the appropriate functions directly from within the _vhe and _nvhe run functions. Reviewed-by: Marc Zyngier Reviewed-by: Andrew Jones Signed-off-by: Christoffer Dall --- Notes: Changes since v3: - New patch since we no longer defer FPSIMD handling to load/put arch/arm64/kvm/hyp/switch.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 9d90bda3c2cc..5fbb77bd4e90 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c @@ -33,20 +33,11 @@ static bool __hyp_text __fpsimd_enabled_nvhe(void) return !(read_sysreg(cptr_el2) & CPTR_EL2_TFP); } -static bool __hyp_text __fpsimd_enabled_vhe(void) +static bool fpsimd_enabled_vhe(void) { return !!(read_sysreg(cpacr_el1) & CPACR_EL1_FPEN); } -static hyp_alternate_select(__fpsimd_is_enabled, - __fpsimd_enabled_nvhe, __fpsimd_enabled_vhe, - ARM64_HAS_VIRT_HOST_EXTN); - -bool __hyp_text __fpsimd_enabled(void) -{ - return __fpsimd_is_enabled()(); -} - /* Save the 32-bit only FPSIMD system register state */ static void __hyp_text __fpsimd_save_fpexc32(struct kvm_vcpu *vcpu) { @@ -414,7 +405,7 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) /* And we're baaack! */ } while (fixup_guest_exit(vcpu, &exit_code)); - fp_enabled = __fpsimd_enabled(); + fp_enabled = fpsimd_enabled_vhe(); sysreg_save_guest_state_vhe(guest_ctxt); __vgic_save_state(vcpu); @@ -481,7 +472,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) } } - fp_enabled = __fpsimd_enabled(); + fp_enabled = __fpsimd_enabled_nvhe(); __sysreg_save_state_nvhe(guest_ctxt); __sysreg32_save_state(vcpu);