From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [PATCH v2 15/17] arm64: KVM: vgic-v3: Do not save an LR known to be empty Date: Thu, 3 Mar 2016 20:21:46 +0100 Message-ID: <20160303192146.GH9634@cbox> References: <1455727249-24752-1-git-send-email-marc.zyngier@arm.com> <1455727249-24752-16-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Jones , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu To: Marc Zyngier Return-path: Received: from mail-wm0-f41.google.com ([74.125.82.41]:36249 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753797AbcCCTVr (ORCPT ); Thu, 3 Mar 2016 14:21:47 -0500 Received: by mail-wm0-f41.google.com with SMTP id n186so4279843wmn.1 for ; Thu, 03 Mar 2016 11:21:46 -0800 (PST) Content-Disposition: inline In-Reply-To: <1455727249-24752-16-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Feb 17, 2016 at 04:40:47PM +0000, Marc Zyngier wrote: > On exit, any empty LR will be signaled in ICH_ELRSR_EL2. Which > means that we do not have to save it, and we can just clear > its state in the in-memory copy. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/hyp/vgic-v3-sr.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c > index 3463c0a..ff67296 100644 > --- a/arch/arm64/kvm/hyp/vgic-v3-sr.c > +++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c > @@ -190,8 +190,15 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) > save_maint_int_state(vcpu, max_lr_idx + 1); > > for (i = 0; i <= max_lr_idx; i++) { > - if (vcpu->arch.vgic_cpu.live_lrs & (1UL << i)) > - cpu_if->vgic_lr[i] = __gic_v3_get_lr(i); > + if (!(vcpu->arch.vgic_cpu.live_lrs & (1UL << i))) > + continue; > + > + if (cpu_if->vgic_elrsr & (1 << i)) { > + cpu_if->vgic_lr[i] &= ~ICH_LR_STATE; > + continue; > + } > + > + cpu_if->vgic_lr[i] = __gic_v3_get_lr(i); > } > > switch (nr_pri_bits) { > -- > 2.1.4 > Reviewed-by: Christoffer Dall