diff options
Diffstat (limited to 'arch/powerpc/include/asm/kvm_book3s.h')
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index bc23b1ba7980..83851aabfdc8 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h | |||
@@ -186,9 +186,6 @@ extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr, | |||
186 | 186 | ||
187 | extern void kvmppc_entry_trampoline(void); | 187 | extern void kvmppc_entry_trampoline(void); |
188 | extern void kvmppc_hv_entry_trampoline(void); | 188 | extern void kvmppc_hv_entry_trampoline(void); |
189 | extern void kvmppc_load_up_fpu(void); | ||
190 | extern void kvmppc_load_up_altivec(void); | ||
191 | extern void kvmppc_load_up_vsx(void); | ||
192 | extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst); | 189 | extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst); |
193 | extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst); | 190 | extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst); |
194 | extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd); | 191 | extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd); |
@@ -271,16 +268,25 @@ static inline ulong kvmppc_get_pc(struct kvm_vcpu *vcpu) | |||
271 | return vcpu->arch.pc; | 268 | return vcpu->arch.pc; |
272 | } | 269 | } |
273 | 270 | ||
274 | static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu) | 271 | static inline bool kvmppc_need_byteswap(struct kvm_vcpu *vcpu) |
275 | { | 272 | { |
276 | ulong pc = kvmppc_get_pc(vcpu); | 273 | return (vcpu->arch.shared->msr & MSR_LE) != (MSR_KERNEL & MSR_LE); |
274 | } | ||
277 | 275 | ||
276 | static inline u32 kvmppc_get_last_inst_internal(struct kvm_vcpu *vcpu, ulong pc) | ||
277 | { | ||
278 | /* Load the instruction manually if it failed to do so in the | 278 | /* Load the instruction manually if it failed to do so in the |
279 | * exit path */ | 279 | * exit path */ |
280 | if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED) | 280 | if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED) |
281 | kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false); | 281 | kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false); |
282 | 282 | ||
283 | return vcpu->arch.last_inst; | 283 | return kvmppc_need_byteswap(vcpu) ? swab32(vcpu->arch.last_inst) : |
284 | vcpu->arch.last_inst; | ||
285 | } | ||
286 | |||
287 | static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu) | ||
288 | { | ||
289 | return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu)); | ||
284 | } | 290 | } |
285 | 291 | ||
286 | /* | 292 | /* |
@@ -290,14 +296,7 @@ static inline u32 kvmppc_get_last_inst(struct kvm_vcpu *vcpu) | |||
290 | */ | 296 | */ |
291 | static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu) | 297 | static inline u32 kvmppc_get_last_sc(struct kvm_vcpu *vcpu) |
292 | { | 298 | { |
293 | ulong pc = kvmppc_get_pc(vcpu) - 4; | 299 | return kvmppc_get_last_inst_internal(vcpu, kvmppc_get_pc(vcpu) - 4); |
294 | |||
295 | /* Load the instruction manually if it failed to do so in the | ||
296 | * exit path */ | ||
297 | if (vcpu->arch.last_inst == KVM_INST_FETCH_FAILED) | ||
298 | kvmppc_ld(vcpu, &pc, sizeof(u32), &vcpu->arch.last_inst, false); | ||
299 | |||
300 | return vcpu->arch.last_inst; | ||
301 | } | 300 | } |
302 | 301 | ||
303 | static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu) | 302 | static inline ulong kvmppc_get_fault_dar(struct kvm_vcpu *vcpu) |