From patchwork Thu Feb 15 21:03:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10223567 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 03C3660467 for ; Thu, 15 Feb 2018 21:04:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7F4429512 for ; Thu, 15 Feb 2018 21:04:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC58429516; Thu, 15 Feb 2018 21:04:43 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 55EF029512 for ; Thu, 15 Feb 2018 21:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1167363AbeBOVEk (ORCPT ); Thu, 15 Feb 2018 16:04:40 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36809 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1167347AbeBOVEi (ORCPT ); Thu, 15 Feb 2018 16:04:38 -0500 Received: by mail-wm0-f66.google.com with SMTP id f3so3349454wmc.1 for ; Thu, 15 Feb 2018 13:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9fCRdXCGPnkq9FgP2xRGfZcs0OSO+WvazctPDicKu0U=; b=b7w9pY9GuH999HsXGwkOnhoMFPOMdhP2T02TCelyvOJg26Mxc8R2REN1vgrTY7Dnca GkjRKGZtXll5OiIOomyHS7Qny+Cs/F+xWlsg5w6YfjVuBwK4zdPSpWCwZnOT/JnJhWXR UhI263WP6sqOG/bt4Q+rtyAEzV2u6/iRL9Gfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9fCRdXCGPnkq9FgP2xRGfZcs0OSO+WvazctPDicKu0U=; b=hdVZn8AtEyShbDTllZmNqO8YxpoUXXehFxmxEZgOqRhuvvFSaeMXZZ+njoR8QQJhHj kpKvloU5aqwaJToYrLTKrNVrhbe+uAVui0spLXDHUkYKoeLN181JT8KW203XzCiKroXE UtyRDajWDg0x9fZfuxJ+Pd/nLAZH73Y1835VVY6coumqlMFdyW++uela8r/2eYVjyx7J IUqQQ+g8Z4W7pbDkujrGJRuZpIDLryhGOKYQjXGOyLiL5udJVui3UrquODjf20eN7pWY g45u8gx2XwpAyehiNfwL3RmuZ51Bud1PFoZYbwcd0unOMO+aoRBE3wLNnssJ8XebCOgc whCQ== X-Gm-Message-State: APf1xPBGnqQ1B1PtvH9g/wjJYeVit/8iS0fuKNtBTEzqbKqn1ndOScA8 zYQhSqMY04qCwNe8r7hoTPsKlQ== X-Google-Smtp-Source: AH8x2272f5XBp2l5Zldgzn0R2dGwIjdEwDepVywSfit/Hxlt/aRer23GryHb2Ss9N4M1egwqJXKl1g== X-Received: by 10.80.219.75 with SMTP id b11mr5190605edl.220.1518728677505; Thu, 15 Feb 2018 13:04:37 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id p55sm8220030edc.15.2018.02.15.13.04.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Feb 2018 13:04:36 -0800 (PST) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Cc: kvm@vger.kernel.org, Christoffer Dall , Marc Zyngier , Andrew Jones , Shih-Wei Li , Dave Martin , Julien Grall , Tomasz Nowicki , Yury Norov Subject: [PATCH v4 32/40] KVM: arm64: Directly call VHE and non-VHE FPSIMD enabled functions Date: Thu, 15 Feb 2018 22:03:24 +0100 Message-Id: <20180215210332.8648-33-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180215210332.8648-1-christoffer.dall@linaro.org> References: <20180215210332.8648-1-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 cann the appropriate functions directly fromwithin the _vhe and _nvhe run functions. Signed-off-by: Christoffer Dall Reviewed-by: Marc Zyngier Reviewed-by: Andrew Jones --- 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 17e3c6f26a34..9c40e203bd09 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 inline void __hyp_text __fpsimd_save_fpexc32(struct kvm_vcpu *vcpu) { @@ -413,7 +404,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); @@ -478,7 +469,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) __qcom_hyp_sanitize_btac_predictors(); } - fp_enabled = __fpsimd_enabled(); + fp_enabled = __fpsimd_enabled_nvhe(); __sysreg_save_state_nvhe(guest_ctxt); __sysreg32_save_state(vcpu);