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 19B42D65C7C for ; Wed, 17 Dec 2025 17:14:01 +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=BD+R1++cXgo6gHoxFWYk+1hvik4vXh0vMEjmYx5ICHc=; b=Daeb+7cYwoUSLovGbRBTFKvbG3 JSbGk9BhSlWZnzOJej1TLySL8rgkRzerBpb0GO5P6S0J055X6jvHZbXfDYet7wWQqyBICimeAuJar iT09exvEJnOtrKR/w0Pcz2aPhmqln/dYKbXQ+QyspQZyoci9u9nK88RE1RS6wmbZZubyvfv+H/tYq ovLQEUf59dlpmmXolGmVT4QW+lyzeFo2z7hC6i8lnE7Oo0t/qsZyoTFuDqLExqOnyK5hopN/k7ymu 5Mfdx8UQaw01zq+cJIEzQxkd25w3Oq20Bp8SXZAlFqezAec0BdwbO7at3zadHdSlViUwyf0lbsUNF z6p0SbXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vVv63-000000079w9-0Moz; Wed, 17 Dec 2025 17:13:55 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vVv5z-000000079vl-3CAC for linux-arm-kernel@lists.infradead.org; Wed, 17 Dec 2025 17:13:52 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 06B714189D; Wed, 17 Dec 2025 17:13:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D346EC4CEF5; Wed, 17 Dec 2025 17:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765991630; bh=hP6aS6dR1CxDFuuYxfZTxYd+l+xS+uH+myfD+TNx5mg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=a58XlnQB5gxYoKgEQXiEJRyLri+G4zKwum8Y4f5pEz+1OoHI+nzMxMPsb1eMLRL/k XMeeNWqKe/5/kABESM8eQh1eV064kUQz1gsyU8SIlPI/8HkRphsbFa2TfU/ekpuqjR 6v+aNs1Iajp4c6NEWQ6yeSUHPK7pGrYPrlRFMIk4HI+Z2ZaniFTchj1pzg54/LsXZo gFT5e3lSPRfQ/+5u8iGtY7GmUaK/b3xj0Jvv/ZH3h47aNdT8lRHnA/jadbUrMMJ8di FtJtOISys39iTsREWd82FBfcS9B4a2Q3FMy2gzegNHD4/IUov93W9GgER29Z7aorhp 4vYhRL+ZDIWmg== 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 1vVv5w-0000000DRqF-1tHd; Wed, 17 Dec 2025 17:13:48 +0000 Date: Wed, 17 Dec 2025 17:13:47 +0000 Message-ID: <86v7i5m3p0.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 19/32] KVM: arm64: gic-v5: Init Private IRQs (PPIs) for GICv5 In-Reply-To: <20251212152215.675767-20-sascha.bischoff@arm.com> References: <20251212152215.675767-1-sascha.bischoff@arm.com> <20251212152215.675767-20-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.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251217_091351_870747_5CB745DD X-CRM114-Status: GOOD ( 22.89 ) 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 Fri, 12 Dec 2025 15:22:41 +0000, Sascha Bischoff wrote: > > Initialise the private interrupts (PPIs, only) for GICv5. This means > that a GICv5-style intid is generated (which encodes the PPI type in > the top bits) instead of the 0-based index that is used for older > GICs. > > Additionally, set all of the GICv5 PPIs to use Level for the handling > mode, with the exception of the SW_PPI which uses Edge. This matches > the architecturally-defined set in the GICv5 specification (the CTIIRQ > handling mode is IMPDEF, so pick Level has been picked for that). > > Signed-off-by: Sascha Bischoff > --- > arch/arm64/kvm/vgic/vgic-init.c | 41 +++++++++++++++++++++++------- > include/linux/irqchip/arm-gic-v5.h | 2 ++ > 2 files changed, 34 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c > index b246cb6eae71b..51f4443cebcef 100644 > --- a/arch/arm64/kvm/vgic/vgic-init.c > +++ b/arch/arm64/kvm/vgic/vgic-init.c > @@ -263,13 +263,19 @@ static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type) > { > struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; > int i; > + u32 num_private_irqs; > + > + if (vgic_is_v5(vcpu->kvm)) > + num_private_irqs = VGIC_V5_NR_PRIVATE_IRQS; > + else > + num_private_irqs = VGIC_NR_PRIVATE_IRQS; This is another case where we need to do something about PPIs. Allocating the full complement of PPIs (all 128 of them) is starting to be mildly visible (at 96 bytes a pop, that's 12kB of storage per vcpu). And 95% of that is guaranteed to be wasted... XArray anyone? > > lockdep_assert_held(&vcpu->kvm->arch.config_lock); It is good practice to leave this sort of assertions at the beginning of the function. Thanks, M. -- Without deviation from the norm, progress is not possible.