From patchwork Tue Jun 4 18:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13685755 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 837B0C27C52 for ; Tue, 4 Jun 2024 18:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=doaIIFgibzYrxyKN48zWf+m07xj5NTNpPxFXApo51wc=; b=Eki1grF9h21/bm 51dtLxNybmfuGgGnX4kYN6wDKQNtOAo+vPxcU9ZuUAirriySQvscMiScqyGUYbVHG5yvzpwO0xLK4 TDMGqaJy8V0gn/07MjspZ1b3cBO/9fxKin0fmHoF/vnjYr17JAPQsyru8VvrdvFtqmSmFo1FDHwmR +twHMNRu8T04JEoNSW49O+njZFf0Uhig8k6MMJOQXq4IToxPj32BbAV4R2j8+1Ph8vtAqJVdtfKiH jFRWJdiXx6GHVCILAWkLJNXCibM5vdwJBEtCylPngHvoz7Jnbyd4A2V0k94PUhdBycX6a/cm3abOn JheOSLdP7N3tigWPX1iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEZBn-00000003U6a-45c1; Tue, 04 Jun 2024 18:47:19 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEZBk-00000003U67-14C0 for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 18:47:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 3F443CE128B; Tue, 4 Jun 2024 18:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C923C2BBFC; Tue, 4 Jun 2024 18:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717526833; bh=LtpCYs/rieDxgmWuPZaV8oRq3H8m/uiP7O2FlWkkU6E=; h=From:Date:Subject:To:Cc:From; b=DL2q++Xn3d+bxgLo6K2aRBRCcxCLwQNltO2lOGL9hKwwUzicwguMRvUaoX0TayHNL G6nRBQlDV3qJk19i10u4JEloAutfE1RROgyh6SGF4irMbbg1LEfAdRcEq8lzu4KJAi LwS0Ey79nf3tA3CK8y0ltfocISMhdToWSOwEwja3hO+S5SPCLCKC8m3ZVRe4fkbdAU jS5Td28kDvTaPd4KUEGFyslEZsFw0s+JkAO6eiDbe9cHcsKBVRRqMomLieODFRry// 4yF9B4WH3QRrvHMAmqLZylST5+W55BypESDF4FQFV9VkOOwOXU+9PLWCKi3MpTx/DA 41sXRsHyD6gSw== From: Mark Brown Date: Tue, 04 Jun 2024 19:47:01 +0100 Subject: [PATCH] KVM: arm64: Fix confusion in documentation for pKVM SME assert MIME-Version: 1.0 Message-Id: <20240604-kvm-arm64-sme-assert-v1-1-5d98348d00f8@kernel.org> X-B4-Tracking: v=1; b=H4sIACRhX2YC/x3MMQqAMAxA0atIZgNV2ipeRRyCjRqkKo2IIN7d4 viH9x9QTsIKXfFA4ktU9i1HVRYwLrTNjBJyQ21qa7yxuF4RKUVvUSMjafYnOgqNc8FySx4yPRJ Pcv/bfnjfD0wbmHNmAAAA To: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , Fuad Tabba Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.14-dev-d4707 X-Developer-Signature: v=1; a=openpgp-sha256; l=1905; i=broonie@kernel.org; h=from:subject:message-id; bh=LtpCYs/rieDxgmWuPZaV8oRq3H8m/uiP7O2FlWkkU6E=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmX2EueYIFwpCK5h2htBWB6yatSlIAm2LAJzZ7L8yK BpxQpqiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZl9hLgAKCRAk1otyXVSH0CKaB/ 42Yi8pK/Bp81oc/d+6BAigrvOCLOSucaFzmqzhfl5R0/V1istdU2EHYMlu1gGqakjKO0B7mm0H1ZmD rZKgYr98vaM/bo3WyLxSGdmKUZNTWXxGKPEI2iPQ6PsoBGId2jE0mOXk/E6/kPnCDXGDxDJkwD+ajC 4QeBJiv/+4N9/yVI/KYXF5BpWaO2kIKVXB5LJMUUcn58mMM5wvC+iMvxHiURZ//eUJV/3vhbR7Y3Fs 0QVxP3jfqCh8B/eqkyE5oO0yjXIj07jA1oKO1cuBrookuVEsSs65h5AdeD65VRufGv4GgCKUGjEVf8 6dY+bDjWndxtQuhcEQIj24SkTpFH6D X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_114716_756622_7CF2CE1D X-CRM114-Status: GOOD ( 13.61 ) 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 As raised in the review comments for the original patch the assert and comment added in afb91f5f8ad7 ("KVM: arm64: Ensure that SME controls are disabled in protected mode") are bogus. The comments says that we check that we do not have SME enabled for a pKVM guest but the assert actually checks to see if the host has anything set in SVCR which is unrelated to the guest features or state, regardless of if those guests are protected or not. What I believe the check is actually intended to validate is that we do not enter the pKVM hypervisor with SME enabled since the pKVM hypervisor does not yet understand SME and is therefore unable to save or restore host state with SME enabled, indeed attempting to save SVE state would fault if streaming mode is enabled on a system without FA64 due to FFR. Update the comment to reflect this. Fixes: afb91f5f8ad7 ("KVM: arm64: Ensure that SME controls are disabled in protected mode") Signed-off-by: Mark Brown --- arch/arm64/kvm/fpsimd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- base-commit: afb91f5f8ad7af172d993a34fde1947892408f53 change-id: 20240604-kvm-arm64-sme-assert-5ad755d4e8a6 Best regards, diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c index 521b32868d0d..f720ba47b85c 100644 --- a/arch/arm64/kvm/fpsimd.c +++ b/arch/arm64/kvm/fpsimd.c @@ -92,8 +92,9 @@ 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. + * The pKVM hypervisor does not yet understand how to save or + * restore SME state for the host so double check that if we + * are running with pKVM we have disabled SME. */ WARN_ON(is_protected_kvm_enabled() && system_supports_sme() && read_sysreg_s(SYS_SVCR));