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 53CFCCD342C for ; Wed, 6 May 2026 15:04:03 +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=B3ABkZmo+Tys72clJH32VJZ0LIeUJAKzD6QrLAYNZdk=; b=M3OthUu8kSYZT4OKvD+yyMzWbb H8t/aV0rEEA+Y5EpGHAHpQnDqTy5KQ5bYrsr+n5YoEbqRiuOIcpRz/q4Fn3sKkpHw55IeZ7NUJMaC VEyorsAglwKUR/sfaDof2Ij/bJ9JMLhnBLhOQKrj6zkkJLJ65HabYRSEr1DXhf0ZIlUZvpXurlNNn Aexh2xIvK26Ucr2XUhxkCJwbd4tcxi3nquyq0FUH6fmFPAjTMQC/zc5xY7U02Gq23Splnrnt7tBqt fzI95i4eeTcvjLmCyZ2J33RNA4NKk98e4p71ibuqt+Ds50vUEmRVBI3PcK9G6Jb90b4krQwMQYLs1 DCm4QWHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKdn3-00000001EAA-22Iq; Wed, 06 May 2026 15:03:57 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wKdn2-00000001E9V-0k9C for linux-arm-kernel@lists.infradead.org; Wed, 06 May 2026 15:03:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id ACD6C441F6; Wed, 6 May 2026 15:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBDFC2BCB8; Wed, 6 May 2026 15:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778079835; bh=9wYxQMmVtBz3DEPWlbfvcyKeSl2P2HX1/nFCNbnRXls=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RFpwT+nC2ToI8BxTZFN8/5u1tm+3XR/8IolTmSTdxDuUH4ga2bcXbIEO5MD+izzJ4 dbZ/i5b1gy9lmmy/B3/OvVn5WFeVb8oRgO3nD2f3hpUWDMZTZgotkRhXa3/atRqhAz r7EByGrr6h3BSOu4SOb9aaWOBYi8a1yaSQvIk6YV8Z/h6kzODBHBtAwKYrR3UPxN2I WOSZ4Qzk7mfCa9D7KSpaBqIKltq0ag0Cxgvwjsz5OSTkGI0WDX1RFBbDewjzTN/yBM iYQklEifxgdd1uI4wJxFNFsKsfHXGzW0u7qtRyIjEYbrxsovlw+74J9LsIXq49Zb4D mEGWB5UqF3I6w== 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 1wKdmz-00000000KcH-1ZnQ; Wed, 06 May 2026 15:03:53 +0000 Date: Wed, 06 May 2026 16:03:53 +0100 Message-ID: <861pfozijq.wl-maz@kernel.org> From: Marc Zyngier To: Sascha Bischoff Cc: "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "kvm@vger.kernel.org" , nd , "oliver.upton@linux.dev" , Joey Gouly , Suzuki Poulose , "yuzenghui@huawei.com" , "peter.maydell@linaro.org" , "lpieralisi@kernel.org" , Timothy Hayes Subject: Re: [PATCH 17/43] KVM: arm64: gic-v5: Enable VPE DBs on VPE reset and disable on teardown In-Reply-To: <20260427160547.3129448-18-sascha.bischoff@arm.com> References: <20260427160547.3129448-1-sascha.bischoff@arm.com> <20260427160547.3129448-18-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, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, nd@arm.com, oliver.upton@linux.dev, Joey.Gouly@arm.com, Suzuki.Poulose@arm.com, yuzenghui@huawei.com, peter.maydell@linaro.org, lpieralisi@kernel.org, Timothy.Hayes@arm.com 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.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260506_080356_254994_657DD1BD X-CRM114-Status: GOOD ( 28.88 ) 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, 27 Apr 2026 17:11:50 +0100, Sascha Bischoff wrote: > > Ensure that each VPE doorbell is enabled on the host prior to running > the guest by enabling it as part of vgic_v5_reset(). Add a function to > disable it again as part of VM teardown, vgic_v5_disable_vcpu(), which > also frees the IRQ again. > > Signed-off-by: Sascha Bischoff > --- > arch/arm64/kvm/vgic/vgic-v5.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/arch/arm64/kvm/vgic/vgic-v5.c b/arch/arm64/kvm/vgic/vgic-v5.c > index 9347bc6895223..48ffcb2494db3 100644 > --- a/arch/arm64/kvm/vgic/vgic-v5.c > +++ b/arch/arm64/kvm/vgic/vgic-v5.c > @@ -736,6 +736,31 @@ void vgic_v5_reset(struct kvm_vcpu *vcpu) > kvm_vm_dead(vcpu->kvm); > return; > } > + > + enable_irq(vgic_v5_vpe_db(vcpu)); Odd. Why do you need to manage the enabling of the doorbell? I see from the previous patch that you set it as IRQ_NOAUTOEN, but this seems to be cargo-culted from GICv4 (which really needs it). My expectations that since the doorbell is controlled from KVM and is only one-shot, we should be OK. This is the flow that v4.1 adopts, without a need to baby-sit the interrupt state. > +} > + > +static void vgic_v5_disable_vcpu(struct kvm_vcpu *vcpu) > +{ > + int virq = vgic_v5_vpe_db(vcpu); > + > + if (!vcpu->kvm->arch.vgic.gicv5_vm.domain) > + return; > + > + if (!virq) > + return; > + > + /* > + * We are called in the vgic_v5_teardown path. We no longer need the > + * doorbell virqs. > + */ > + disable_irq(virq); And then this can go as well. > + > + /* Free the doorbell irq (counter-part to request_irq)*/ > + free_irq(virq, vcpu); > + > + /* Remove the irq from the domain too */ > + irq_domain_free_irqs(virq, 1); Surely you remove the domain at some point. That should cover the freeing of all the doorbells. > } > > int vgic_v5_map_resources(struct kvm *kvm) > @@ -875,6 +900,10 @@ void vgic_v5_teardown(struct kvm *kvm) > kvm_err("Failed to release VM 0x%x\n", dist->gicv5_vm.vm_id); > } > > + /* Goodbye doorbells */ > + kvm_for_each_vcpu(i, vcpu, kvm) > + vgic_v5_disable_vcpu(vcpu); > + > vgic_v5_teardown_per_vm_domain(&kvm->arch.vgic.gicv5_vm); > > vgic_v5_release_vm_id(kvm); I reckon this patch would be better folded into the previous one, so that we can see both the requesting and freeing of the doorbell interrupt in the same patch. Thanks, M. -- Without deviation from the norm, progress is not possible.