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: 10245065 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 917DD60211 for ; Tue, 27 Feb 2018 12:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80CAC2883C for ; Tue, 27 Feb 2018 12:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74DE828893; Tue, 27 Feb 2018 12:43:04 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0089B2883C for ; Tue, 27 Feb 2018 12:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=aoWkNky0zJRRLT7RyOZJ6hgCIN/i3LOU9JuDyK5bbpA=; b=Yx046Hd5LMz/tRz1E2zU71YlWn Dj+REBVr3uOzXbR4YTBeRFHEzraKxAVzIBePBLtLkHOWD+C72y+ciw/kOIA6jJaZpHQE4OGlYP2mO 9Zvr5TXexxOAM3Ir47PrfeD8HmqbmEUHgY6amdTvv91O7fH+1Osxio0DXB8W6ILBNgWk9keUktHxQ gGj8yqyLp7wBwNRyyQF60Hk7zQY94UvP0BZfXAROYJAXHLYOaYR+waGA2suBHHu3Iz18ileSdMO04 fzmFT1VKmY/9R9XNkiPDBtSP/yhzkl3AKEy715TFSmhNnoQt3RMT+JTze7qWdkXBsG/uh1hGJrz1R OTF+CmRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqeas-0005U0-1A; Tue, 27 Feb 2018 12:42:54 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqeZk-0004jB-Nj for linux-arm-kernel@bombadil.infradead.org; Tue, 27 Feb 2018 12:41:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dNrNEHXjIAleHHymbH+QKbnbEEBic0KBg6BuLZ+nZ1A=; b=e+Uh/hqsv0BJiyXVDjpSUfwUF j+rsgLLQeV94Zf9S7aKJNADfYV4Rr1qYC91IDIvlqT4K1mvmXe1lSn/bSos+7idInUMdoRB67WH+k 7LD2kGw6VuvzbhahLnI7LTESeoTQow1vvvMIRC2z4Z+XQr1lKHVy9X664NfqklB9K2VoBrmonePjr wJ7n6d5wo4plEXO0JaXeCYIKZW5Rowqt5LqYi3SYHRwAodJsMkZ49LCHuhXYCfgJDu2ZjDav7egXZ hDLO4u1wB+3ADzMR9TPm18hgPP3iAlR6E6e/x5GMixF7gQUkVo0WOwK8eEs/CRCjxkkrDcdOveXrx ZimAiGLZg==; Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqdXb-0006KD-0X for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2018 11:35:27 +0000 Received: by mail-wm0-x244.google.com with SMTP id 191so23157284wmm.4 for ; Tue, 27 Feb 2018 03:35:18 -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=keFoAwXoGLSZks86LKeaRp7d6+i3gRW3L/DdOTfT9OHdnDi8cK3a+tbBgQgqAC4cfy qj1e+08rfs6ROtorxZ/ReTr3wubQZhfRmy3sViMYO9WN/r4DsTc6gSoglRhWUCaeBMVl PcIVaHCPhvMapXEsKKBte+BNk5nFXCLcd/PkDIjmvDwMq61QT0rR8X5MJ3VqsenAmEE6 zBb6tmMuvLS7Fhme2SE2sN8gbfaePDolgUoacFO5ya/vy0cfck49WKBjAiqBZZIbaYb4 Z5kzkFhH1Arw22WZgvXgl+KJO9PzTVo69sSv2BmKrzyRdc6NF8RstV/1Umr25ZRrZ2Ct JOJg== X-Gm-Message-State: APf1xPAyY6yFevABFXEfIvwh1v7Z1FeHONTZpTfwsdW/1qWNI7A488pJ DbZnCWxjXcok7nosPLKzpAZhnQ== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180227_063527_133837_D2F9E79D X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jones , kvm@vger.kernel.org, Marc Zyngier , Tomasz Nowicki , Julien Grall , Yury Norov , Dave Martin , Shih-Wei Li MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);