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 F36BDCE8D6B for ; Mon, 17 Nov 2025 11:28:38 +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=CiueHhRnJ9ulMkCTFCHoEDYLpdo+U4EyQeF7wYBnCfI=; b=4pGMadqMNFDLPKZzCBZ72NcxSD aHFbrl4LDL/Hhe/CnNdNtyoN9uwuLMyulyte2USC8laBlu6sZNM8jGtoJq4XTJbb7SD+vrjc9ca5m 7jbdTHzO5sEjI8RjJjFUYZomfWA46CAz7hGHjhckzUX95TZ4ub7dCyEOhXv7cpozQOPnd7SpMyOQh 8tlJi0fMdsuDiyKih3CEgXRQWD3BEuVR4wW/2iN6S9BtRZeQUb1WcZv4gn0xDYXPF4V0Y0Enfo+wS hkkS4qiQk/MhbQxfKelNB9U2GvW7S6UL113RVeFy+XpuTyQOK/sG0a+Ya+p2HrHjqAytDRr4Jo+FG brNyVS7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vKxPO-0000000FyAP-3Uug; Mon, 17 Nov 2025 11:28:34 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vKxPN-0000000FyA7-33k0 for linux-arm-kernel@lists.infradead.org; Mon, 17 Nov 2025 11:28:33 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id CF44C60143; Mon, 17 Nov 2025 11:28:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 796A8C19425; Mon, 17 Nov 2025 11:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763378912; bh=hdkCa9GLlXOFEKazFI6YIXZl54t/xf43XIXxQ2WHmsQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=olpCmwZHh7kRdwZ4Jdn8CAsbf0cuwdmdL6osbk/mw3mfqndJ+zZDdknmVGSVqubdD lYAsqjPAqieDGa2khqIcc5/el0L6nPbI/fyek2jo2fvr9Ue/QHLHx2PY81ufUuZJq/ Le/IKSaRLwhqzbWtJv7qTLjfEhkFgGjrVCvKUrbpFmvgzx69s2IXY3JaXmgpqzwReh 1300KU9uFOY7KElD+QRCawUPhrAHT5Rnl+76TpPcDx5fJdlwzzXdLLxddY9t5xl3va e0CoValZiyzMpnDVJ250cNF3QMWajt320UsXZU5y3+e7MXYRHR2fg4muElg5CqRyeP hUylNU+7PdAaA== 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 1vKxPK-00000005ndG-0LVa; Mon, 17 Nov 2025 11:28:30 +0000 Date: Mon, 17 Nov 2025 11:28:29 +0000 Message-ID: <865xb8ucde.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christoffer Dall , Mark Brown Subject: Re: [PATCH v3 1/5] KVM: arm64: GICv3: Don't advertise ICH_HCR_EL2.En==1 when no vgic is configured In-Reply-To: References: <20251117091527.1119213-1-maz@kernel.org> <20251117091527.1119213-2-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: tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com, christoffer.dall@arm.com, broonie@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-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, 17 Nov 2025 10:34:36 +0000, Fuad Tabba wrote: > > Hi Marc, > > On Mon, 17 Nov 2025 at 09:15, Marc Zyngier wrote: > > > > Configuring GICv3 to deal with the lack of GIC in the guest relies > > on not setting ICH_HCR_EL2.En in the shadow register, as this is > > an indication of the fact that we want to trap all system registers > > to report an UNDEF in the guest. > > > > Make sure we leave vgic_hcr untouched in this case. > > > > Reported-by: Mark Brown > > Tested-by: Mark Brown > > Closes: https://lore.kernel.org/r/72e1e8b5-e397-4dc5-9cd6-a32b6af3d739@sirena.org.uk > > Fixes: 877324a1b5415 ("KVM: arm64: Revamp vgic maintenance interrupt configuration") > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/kvm/vgic/vgic-v3.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c > > index 598621b14a30d..1d6dd1b545bdd 100644 > > --- a/arch/arm64/kvm/vgic/vgic-v3.c > > +++ b/arch/arm64/kvm/vgic/vgic-v3.c > > @@ -26,6 +26,9 @@ void vgic_v3_configure_hcr(struct kvm_vcpu *vcpu, > > { > > struct vgic_v3_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v3; > > > > + if (!irqchip_in_kernel(vcpu->kvm)) > > + return; > > + > > Bear with me, since I'm not too familiar with this code. This is the > only function that initializes cpuif->vgic_hcr. Should we be > explicitly setting it to 0, or warn if ICH_HCR_EL2_En is set? It must be zero by construction, as the vcpu structure (which this is part of) is always zeroed at allocation time, and the only way to populate this field to have created an irqchip and start populating the shadow structure, right after this test. If we start doubting the state of bits of the vcpu structure that should never be written to because of some particular configuration, then we should address this globally, not piecemeal. Thanks, M. -- Without deviation from the norm, progress is not possible.