diff options
author | Alexander Graf <agraf@suse.de> | 2012-03-13 17:15:45 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-04-08 07:01:57 -0400 |
commit | 6df79df5b27d74e0c9803d7f47bb878370996548 (patch) | |
tree | ae354d946d5fce58f1129c291daa975e36230961 /arch | |
parent | 6020c0f6e78888b6023559e9bf633ad0092a1709 (diff) |
KVM: PPC: Emulate tw and td instructions
There are 4 conditional trapping instructions: tw, twi, td, tdi. The
ones with an i take an immediate comparison, the others compare two
registers. All of them arrive in the emulator when the condition to
trap was successfully fulfilled.
Unfortunately, we were only implementing the i versions so far, so
let's also add support for the other two.
This fixes kernel booting with recents book3s_32 guest kernels.
Reported-by: Jörg Sommer <joerg@alea.gnuu.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kvm/emulate.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c index e79a620608ab..afc9154f1aef 100644 --- a/arch/powerpc/kvm/emulate.c +++ b/arch/powerpc/kvm/emulate.c | |||
@@ -35,7 +35,9 @@ | |||
35 | #define OP_TRAP 3 | 35 | #define OP_TRAP 3 |
36 | #define OP_TRAP_64 2 | 36 | #define OP_TRAP_64 2 |
37 | 37 | ||
38 | #define OP_31_XOP_TRAP 4 | ||
38 | #define OP_31_XOP_LWZX 23 | 39 | #define OP_31_XOP_LWZX 23 |
40 | #define OP_31_XOP_TRAP_64 68 | ||
39 | #define OP_31_XOP_LBZX 87 | 41 | #define OP_31_XOP_LBZX 87 |
40 | #define OP_31_XOP_STWX 151 | 42 | #define OP_31_XOP_STWX 151 |
41 | #define OP_31_XOP_STBX 215 | 43 | #define OP_31_XOP_STBX 215 |
@@ -169,6 +171,18 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) | |||
169 | case 31: | 171 | case 31: |
170 | switch (get_xop(inst)) { | 172 | switch (get_xop(inst)) { |
171 | 173 | ||
174 | case OP_31_XOP_TRAP: | ||
175 | #ifdef CONFIG_64BIT | ||
176 | case OP_31_XOP_TRAP_64: | ||
177 | #endif | ||
178 | #ifdef CONFIG_PPC_BOOK3S | ||
179 | kvmppc_core_queue_program(vcpu, SRR1_PROGTRAP); | ||
180 | #else | ||
181 | kvmppc_core_queue_program(vcpu, | ||
182 | vcpu->arch.shared->esr | ESR_PTR); | ||
183 | #endif | ||
184 | advance = 0; | ||
185 | break; | ||
172 | case OP_31_XOP_LWZX: | 186 | case OP_31_XOP_LWZX: |
173 | rt = get_rt(inst); | 187 | rt = get_rt(inst); |
174 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); | 188 | emulated = kvmppc_handle_load(run, vcpu, rt, 4, 1); |