Skip to content

Commit 1438709

Browse files
npigginmpe
authored andcommitted
KVM: PPC: Book3S HV: Save host FSCR in the P7/8 path
Similar to commit 25edcc5 ("KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path"), ensure the P7/8 path saves and restores the host FSCR. The logic explained in that patch actually applies there to the old path well: a context switch can be made before kvmppc_vcpu_run_hv restores the host FSCR and returns. Now both the p9 and the p7/8 paths now save and restore their FSCR, it no longer needs to be restored at the end of kvmppc_vcpu_run_hv Fixes: b005255 ("KVM: PPC: Book3S HV: Context-switch new POWER8 SPRs") Cc: stable@vger.kernel.org # v3.14+ Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210526125851.3436735-1-npiggin@gmail.com
1 parent 5362a4b commit 1438709

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4455,7 +4455,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu)
44554455
mtspr(SPRN_EBBRR, ebb_regs[1]);
44564456
mtspr(SPRN_BESCR, ebb_regs[2]);
44574457
mtspr(SPRN_TAR, user_tar);
4458-
mtspr(SPRN_FSCR, current->thread.fscr);
44594458
}
44604459
mtspr(SPRN_VRSAVE, user_vrsave);
44614460

arch/powerpc/kvm/book3s_hv_rmhandlers.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300)
5959
#define STACK_SLOT_UAMOR (SFS-88)
6060
#define STACK_SLOT_DAWR1 (SFS-96)
6161
#define STACK_SLOT_DAWRX1 (SFS-104)
62+
#define STACK_SLOT_FSCR (SFS-112)
6263
/* the following is used by the P9 short path */
6364
#define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */
6465

@@ -686,6 +687,8 @@ BEGIN_FTR_SECTION
686687
std r6, STACK_SLOT_DAWR0(r1)
687688
std r7, STACK_SLOT_DAWRX0(r1)
688689
std r8, STACK_SLOT_IAMR(r1)
690+
mfspr r5, SPRN_FSCR
691+
std r5, STACK_SLOT_FSCR(r1)
689692
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
690693
BEGIN_FTR_SECTION
691694
mfspr r6, SPRN_DAWR1
@@ -1663,6 +1666,10 @@ FTR_SECTION_ELSE
16631666
ld r7, STACK_SLOT_HFSCR(r1)
16641667
mtspr SPRN_HFSCR, r7
16651668
ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
1669+
BEGIN_FTR_SECTION
1670+
ld r5, STACK_SLOT_FSCR(r1)
1671+
mtspr SPRN_FSCR, r5
1672+
END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
16661673
/*
16671674
* Restore various registers to 0, where non-zero values
16681675
* set by the guest could disrupt the host.

0 commit comments

Comments
 (0)