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 29BD1C3ABA5 for ; Tue, 29 Apr 2025 14:14:31 +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=57S3Y4tVlca4Dw5c6G5OvN38Kpt5Qx2pAqXhp0W85aI=; b=StxQRrhNJelE9Kz4GF/SBTWbyj 7OlnqNb2tkgm9z09aRmyy2LUI09J9zLkOcbu+1OoFHRPadrdBSx7Dt+tytCrTq53XgHypgnx42OXn WrtPIbmN1qBOlaIL9RvqytUk6hj+926rFW7alDEXW7ZTbMRL5hodqOTjpFx/rBvgucV2/DZ42R5fb G3GNw0KW/8wrRXTuHZj9o2vv81Br44LCy1gwXnoLkGzl4Hs+AzYnbVFguzYEg8OpZDXGJxHksU22j Je7srTxQ0n10Do8AgJcxDLMS4M8RDzMNyQEsNg031RIPQWez6XLipGP94I+R/4e/hmmqXnwl0Cckz 9zZZo3fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u9lj0-00000009tvd-0eFu; Tue, 29 Apr 2025 14:14:18 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u9lLB-00000009ooS-0co7 for linux-arm-kernel@lists.infradead.org; Tue, 29 Apr 2025 13:49:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 774C65C04AF; Tue, 29 Apr 2025 13:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D58C4CEE3; Tue, 29 Apr 2025 13:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745934580; bh=B3/QK4Il9/bFKReyINzmP0VuCV66h4eDXoELS2iLT8o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BCQ54AOQ0P3jLiyj+3w+/U+Ozru8AXZ3vJ4UPPknNCpINRX5xG2zBuQeAf6+ycX9s LyaELBBcBOjAVG0BO33HV/GOXXs8QR+pLZ5ZHik3tYdQPp02yDhFP3hNxw2k8Io6Ux IMdDh+G7oigOC5jGIqOjiyJY/pBKN1cFmKhZIduFmgWzAwOqf3vcpHcIjZTwU9H1QY ekLSlfFojx8v7OH10vWFdI8Wpn/GQqix7O0ErGYdSKSO11wK3/wag9SEEPOVTTj1sn ttuC1YQnlR/YRpb2haakKoJtCS099oEw+kMkbsBaAiJkKaSwK0tWGg/zypzcCXAHJz Xc6sfcEeydGGg== 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 1u9lL7-009vjZ-UB; Tue, 29 Apr 2025 14:49:38 +0100 Date: Tue, 29 Apr 2025 14:49:37 +0100 Message-ID: <86h627hyby.wl-maz@kernel.org> From: Marc Zyngier To: Ben Horgan Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Mark Rutland , Fuad Tabba , Will Deacon , Catalin Marinas Subject: Re: [PATCH v3 24/42] KVM: arm64: Unconditionally configure fine-grain traps In-Reply-To: <363383a2-c05e-458c-82b7-acc6e5d73939@arm.com> References: <20250426122836.3341523-1-maz@kernel.org> <20250426122836.3341523-25-maz@kernel.org> <363383a2-c05e-458c-82b7-acc6e5d73939@arm.com> 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/30.1 (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: ben.horgan@arm.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, mark.rutland@arm.com, tabba@google.com, will@kernel.org, catalin.marinas@arm.com 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-20250429_064941_282670_81B01C46 X-CRM114-Status: GOOD ( 22.14 ) 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 Tue, 29 Apr 2025 14:08:27 +0100, Ben Horgan wrote: > > Hi Marc, > > On 4/26/25 13:28, Marc Zyngier wrote: > > From: Mark Rutland > > > > ... otherwise we can inherit the host configuration if this differs from > > the KVM configuration. > > > > Signed-off-by: Mark Rutland > > [maz: simplified a couple of things] > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/kvm/hyp/include/hyp/switch.h | 39 ++++++++++--------------- > > 1 file changed, 15 insertions(+), 24 deletions(-) > > > > diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h > > index 027d05f308f75..925a3288bd5be 100644 > > --- a/arch/arm64/kvm/hyp/include/hyp/switch.h > > +++ b/arch/arm64/kvm/hyp/include/hyp/switch.h > > @@ -107,7 +107,8 @@ static inline void __activate_traps_fpsimd32(struct kvm_vcpu *vcpu) > > [...] > > static inline void __deactivate_traps_hfgxtr(struct kvm_vcpu > > *vcpu) > > { > > struct kvm_cpu_context *hctxt = host_data_ptr(host_ctxt); > > - struct kvm *kvm = kern_hyp_va(vcpu->kvm); > > if (!cpus_have_final_cap(ARM64_HAS_FGT)) > > return; > > - __deactivate_fgt(hctxt, vcpu, kvm, HFGRTR_EL2); > > - if (cpus_have_final_cap(ARM64_WORKAROUND_AMPERE_AC03_CPU_38)) > Don't we need to continue considering the ampere errata here? Or, at > least worth a mention in the commit message. The FGT registers are always context switched, so whatever was saved *before* the workaround was applied in __activate_traps_hfgxtr() is blindly restored... > > - write_sysreg_s(ctxt_sys_reg(hctxt, HFGWTR_EL2), SYS_HFGWTR_EL2); ... and this write always happens. M. -- Without deviation from the norm, progress is not possible.