aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSuresh E. Warrier <warrier@linux.vnet.ibm.com>2014-11-02 23:46:42 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2014-11-11 23:53:25 -0500
commit8b91a2554610ac5e341de8fb0b5715fe90a0f2e2 (patch)
tree674e4e96d56efa88a6d2562e2e4f93d3a55ebd7c /arch
parentd1d5304fcbc519f5fb12cbcca9c4fdd1d94447d7 (diff)
powerpc: Save/restore PPR for KVM hypercalls
The system call FLIH (first-level interrupt handler) at 0xc00 unconditionally sets hardware priority to medium. For hypercalls, this means we lose guest OS priority. The front end (do_kvm_0x**) to the KVM interrupt handler always assumes that PPR priority is saved in PACA exception save area, so it copies this to the kvm_hstate structure. For hypercalls, this would be the saved priority from any previous exception. Eventually, the guest gets resumed with an incorrect priority. The fix is to save the PPR priority in PACA exception save area before switching HMT priorities in the FLIH so that existing code described above in the KVM interrupt handler can copy it from there into the VCPU's saved context. Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org> [mpe: Dropped HMT_MEDIUM_PPR_DISCARD and reworded comment] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 72e783ea0681..a1d45c161e24 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -292,15 +292,26 @@ decrementer_pSeries:
292 . = 0xc00 292 . = 0xc00
293 .globl system_call_pSeries 293 .globl system_call_pSeries
294system_call_pSeries: 294system_call_pSeries:
295 HMT_MEDIUM 295 /*
296 * If CONFIG_KVM_BOOK3S_64_HANDLER is set, save the PPR (on systems
297 * that support it) before changing to HMT_MEDIUM. That allows the KVM
298 * code to save that value into the guest state (it is the guest's PPR
299 * value). Otherwise just change to HMT_MEDIUM as userspace has
300 * already saved the PPR.
301 */
296#ifdef CONFIG_KVM_BOOK3S_64_HANDLER 302#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
297 SET_SCRATCH0(r13) 303 SET_SCRATCH0(r13)
298 GET_PACA(r13) 304 GET_PACA(r13)
299 std r9,PACA_EXGEN+EX_R9(r13) 305 std r9,PACA_EXGEN+EX_R9(r13)
306 OPT_GET_SPR(r9, SPRN_PPR, CPU_FTR_HAS_PPR);
307 HMT_MEDIUM;
300 std r10,PACA_EXGEN+EX_R10(r13) 308 std r10,PACA_EXGEN+EX_R10(r13)
309 OPT_SAVE_REG_TO_PACA(PACA_EXGEN+EX_PPR, r9, CPU_FTR_HAS_PPR);
301 mfcr r9 310 mfcr r9
302 KVMTEST(0xc00) 311 KVMTEST(0xc00)
303 GET_SCRATCH0(r13) 312 GET_SCRATCH0(r13)
313#else
314 HMT_MEDIUM;
304#endif 315#endif
305 SYSCALL_PSERIES_1 316 SYSCALL_PSERIES_1
306 SYSCALL_PSERIES_2_RFID 317 SYSCALL_PSERIES_2_RFID