diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2016-02-09 12:36:09 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2016-03-08 23:24:16 -0500 |
commit | b40c4892d175874d118860c8282a85ee7b64bcbb (patch) | |
tree | 407775d1301cab464839669a1446d3e41c92cb4f | |
parent | 0d98d00b8d80bfdee95cf7e85f20f107377e2662 (diff) |
arm64: KVM: vgic-v3: Only wipe LRs on vcpu exit
So far, we're always writing all possible LRs, setting the empty
ones with a zero value. This is obvious doing a low of work for
nothing, and we're better off clearing those we've actually
dirtied on the exit path (it is very rare to inject more than one
interrupt at a time anyway).
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | arch/arm64/kvm/hyp/vgic-v3-sr.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c index 81349479e17c..fff7cd42b3a3 100644 --- a/arch/arm64/kvm/hyp/vgic-v3-sr.c +++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c | |||
@@ -196,6 +196,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | cpu_if->vgic_lr[i] = __gic_v3_get_lr(i); | 198 | cpu_if->vgic_lr[i] = __gic_v3_get_lr(i); |
199 | __gic_v3_set_lr(0, i); | ||
199 | } | 200 | } |
200 | 201 | ||
201 | switch (nr_pri_bits) { | 202 | switch (nr_pri_bits) { |
@@ -293,12 +294,10 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) | |||
293 | } | 294 | } |
294 | 295 | ||
295 | for (i = 0; i <= max_lr_idx; i++) { | 296 | for (i = 0; i <= max_lr_idx; i++) { |
296 | val = 0; | 297 | if (!(live_lrs & (1 << i))) |
297 | 298 | continue; | |
298 | if (live_lrs & (1 << i)) | ||
299 | val = cpu_if->vgic_lr[i]; | ||
300 | 299 | ||
301 | __gic_v3_set_lr(val, i); | 300 | __gic_v3_set_lr(cpu_if->vgic_lr[i], i); |
302 | } | 301 | } |
303 | } | 302 | } |
304 | 303 | ||