From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38ED6C433E0 for ; Wed, 17 Mar 2021 17:59:12 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1F7264F20 for ; Wed, 17 Mar 2021 17:59:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1F7264F20 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pOPnAQkS1CVoS1Efv9jH8iSnyLraLaMS5CPhO9UUmVU=; b=NjwAeyRtCVqjlzuXyoxNddsOg erU6p9Npd+41z5+NqrzoD2yCNJ8/wh6y1Ihmr07HSg5XcVEOIx4Z8tqCzxA53HknS93DAC/thaPr4 ZcmemzHdKLwtb+JiyIoTP5stg0/0Ru4iCDxe9hk6wktYCH+3xgJlGOKYgNQaCPN1nzLyyUn8pb6KD RyLX6m33/W0EckGJuovRvbe8Rlx1ccZotRajg5JrAXj3pXXY2RUGTujdXHmFDN/Zld9GckFGAf7W+ 92bEpu8dqS2aCW7XTuSgxK7pO4lrbURXFSRjXXfSPWRmCw/AzmpfwwC66a/gcTJ42UM3A56pnak/Z 71/jatVmw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMaQT-003hgn-Mi; Wed, 17 Mar 2021 17:57:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMaQP-003hgB-VF for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 17:57:43 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E07664F0F; Wed, 17 Mar 2021 17:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616003860; bh=KLrz/zlZvv0deqnTNA4E5YrAwOuKGvg1QIpXtpi+EK0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BY8USoWjrrilAobRONwMs0Nq33hyLtCVksyL4S7NKSyHLT6U/f2Xa3IslxnTdhD07 cQ6QnOEJlaNLL21vzJ3pgocSZuNvsj0/VKXWFTuJbdUuVVNZcwbDy2KYym4GRIBlfd xzMtrcyqT0ww4WtZ8THMiLnJAw2EeMosVV584bglsTQBSZhmiH+VvfwBLw4vLDiTPi j7Tws89nEtSJZtqUE6aVbC8hv7gNHKUMJNYECw8+88A7rQr3b260WD1LbSFHT5c9Fq rJbLuRDKKRHE78Sv+j2Btar3gYfMyfRuor76510v1pcsX1OUj8+ypsW9OiVlvhjR9N PLqFOTfhZhTFQ== Date: Wed, 17 Mar 2021 17:57:35 +0000 From: Will Deacon To: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, dave.martin@arm.com, daniel.kiss@arm.com, Catalin Marinas , James Morse , Julien Thierry , Suzuki K Poulose , broonie@kernel.org, kernel-team@android.com Subject: Re: [PATCH 09/10] KVM: arm64: Save/restore SVE state for nVHE Message-ID: <20210317175734.GA5713@willie-the-truck> References: <20210316101312.102925-1-maz@kernel.org> <20210316101312.102925-10-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210316101312.102925-10-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_175742_204829_868BC8D5 X-CRM114-Status: GOOD ( 20.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 16, 2021 at 10:13:11AM +0000, Marc Zyngier wrote: > Implement the SVE save/restore for nVHE, following a similar > logic to that of the VHE implementation: > > - the SVE state is switched on trap from EL1 to EL2 > > - no further changes to ZCR_EL2 occur as long as the guest isn't > preempted or exit to userspace > > - on vcpu_put(), ZCR_EL2 is reset to its default value, and ZCR_EL1 > restored to the default guest value > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/fpsimd.c | 15 ++++++++-- > arch/arm64/kvm/hyp/include/hyp/switch.h | 37 +++++++++---------------- > arch/arm64/kvm/hyp/nvhe/switch.c | 4 +-- > 3 files changed, 28 insertions(+), 28 deletions(-) > > diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c > index b5f95abd23f5..cc6cdea69596 100644 > --- a/arch/arm64/kvm/fpsimd.c > +++ b/arch/arm64/kvm/fpsimd.c > @@ -121,11 +121,22 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) > local_irq_save(flags); > > if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED) { > - if (guest_has_sve) > + if (guest_has_sve) { > __vcpu_sys_reg(vcpu, ZCR_EL1) = read_sysreg_el1(SYS_ZCR); > > + /* Restore the VL that was saved when bound to the CPU */ > + if (!has_vhe()) { > + u64 zcr; > + > + kvm_call_hyp(__kvm_reset_sve_vq); What would go wrong if we did this unconditionally on return to the host, or is it just a performance thing to move work off the fast path where we return back to the same vCPU? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel