From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 595AA2EDD5F; Mon, 8 Dec 2025 15:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765209224; cv=none; b=JxfAVroMVgOZdcSLoA5ivRgPNTaFYgrE9M8+aBoQjQtcYmBoaobD8iD3uTu5k7Tp2zs1nj+M2I31N11s464hq8LddZa49NurOMdQqiK5Q3N/CPARHJirlHX7kpfW6HfFoupi8TVE3FDUW/S8Bz/CnaQZUCzHMyaEzHegB7hdUqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765209224; c=relaxed/simple; bh=PeN2WcDmHftDTMUpG2Ud91xaY7ZkgIzrihs/0CEqsGQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=OSgoErFfJ9D6x1ew7JVt99l2bGpnJZR3fOsrmLrszFkt8zcmMo8bHu9E2j7U6j0KirObcMT+u32c9YTY0gvv3Y7icCeWbh5E+IjGnvtmuGmYDwVp2dj3oLcima633cOzz7atRjjFhRc9YIWtbF90ix64tBYyfMfnJBmV8c7pl5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gui9wHS6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gui9wHS6" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.