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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20A9EC0219D for ; Thu, 13 Feb 2025 10:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TfwPyJ1jnnaqmWwCfQjJpKjCqiOoDPqeOuQ1kc3EjTE=; b=O7Cro9XQDVPwhSUsAwChdjhStw DM5Z/1yXjz7KvwAPYXabXIgKoQ+CoybsXbgQebcYmZ+8+ESxnoWP5HuPIhXGxud2r+JOtNIZnodig hQwQc1WuhflmrxACubWQ2a/0PN5ApPY5oXYP5a4qOHEBvSB4PKLARD/3066k+ZJgnhrtD/XZTUbCz bfgWfsfprX/EYF6s3GhOUN2XiIRi3mP8PFkVkkNkhzXxVdSKfE0q4C+bQv5Skl6V0BtDQoLu3h9yB 2wvYI4gkda6W9la25SdP2m4BWIJ83nuZVgYkj1bX1WJ8LWcqk7ZXO+jyHtVdFBObOh4is/vO+KmTI VpL9BRQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tiWuv-0000000Ak2U-0M0Z; Thu, 13 Feb 2025 10:58:01 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tiWtO-0000000Ajp2-2iUP for linux-arm-kernel@lists.infradead.org; Thu, 13 Feb 2025 10:56:27 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8FAAFA41FFE; Thu, 13 Feb 2025 10:54:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84B18C4CED1; Thu, 13 Feb 2025 10:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739444185; bh=AWQ9Pe1GOHo90EUe82d6uyA1a+MiIOWdBo0xg647hR4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=X+u3coxc8I8AO5CVa23DSr3lHAzSa2nGrfJOg2QM+FG+j261Z3D5lhIJLUbE6JeTB vTgLsKL7HnHlQ7B4Wzm2dqvvS5Pd5aZjjEyHu98M7HYFLqDZcyUxGOrBsiFiU+118C yKrlFCWrTRRCkjn9UDvee07GVuWz+7T32CkpdMPFrvbPIexF7oi5Yy7hJe/E8ltlum uq75zhqkP7WkPqRhx+0na1IE14xIekfL50odCkvQkiBOP4jP40Q2FDyP8b7XiRT21e 53IXHDUoB12kyEOWvjbDiQ8ss0LM/F+VptTDm6HmHdFciA7Ug0jl54ZNY8CHTuN1LB oxGvSfPDcrRSQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tiWtK-003e0Q-Sv; Thu, 13 Feb 2025 10:56:22 +0000 Date: Thu, 13 Feb 2025 10:56:22 +0000 Message-ID: <86seoiru3t.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland Cc: Mark Brown , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Fuad Tabba , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon Subject: Re: [PATCH v7] KVM: arm64: Fix confusion in documentation for pKVM SME assert In-Reply-To: References: <20250212-kvm-arm64-sme-assert-v7-1-0f786db838d3@kernel.org> <86tt8yrzon.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, tabba@google.com, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250213_025626_820367_2C71337F X-CRM114-Status: GOOD ( 31.32 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 13 Feb 2025 09:24:22 +0000, Mark Rutland wrote: > > On Thu, Feb 13, 2025 at 08:55:52AM +0000, Marc Zyngier wrote: > > On Wed, 12 Feb 2025 11:11:04 +0000, > > Mark Rutland wrote: > > > On Wed, Feb 12, 2025 at 12:44:57AM +0000, Mark Brown wrote: > > > > diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c > > > > index 4d3d1a2eb157047b4b2488e9c4ffaabc6f5a0818..e37e53883c357093ff4455f5afdaec90e662d744 100644 > > > > --- a/arch/arm64/kvm/fpsimd.c > > > > +++ b/arch/arm64/kvm/fpsimd.c > > > > @@ -93,11 +93,14 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) > > > > } > > > > > > > > /* > > > > - * If normal guests gain SME support, maintain this behavior for pKVM > > > > - * guests, which don't support SME. > > > > + * Protected and non-protected KVM modes require that > > > > + * SVCR.{SM,ZA} == {0,0} when entering a guest so that no > > > > + * host/guest SME state needs to be saved/restored by hyp code. > > > > + * > > > > + * In protected mode, hyp code will verify this later. > > > > */ > > > > - WARN_ON(is_protected_kvm_enabled() && system_supports_sme() && > > > > - read_sysreg_s(SYS_SVCR)); > > > > + WARN_ON_ONCE(is_protected_kvm_enabled() && system_supports_sme() && > > > > + read_sysreg_s(SYS_SVCR)); > > > > > > As I mentioned on the last round, we can drop the is_protected_kvm_enabled() > > > check, i.e. have: > > > > > > /* > > > * Protected and non-protected KVM modes require that > > > * SVCR.{SM,ZA} == {0,0} when entering a guest so that no > > > * host/guest SME state needs to be saved/restored by hyp code. > > > * > > > * In protected mode, hyp code will verify this later. > > > */ > > > WARN_ON_ONCE(system_supports_sme() && read_sysreg_s(SYS_SVCR)); > > > > > > Either way: > > > > > > Acked-by: Mark Rutland > > > > > > Marc, are you happy to queue this atop the recent fixes from me? Those > > > try to ensure SVCR.{SM,ZA} == {0,0} regardless of whether KVM is in > > > protected mode. > > > > In all honesty, I find that at this stage, the comment just gets in > > the way and is over-describing what is at stake here. > > > > The > > > > WARN_ON_ONCE(system_supports_sme() && read_sysreg_s(SYS_SVCR)); > > > > is really the only thing that matters. It perfectly shows what we are > > checking for, and doesn't need an exegesis. > > > > As for the Fixes: tag, and given the magnitude of the actual fixes > > that are already queued, I don't think we need it. > > That's fair; if you haven't spun a patch for that already, I guess we're > after the following? Yup. Applied to fixes. Thanks, M. -- Without deviation from the norm, progress is not possible.