Skip to content

Commit

Permalink
arm64: KVM: vgic-v3: Only wipe LRs on vcpu exit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marc Zyngier committed Mar 9, 2016
1 parent 0d98d00 commit b40c489
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions arch/arm64/kvm/hyp/vgic-v3-sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu)
}

cpu_if->vgic_lr[i] = __gic_v3_get_lr(i);
__gic_v3_set_lr(0, i);
}

switch (nr_pri_bits) {
Expand Down Expand Up @@ -293,12 +294,10 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu)
}

for (i = 0; i <= max_lr_idx; i++) {
val = 0;

if (live_lrs & (1 << i))
val = cpu_if->vgic_lr[i];
if (!(live_lrs & (1 << i)))
continue;

__gic_v3_set_lr(val, i);
__gic_v3_set_lr(cpu_if->vgic_lr[i], i);
}
}

Expand Down

0 comments on commit b40c489

Please sign in to comment.