From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Andrew Jones <drjones@redhat.com>,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2 10/17] arm64: KVM: vgic-v2: Do not save an LR known to be empty
Date: Thu, 3 Mar 2016 00:08:15 +0100 [thread overview]
Message-ID: <20160302230815.GD9634@cbox> (raw)
In-Reply-To: <1455727249-24752-11-git-send-email-marc.zyngier@arm.com>
On Wed, Feb 17, 2016 at 04:40:42PM +0000, Marc Zyngier wrote:
> On exit, any empty LR will be signaled in GICH_ELRSR*. Which
> means that we do not have to save it, and we can just clear
> its state in the in-memory copy.
>
> Take this opportunity to move the LR saving code into its
> own function.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm64/kvm/hyp/vgic-v2-sr.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/vgic-v2-sr.c b/arch/arm64/kvm/hyp/vgic-v2-sr.c
> index c281374..3dbbc6b 100644
> --- a/arch/arm64/kvm/hyp/vgic-v2-sr.c
> +++ b/arch/arm64/kvm/hyp/vgic-v2-sr.c
> @@ -85,6 +85,25 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base)
> #endif
> }
>
> +static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base)
> +{
> + struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2;
> + int nr_lr = vcpu->arch.vgic_cpu.nr_lr;
> + int i;
> +
> + for (i = 0; i < nr_lr; i++) {
> + if (!(vcpu->arch.vgic_cpu.live_lrs & (1UL << i)))
> + continue;
> +
> + if (cpu_if->vgic_elrsr & (1UL << i)) {
> + cpu_if->vgic_lr[i] &= ~GICH_LR_STATE;
> + continue;
> + }
> +
> + cpu_if->vgic_lr[i] = readl_relaxed(base + GICH_LR0 + (i * 4));
> + }
> +}
> +
> /* vcpu is already in the HYP VA space */
> void __hyp_text __vgic_v2_save_state(struct kvm_vcpu *vcpu)
> {
> @@ -92,12 +111,10 @@ void __hyp_text __vgic_v2_save_state(struct kvm_vcpu *vcpu)
> struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2;
> struct vgic_dist *vgic = &kvm->arch.vgic;
> void __iomem *base = kern_hyp_va(vgic->vctrl_base);
> - int i, nr_lr;
>
> if (!base)
> return;
>
> - nr_lr = vcpu->arch.vgic_cpu.nr_lr;
> cpu_if->vgic_vmcr = readl_relaxed(base + GICH_VMCR);
>
> if (vcpu->arch.vgic_cpu.live_lrs) {
> @@ -105,10 +122,7 @@ void __hyp_text __vgic_v2_save_state(struct kvm_vcpu *vcpu)
>
> save_maint_int_state(vcpu, base);
> save_elrsr(vcpu, base);
> -
> - for (i = 0; i < nr_lr; i++)
> - if (vcpu->arch.vgic_cpu.live_lrs & (1UL << i))
> - cpu_if->vgic_lr[i] = readl_relaxed(base + GICH_LR0 + (i * 4));
> + save_lrs(vcpu, base);
>
> writel_relaxed(0, base + GICH_HCR);
>
> --
> 2.1.4
>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
next prev parent reply other threads:[~2016-03-02 23:08 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 16:40 [PATCH v2 00/17] KVM/ARM: Guest Entry/Exit optimizations Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 01/17] arm64: KVM: Switch the sys_reg search to be a binary search Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 02/17] ARM: KVM: Properly sort the invariant table Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 03/17] ARM: KVM: Enforce sorting of all CP tables Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 04/17] ARM: KVM: Rename struct coproc_reg::is_64 to is_64bit Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 05/17] ARM: KVM: Switch the CP reg search to be a binary search Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 06/17] KVM: arm/arm64: timer: Add active state caching Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 07/17] arm64: KVM: vgic-v2: Avoid accessing GICH registers Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 08/17] arm64: KVM: vgic-v2: Save maintenance interrupt state only if required Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall
2016-03-03 8:28 ` Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 09/17] arm64: KVM: vgic-v2: Move GICH_ELRSR saving to its own function Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 10/17] arm64: KVM: vgic-v2: Do not save an LR known to be empty Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall [this message]
2016-02-17 16:40 ` [PATCH v2 11/17] arm64: KVM: vgic-v2: Only wipe LRs on vcpu exit Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall
2016-03-03 8:14 ` Marc Zyngier
2016-03-03 15:58 ` Marc Zyngier
2016-03-04 11:36 ` Christoffer Dall
2016-03-04 11:45 ` Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 12/17] arm64: KVM: vgic-v2: Make GICD_SGIR quicker to hit Marc Zyngier
2016-03-02 23:08 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 13/17] arm64: KVM: vgic-v3: Avoid accessing ICH registers Marc Zyngier
2016-02-17 16:40 ` [PATCH v2 14/17] arm64: KVM: vgic-v3: Save maintenance interrupt state only if required Marc Zyngier
2016-03-03 19:21 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 15/17] arm64: KVM: vgic-v3: Do not save an LR known to be empty Marc Zyngier
2016-03-03 19:21 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 16/17] arm64: KVM: vgic-v3: Only wipe LRs on vcpu exit Marc Zyngier
2016-03-03 19:21 ` Christoffer Dall
2016-02-17 16:40 ` [PATCH v2 17/17] arm64: KVM: vgic-v3: Do not save ICH_AP0Rn_EL2 for GICv2 emulation Marc Zyngier
2016-03-03 19:21 ` Christoffer Dall
2016-03-04 8:54 ` Marc Zyngier
2016-02-29 0:57 ` [PATCH v2 00/17] KVM/ARM: Guest Entry/Exit optimizations Mihai Claudiu Caraman
2016-02-29 8:26 ` Marc Zyngier
2016-02-29 10:43 ` Mihai Claudiu Caraman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160302230815.GD9634@cbox \
--to=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).