aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r--arch/powerpc/kvm/book3s.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 34e1a342bec8..358d5f78311a 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -651,26 +651,34 @@ void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr)
651 kvmppc_recalc_shadow_msr(vcpu); 651 kvmppc_recalc_shadow_msr(vcpu);
652} 652}
653 653
654static int kvmppc_check_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr) 654static int kvmppc_read_inst(struct kvm_vcpu *vcpu)
655{ 655{
656 ulong srr0 = vcpu->arch.pc; 656 ulong srr0 = vcpu->arch.pc;
657 int ret; 657 int ret;
658 658
659 /* Need to do paired single emulation? */
660 if (!(vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE))
661 return EMULATE_DONE;
662
663 /* Read out the instruction */
664 ret = kvmppc_ld(vcpu, &srr0, sizeof(u32), &vcpu->arch.last_inst, false); 659 ret = kvmppc_ld(vcpu, &srr0, sizeof(u32), &vcpu->arch.last_inst, false);
665 if (ret == -ENOENT) { 660 if (ret == -ENOENT) {
666 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 33, 33, 1); 661 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 33, 33, 1);
667 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 34, 36, 0); 662 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 34, 36, 0);
668 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 42, 47, 0); 663 vcpu->arch.msr = kvmppc_set_field(vcpu->arch.msr, 42, 47, 0);
669 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_INST_STORAGE); 664 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_INST_STORAGE);
670 } else if(ret == EMULATE_DONE) { 665 return EMULATE_AGAIN;
666 }
667
668 return EMULATE_DONE;
669}
670
671static int kvmppc_check_ext(struct kvm_vcpu *vcpu, unsigned int exit_nr)
672{
673
674 /* Need to do paired single emulation? */
675 if (!(vcpu->arch.hflags & BOOK3S_HFLAG_PAIRED_SINGLE))
676 return EMULATE_DONE;
677
678 /* Read out the instruction */
679 if (kvmppc_read_inst(vcpu) == EMULATE_DONE)
671 /* Need to emulate */ 680 /* Need to emulate */
672 return EMULATE_FAIL; 681 return EMULATE_FAIL;
673 }
674 682
675 return EMULATE_AGAIN; 683 return EMULATE_AGAIN;
676} 684}