From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795517415; b=wEXRi3WXLLF8KcuFFDLLcZ27FT/z8sJmGETqSxcFHjvpD8kXhukaKsHC4n0hESamRmWZ W3T/4vR9d7XU+W/4j5QRoGcQJkRrYvHifUKYTbmzTKFKrFzHkiA4rwstlntZ+IVs0xcut PeiSO3jaBAP8tGoh2NyeHvRGNYjAcjzYkvpkFhyc5t8vLHmgqWDrA3nhviO2/7E7PB93D uUnEtEQG4Mrq+LmRJNCBzIc4wQdjNkP5pQBBSwZnkZOncJrnRkiV8SJ1+3mhp111Gs7pg NsU9t3VVqnEWmP1qY7iSTonLlURED4+hV4ow9KUnm76MPZ6XNoZUejh5I1F3XbG53eg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795517415; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=d1InUdNvrxxB04G5bxXtj4JDVBuTsOLfVQpVUmwkbqM=; b=KBOu1xgpknz+GMcgitTqVcDPqbwqPENkr7bac/HG4ySmfAMKAyFFmT0LPmoIxDAktKj6 PKIhNpSzXt4P7Zz++uCUDO/qaitiJsqLbbK1PxEiHlMb/k7uFWEooztZSHASiKZY6YGHA WsqAqGfNfRQWjq5LBqeSIpukb4WYArWlqDGvOxauzXPpUnz8VV+6QgLMzYbCFbSqTiFn9 ytVJYJB+MTg+vbTBq+p2RXQAYk1TJUpYOO9qkcSMSfXXHhXTUdV4hgIuIGq7dKIlV7XL9 v7+h3lqTTASVu/Hn3lewl1l9aExm5+LETEgooU6zWfCtWnbVgb2kxcosB8MK+1gGKQg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XM02+DLz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36FBA606A322; Tue, 24 Nov 2026 10:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XM02+DLz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 784E31F000C0; Tue, 24 Nov 2026 10:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795517414; bh=d1InUdNvrxxB04G5bxXtj4JDVBuTsOLfVQpVUmwkbqM=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=XM02+DLzzE4PhFkSToQX7gQrNAky1EYIzU20SU9GIlmoRJjLrx5wEUx63VzSxL1/v UjVhkTvTFjO75C06GyrybkRR2uMJm8JGAzRCPDZKVy8vaXE981I5yHaQLJilz6DoG9 pYRGSsv0wYct22PwdBhgRm1+tFx/+QS25DHoBOtYf9GkBUJMxJ2ylfJLqPU/TNVEOk +LY7DpEfCnd6hd+IxhfawETl0j7mRbJFF3GaYwsIOep7nGdCD67ZA1VgJdyHM3eqU9 B3YxGQADb5LGbNJD2p03wiS+cpMJzLSmtCwti9nfEiB3Ns/jhIcArFP2NE0ktmifWL 2I1UJH6xwjR+g== 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 1xVo6G-00000002Wua-0c5I; Tue, 24 Nov 2026 10:50:12 +0000 Date: Tue, 24 Nov 2026 10:50:11 +0000 Message-ID: <86a4myzeos.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Steffen Eiden , Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: Re: [PATCH 3/3] KVM: arm64: Drop open-coded GIC idreg sanitisation In-Reply-To: References: <20261123192457.8700-1-maz@kernel.org> <20261123192457.8700-4-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) X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: fuad.tabba@linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.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 On Tue, 24 Nov 2026 09:38:00 +0000, Fuad Tabba wrote: > > Hi Marc, > > On Mon, 23 Nov 2026 19:24:57 +0000, Marc Zyngier wrote: > [...] > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > [...] > > @@ -5874,51 +5874,6 @@ static int kvm_vm_finalize_sys_regs(struct kvm *kvm) > [...] > > - * On GICv5 hardware that supports FEAT_GCIE_LEGACY we can run > > - * both GICv3- and GICv5-based guests. Therefore, we initially > > - * present both ID_AA64PFR0.GIC and ID_AA64PFR2.GCIE as IMP to > > - * reflect that userspace can create EITHER a vGICv3 or a > > - * vGICv5. This is an architecturally invalid combination, of > > - * course. Once an in-kernel GIC is created, the sysreg state is > > - * updated to reflect the actual, valid configuration. > > nit: This comment is the only place that explains why, on a > FEAT_GCIE_LEGACY host, a VM's ID registers can show both GIC and GCIE > as IMP before the VM first runs. sanitise_id_aa64pfr0_el1() and > sanitise_id_aa64pfr2_el1() still set both at reset. Is it worth having > a short version of it next to the tables patch 2 adds? I don't think that's the correct place. If anything, such comment should be in the reset code, not in the sanitisation code, which actually generates the architecturally compliant view. > > [...] > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > [...] > > @@ -180,7 +180,7 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) > > * We've now created the GIC. Update the system register state > > * to accurately reflect what we've created. > > */ > > - kvm_vgic_finalize_idregs(kvm); > > + kvm_idregs_enforce_dependencies(kvm); > > This now also applies the S1P[IO]E dependencies when the vGIC is > created, at a point where userspace can still write the ID registers. > Was that intended? If this clears S1PIE or S1POE, the first KVM_RUN > doesn't restore it, so the final ID_AA64MMFR3_EL1 can change with the > order in which userspace writes the ID registers and creates the vGIC. > If that's the intent, should it say so in the commit message? The commit message has no influence on the behaviour of the kernel. However, I want to know whether this change is an acceptable behaviour or not *from an ABI perspective*. We have several options: (1) delay all idreg enforcement to the same (late) point (2) keep things as currently done, meaning that the GIC fields are special and sanitised at a different time (3) say that idregs can change at any point if you change the configuration of the system, such as creating a GIC I'd be tempted to go with either (1) or (3). (2) feels like a total bodge. M. -- Without deviation from the norm, progress is not possible.