From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EF71606A321 for ; Tue, 24 Nov 2026 12:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HytU9UBq; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XM02+DLz 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-Unsubscribe-Post:List-Owner; bh=d1InUdNvrxxB04G5bxXtj4JDVBuTsOLfVQpVUmwkbqM=; b=HytU9UBqyFmI/rgxu8C1CbY5ZL P7IWLMQw6bRK5gXBwUa0QdDUbZ3W/M8T09fJJCHK3EtdOR3lb4wv5n2NJ8LFeMB1zZLQFNusNqIsN FrSSOJoPAl7yZ0Z8GCBadX2+uOzBC0LNfQhl+wz3kuWKN5ULAZK8Dn3C7EyhUBlNg0/qb+/rIS0VE 5LOPzoGgyKHI9SQ9KYDnkrhJQeZhGvoeOutfWk/GAAElQRyinVFr0yXTf4zGR4hoQaM1bnTaMHs8U MOCJMat/9gGHWb8qIR6rSinlBGkhsFLNGMfFMeHwhR9AWSQybfbZIlky/x3rOzb5s8OfUQTuwPW6j SH7eZZnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVo6L-00000006Gjp-3XCY; Tue, 24 Nov 2026 10:50:17 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVo6J-00000006Gjd-3hUO for linux-arm-kernel@lists.infradead.org; Tue, 24 Nov 2026 10:50:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 1B71A60E70; Tue, 24 Nov 2026 10:50:15 +0000 (UTC) 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-Archived-By: 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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.