Skip to content

Commit 44b198a

Browse files
sjitindarsinghpaulusmack
authored andcommitted
KVM: PPC: Book3S HV: Save/restore vrsave register in kvmhv_p9_guest_entry()
On POWER9 and later processors where the host can schedule vcpus on a per thread basis, there is a streamlined entry path used when the guest is radix. This entry path saves/restores the fp and vr state in kvmhv_p9_guest_entry() by calling store_[fp/vr]_state() and load_[fp/vr]_state(). This is the same as the old entry path however the old entry path also saved/restored the VRSAVE register, which isn't done in the new entry path. This means that the vrsave register is now volatile across guest exit, which is an incorrect change in behaviour. Fix this by saving/restoring the vrsave register in kvmhv_p9_guest_entry(). This restores the old, correct, behaviour. Fixes: 95a6432 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests") Signed-off-by: Suraj Jitindar Singh <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 70ea13f commit 44b198a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,6 +3549,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
35493549
#ifdef CONFIG_ALTIVEC
35503550
load_vr_state(&vcpu->arch.vr);
35513551
#endif
3552+
mtspr(SPRN_VRSAVE, vcpu->arch.vrsave);
35523553

35533554
mtspr(SPRN_DSCR, vcpu->arch.dscr);
35543555
mtspr(SPRN_IAMR, vcpu->arch.iamr);
@@ -3640,6 +3641,7 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
36403641
#ifdef CONFIG_ALTIVEC
36413642
store_vr_state(&vcpu->arch.vr);
36423643
#endif
3644+
vcpu->arch.vrsave = mfspr(SPRN_VRSAVE);
36433645

36443646
if (cpu_has_feature(CPU_FTR_TM) ||
36453647
cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST))

0 commit comments

Comments
 (0)