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 45F02FF8875 for ; Thu, 30 Apr 2026 10:26:52 +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=1r1vJLR30p7fkpRQ3dOhQxyHM5dMPa9Fa9Jt1g55gyA=; b=eUqvH0FPjVBd7FDZh3xscGkEEs XjVUZhzsN3C9WqpH9anY/3+egaeH3nmqUkYMyxJbvQgyp0rToNK6sn7WXKhl8VYHwLf8K5Zd5DkQo eQ6NnGez22yOFmhLVJH6yaQGB6q0s4salyHLKtKx5ir4f0XFa66wEPMEfseefJv4LI4iyogng0lNj AK3nFxuu88vMmyT1p9BFzIlELWViz3uSZqSkJkfeS7jP38K4DhYXADru6CJj+Qop7K9wl99LWxe9m eAy6d8+GTtTeh8J5bChhX0DuOej5loje6EqlJw2s1Rl7aKIGllp492qQtEo1mJjoMWHyhJdVodumZ G9sEAg2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wIObY-00000005C3y-1j8H; Thu, 30 Apr 2026 10:26:48 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wIObW-00000005C3e-1D9y for linux-arm-kernel@lists.infradead.org; Thu, 30 Apr 2026 10:26:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id F25A140A1F; Thu, 30 Apr 2026 10:26:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C88E9C2BCB3; Thu, 30 Apr 2026 10:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777544805; bh=VJPNiMDYvBsCB/7oxqwxMyogFYbHDES9uh5YZFRlgU8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=d049TYoYD6cypkxj2aOqTj7ABN09jRktXxudV+CFRxbWp6mgki1t1f4+csu1NuiIt FdhfiGQEBVugjWEQygsZkOARbGIO2R0nQlCCS03+YQTrX2Y817TdfFFDKYlRGtNm6K ntjPKdSWOt+WZ0XnZQw0oXYs3RklCSQLRPC1zjVfQaTFrWXKv8xbnhYKbXe09q8hK5 hT4rnrtR4eo7GORRvSiC/KoZfBmKwv3rbYNhFX9iboxLB7RmvW1KPLSFe78ITHAL5E oSw/FC0EFNMU0Yy+g31a1MMW/pcOi3wHMwRKmAgyybCa4r/dSE5sA3+KCQZmUCqxoB zpjsuQuVawZVg== 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 1wIObT-0000000GDd5-1Njb; Thu, 30 Apr 2026 10:26:43 +0000 Date: Thu, 30 Apr 2026 11:26:42 +0100 Message-ID: <86fr4czqu5.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 13/43] KVM: arm64: gic-v5: Make VPEs (non-)resident in vgic_load/put In-Reply-To: <20260427160547.3129448-14-sascha.bischoff@arm.com> References: <20260427160547.3129448-1-sascha.bischoff@arm.com> <20260427160547.3129448-14-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-20260430_032646_365067_A85002F3 X-CRM114-Status: GOOD ( 20.54 ) 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:10:28 +0100, Sascha Bischoff wrote: > > Extend vgic_v5_load and vgic_v5_put to make the VPEs resident and > non-resident, respectively. This makes the IRS aware of which VPE is > currently resident, and therefore allows it to perform HPPI selection > for LPIs and SPIs, which would otherwise never be signalled to the > VPE. > > Signed-off-by: Sascha Bischoff > --- > arch/arm64/kvm/vgic/vgic-v5.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/vgic/vgic-v5.c b/arch/arm64/kvm/vgic/vgic-v5.c > index 92bb63b6dd6bb..11a1a491b7e0a 100644 > --- a/arch/arm64/kvm/vgic/vgic-v5.c > +++ b/arch/arm64/kvm/vgic/vgic-v5.c > @@ -1053,6 +1053,8 @@ void vgic_v5_flush_ppi_state(struct kvm_vcpu *vcpu) > void vgic_v5_load(struct kvm_vcpu *vcpu) > { > struct vgic_v5_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v5; > + u16 vm = vgic_v5_vm_id(vcpu->kvm); > + u16 vpe = vgic_v5_vpe_id(vcpu); > > /* > * On the WFI path, vgic_load is called a second time. The first is when > @@ -1065,7 +1067,11 @@ void vgic_v5_load(struct kvm_vcpu *vcpu) > > kvm_call_hyp(__vgic_v5_restore_vmcr_apr, cpu_if); > > - cpu_if->gicv5_vpe.resident = true; > + cpu_if->vgic_contextr = FIELD_PREP(ICH_CONTEXTR_EL2_V, true) | > + FIELD_PREP(ICH_CONTEXTR_EL2_VPE, vpe) | > + FIELD_PREP(ICH_CONTEXTR_EL2_VM, vm); > + > + kvm_call_hyp(__vgic_v5_make_resident, cpu_if); > } > > void vgic_v5_put(struct kvm_vcpu *vcpu) > @@ -1083,7 +1089,9 @@ void vgic_v5_put(struct kvm_vcpu *vcpu) > > kvm_call_hyp(__vgic_v5_save_apr, cpu_if); > > - cpu_if->gicv5_vpe.resident = false; > + cpu_if->vgic_contextr = 0; > + > + kvm_call_hyp(__vgic_v5_make_non_resident, cpu_if); > > /* The shadow priority is only updated on entering WFI */ > if (vcpu_get_flag(vcpu, IN_WFI)) Should this patch be folded in patch #3? They seem to overlap in major ways. Thanks, M. -- Without deviation from the norm, progress is not possible.