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 B81B1D3B7EA for ; Mon, 8 Dec 2025 15:53:51 +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=WoJWld5v3fNpXGQcl119QByMGIZQO8OSFUnbHO62zQo=; b=oPQXAIYbygFFvqpnDXnP4Ji3ek Sv/8Z8yUm7gj9mMe/hRy8/thEoYy5gbifhZvMlvYQHVpNENBRHloYHn1nKjpPjCzZ73OJND1SSaRj J0OW8F/02SxO8LMvoMLaieiTkdr9g2pvApDZa9R7OXzXqOXP9Or7RuzPL2A8XlXbw9P+33RTHokn3 SLDMJK/Qa2dPT7Oh69FxUFLvs6OR7cH1bkVTwJNAfir4mPnuTP0oeRLG3+3biBPRzH3UB9+W0kXa9 bs1plcKjAYCQe4WVHkqs4Ajj2AgVWTFlw0DhdP5eGW+AF3LIyQmBh/pnkP8PLIqyiZPHv9XZ5pdQ/ 5vFmnxAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vSdYZ-0000000DGt1-287G; Mon, 08 Dec 2025 15:53:47 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vSdYX-0000000DGsZ-1E0p for linux-arm-kernel@lists.infradead.org; Mon, 08 Dec 2025 15:53:46 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 4FE8F43DF3; Mon, 8 Dec 2025 15:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 249EAC4CEF1; Mon, 8 Dec 2025 15:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765209224; bh=PeN2WcDmHftDTMUpG2Ud91xaY7ZkgIzrihs/0CEqsGQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Gui9wHS61ATIYFX8UqryuTy+ofUhdvEbUyS68iMpYr1LpqJbs7DehwC63TVjVTLlK rjE5q7Fe0kpNzAcRw3vwac/WP+VWw+kD8M+9IC8tjvYcdMJTyEj3QA5jDlsrXjPhdD fHayVAfkyotuPPwgj5rmquhvqUjCpP2KrUa2Iev548nysLHbDX1BV0WRlM0ncWGhyb f8zWA0kXxBXmdMcPYQlbWD7WrvpW61aXIpqgUU6rXPcuhqpSJHzmh/Nx8PxnQ5HLJr QxBD/PfeQBoTpC3TQ9KBUDYFnTV6GaEeN0JyDiVplRbNDgYhJKxXyMha/Giy8jyY49 vb+ZpSqeFbtbg== 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 1vSdYT-0000000BJjQ-49Qa; Mon, 08 Dec 2025 15:53:42 +0000 Date: Mon, 08 Dec 2025 15:53:41 +0000 Message-ID: <864iq1otq2.wl-maz@kernel.org> From: Marc Zyngier To: Sascha Bischoff Cc: "sascha.bischoff@googlemail.com" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , nd , "oliver.upton@linux.dev" , Joey Gouly , Suzuki Poulose , "yuzenghui@huawei.com" , "will@kernel.org" Subject: Re: [PATCH 0/2] Enable GICv5 Legacy CPUIF trapping & fix TDIR cap test In-Reply-To: <20251208152724.3637157-1-sascha.bischoff@arm.com> References: <20251208152724.3637157-1-sascha.bischoff@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: Sascha.Bischoff@arm.com, sascha.bischoff@googlemail.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, nd@arm.com, oliver.upton@linux.dev, Joey.Gouly@arm.com, Suzuki.Poulose@arm.com, yuzenghui@huawei.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-20251208_075345_392261_2B4CE94B X-CRM114-Status: GOOD ( 20.96 ) 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 Mon, 08 Dec 2025 15:28:22 +0000, Sascha Bischoff wrote: > > These changes address two trapping-related issues when running legacy > (i.e. GICv3) guests on GICv5 hosts. > > The first change enables the vgic_v3_cpuif_trap static branch on GICv5 > hosts with legacy support, if trapping is required. The missing enable > was caught as part of debugging why UNDEFs were being injected into > guests when the ICH_HCR_EL2.TC bit was set - the expected bahaviour > was that KVM should handle the trapped accesses, with the guest > remaining blissfully unaware. > > The second change fixes the specific cause of the TC bit being set in > the first place. The test for the ICH_HCR_EL2_TDIR cap was checking > for GICv3 CPUIF support and returning false prior to checking for > GICv5 Legacy support. The result was that on GICv5 hosts, the test > always returned false, and therefore the TC bit was being set. The > issue is fixed by reordering the checks to check for GICv5 Legacy > support first. > > These changes are based against kvmarm/next. > > Thanks, > Sascha > > Sascha Bischoff (2): > KVM: arm64: gic: Enable GICv3 CPUIF trapping on GICv5 hosts if > required > KVM: arm64: Correct test for ICH_HCR_EL2_TDIR cap for GICv5 hosts > > arch/arm64/kernel/cpufeature.c | 8 ++++---- > arch/arm64/kvm/vgic/vgic-v3.c | 25 +++++++++++++++---------- > arch/arm64/kvm/vgic/vgic-v5.c | 2 ++ > arch/arm64/kvm/vgic/vgic.h | 1 + > 4 files changed, 22 insertions(+), 14 deletions(-) Thanks for the debugging, and putting this together! Reviewed-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.