aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-05-19 05:33:31 -0400
committerPaul Mackerras <paulus@ozlabs.org>2016-06-20 00:11:25 -0400
commitb69890d18fa33a53cec6ae5c93555ee0c24fe0a9 (patch)
treec67aa3cbe0695cd4ba5ff6716228ff7bd176e5de /arch/powerpc
parent708e75a3ee750dce1072134e630d66c4e6eaf63c (diff)
KVM: PPC: Book3S PR: Fix contents of SRR1 when injecting a program exception
vcpu->arch.shadow_srr1 only contains usable values for injecting a program exception into the guest if we entered the function kvmppc_handle_exit_pr() with exit_nr == BOOK3S_INTERRUPT_PROGRAM. In other cases, the shadow_srr1 bits are zero. Since we want to pass an illegal-instruction program check to the guest, set "flags" to SRR1_PROGILL for these other cases. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/book3s_pr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 8e4f64f0b774..a910fef86bba 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1049,7 +1049,17 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
1049 int emul; 1049 int emul;
1050 1050
1051program_interrupt: 1051program_interrupt:
1052 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull; 1052 /*
1053 * shadow_srr1 only contains valid flags if we came here via
1054 * a program exception. The other exceptions (emulation assist,
1055 * FP unavailable, etc.) do not provide flags in SRR1, so use
1056 * an illegal-instruction exception when injecting a program
1057 * interrupt into the guest.
1058 */
1059 if (exit_nr == BOOK3S_INTERRUPT_PROGRAM)
1060 flags = vcpu->arch.shadow_srr1 & 0x1f0000ull;
1061 else
1062 flags = SRR1_PROGILL;
1053 1063
1054 emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst); 1064 emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst);
1055 if (emul != EMULATE_DONE) { 1065 if (emul != EMULATE_DONE) {