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 D645DC44501 for ; Wed, 15 Jul 2026 07:33:37 +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=ldCo8PQ8EYqHIgnSDGINw7RWQgX50oxLyi+MVwAa4CI=; b=lpZPAYqkVx9VBA4DEKRm4Rr4kU OQJ8YVSWxtzIAH+jOYiWNBE1WYfge9NWcsmc1ez59ceaoGsic48k7PBsmY9YGXaVCNzNwfL8wyK4z Tym6U/i/caA2lRmCxSXANvh5Pv2uJHbq6go3CSTS5C4570NRJUOnIlfLQUJ2oeAucvqKQyd5ZfmuQ e7YIjyAENOvV1gQd+fSRr1u7Qe6v9XmVj1//qAhFblkIeeLYBU9VtmjEsuN2eiQ9SxsZYLTOJO0OJ lUXeRS1jodCXx3Ew/1pHWcV1lkhn9ZEG65Ii18k2jJoFR9oSlJ9tlVP1cLNgIlJFogBJCwTsSRjdS V7Tmon9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wju7X-0000000E2dO-3416; Wed, 15 Jul 2026 07:33:31 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wju7W-0000000E2ct-2fLZ for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2026 07:33:30 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 07DD9600BB; Wed, 15 Jul 2026 07:33:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0DBD1F000E9; Wed, 15 Jul 2026 07:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784100809; bh=ldCo8PQ8EYqHIgnSDGINw7RWQgX50oxLyi+MVwAa4CI=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=gAB8e4gFfwZMP7ZEp6O4/plbFeDHqfG2G38PzFUhDrns5P55nwXMlNn+FZJJlQ/u4 TULI+Tu++obKIOtV6s8TaIQDZURTljeCHo4qL6Mgfzruq8r300JZBLlGiWV5ue0EwO /7mRp9dY9nJLPXkyziVUhewqLWtjAgCrjMktr4tOMwPsab7sjuN4828xlJZ62tBoqh oOBnel3iOgsfWcj5B9RWxXOqOe21w82F/qtsjia/OYPaGUxLzUgqzSdiWV855hhUC3 +aXa9z9i3ti46255+rQG0cjfC5NEJhzbPEGp/9XZ0usBvp6s95w1QVq8rs2rRUY13a vlDBhk9g/hyGA== 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.98.2) (envelope-from ) id 1wju7T-00000005BTO-1ZMR; Wed, 15 Jul 2026 07:33:27 +0000 Date: Wed, 15 Jul 2026 08:33:26 +0100 Message-ID: <86fr1kogft.wl-maz@kernel.org> From: Marc Zyngier To: Wei-Lin Chang Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Steffen Eiden , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: Re: [PATCH v2 25/28] KVM: arm64: Engage NV3 TLBI trap elision In-Reply-To: References: <20260714091641.1970822-1-maz@kernel.org> <20260714091641.1970822-26-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/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: weilin.chang@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, seiden@linux.ibm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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 Wed, 15 Jul 2026 01:16:44 +0100, Wei-Lin Chang wrote: > > On Tue, Jul 14, 2026 at 10:16:38AM +0100, Marc Zyngier wrote: > > Similarly to the ERET elision mechanism, FEAT_NV3 can elide TLBIs > > that only affects the guest's S1 translation. Enable this, with the > > express condition that the guest isn't NV2 aware, as we otherwise > > need to trap these TLBIs to deal with VNCR mappings. > > > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/include/asm/kvm_emulate.h | 13 +++++++++++++ > > 1 file changed, 13 insertions(+) > > > > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h > > index b32870a5e1236..d17b161d4ba3a 100644 > > --- a/arch/arm64/include/asm/kvm_emulate.h > > +++ b/arch/arm64/include/asm/kvm_emulate.h > > @@ -715,6 +715,19 @@ static inline void vcpu_set_hcrx(struct kvm_vcpu *vcpu) > > if (cpus_have_final_cap(ARM64_HAS_NV3) && > > vcpu_has_nv(vcpu) && vcpu_el2_e2h_is_set(vcpu)) { > > vcpu->arch.hcrx_el2 |= HCRX_EL2_NVTGE; > > + > > + /* > > + * If the guest is NV2-capable, then we need to see > > + * all the TLBIs, as configured in HCR_EL2. > > + * Otherwise, relax the TLBI traps to only TGE=0. > > + */ > > + if (!kvm_has_nv2(vcpu->kvm)) { > > + vcpu->arch.hcrx_el2 |= (HCRX_EL2_NVnTTLB | > > + HCRX_EL2_NVnTTLBIS); > > + > > + if (kvm_has_feat(kvm, ID_AA64ISAR0_EL1, TLB, OS)) > > + vcpu->arch.hcrx_el2 |= HCRX_EL2_NVnTTLBOS;; > > + } > > I also suspected if this is dead code, but Sashiko had beat me to it :P > So from your response in v1, is this code here just for completeness? No, this is functional. It is just that we don't have any way to expose to a nested guest something that would be in the outer shareable domain, and not in the inner one. > It's amusing that we're not able to take advantage of this feature at > all! We can. It is just that there is nothing out there that will exercise it. Thanks, M. -- Without deviation from the norm, progress is not possible.