KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
Subsystems (3)
PATCH 1/1 KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
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().
--- arch/powerpc/kvm/book3s_hv.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kvm/book3s_hv.c +1 -0
@@ -3677,6 +3677,7 @@ out: kfree(hvregs); 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 ();
Signature · 1 line
2.13.6
Quoted 5 lines · Suraj Jitindar Singh
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.
Quoted 7 lines
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().Fixes 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")Signed-off-by Suraj Jitindar Singh <[email protected]>
Thanks, patch applied to my kvm-ppc-fixes branch.
Paul.