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 BF38248B368; Wed, 6 May 2026 15:03:55 +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=1778079835; cv=none; b=SFlnkra1FIP5Bz98Lm1rM15C/Lrmzx/5Wj9CnXdVegIYq4Nnv2x0FQ1xNkbSKmUsY/n1RG5DGfqTAkZebfIIwiDqAlwzymQL63D4HpiAsmjBV/Ovz6d9ddEXC/Y/YWTJujdyYukXVP2ZvyDcpxxGnVZuMgmM5ULmElgDgXJWR6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778079835; c=relaxed/simple; bh=9wYxQMmVtBz3DEPWlbfvcyKeSl2P2HX1/nFCNbnRXls=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=NY59RNhTisbpgGLE8Br1GHz+U0m7LYcY3rb12iPUh0KZTj6VrH461el32Gh1hWTForJ+o+wGzJT8d9Ct2XlajY+43kha2NZg4FZXqLJWxuR90RYLwlObQAg1H39UTLgM/3GQCxPzkDVgGRG4f1kW18/KDXlPWzRAIoJKP+oH4GQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RFpwT+nC; 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="RFpwT+nC" 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) Precedence: bulk X-Mailing-List: kvm@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, 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 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.