Skip to content

Commit

Permalink
KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
Browse files Browse the repository at this point in the history
The sprgs are a set of 4 general purpose sprs provided for software use.
SPRG3 is special in that it can also be read from userspace. Thus it is
used on linux to store the cpu and numa id of the process to speed up
syscall access to this information.

This register is overwritten with the guest value on kvm guest entry,
and so needs to be restored on exit again. Thus restore the value on
the guest exit path in kvmhv_p9_guest_entry().

Cc: stable@vger.kernel.org # v4.20+
Fixes: 95a6432 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
  • Loading branch information
Suraj Jitindar Singh authored and Paul Mackerras committed May 30, 2019
1 parent 1b28d55 commit d724c9e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/kvm/book3s_hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3662,6 +3662,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
vc->in_guest = 0;

mtspr(SPRN_DEC, local_paca->kvm_hstate.dec_expires - mftb());
mtspr(SPRN_SPRG_VDSO_WRITE, local_paca->sprg_vdso);

kvmhv_load_host_pmu();

Expand Down

0 comments on commit d724c9e

Please sign in to comment.