diff options
author | Alexander Graf <agraf@suse.de> | 2010-03-24 16:48:30 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:17:10 -0400 |
commit | ad0a048b096ac819f28667602285453468a8d8f9 (patch) | |
tree | 491128ccab48eb277a5cf5919a798b0507da9859 /arch/powerpc/kvm/book3s.c | |
parent | 71fbfd5f38f73515f1516a68fbe04dba198b70f0 (diff) |
KVM: PPC: Add OSI hypercall interface
MOL uses its own hypercall interface to call back into userspace when
the guest wants to do something.
So let's implement that as an exit reason, specify it with a CAP and
only really use it when userspace wants us to.
The only user of it so far is MOL.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index de12202fe1c6..7696d0f547e3 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -872,12 +872,24 @@ program_interrupt: | |||
872 | break; | 872 | break; |
873 | } | 873 | } |
874 | case BOOK3S_INTERRUPT_SYSCALL: | 874 | case BOOK3S_INTERRUPT_SYSCALL: |
875 | #ifdef EXIT_DEBUG | 875 | // XXX make user settable |
876 | printk(KERN_INFO "Syscall Nr %d\n", (int)kvmppc_get_gpr(vcpu, 0)); | 876 | if (vcpu->arch.osi_enabled && |
877 | #endif | 877 | (((u32)kvmppc_get_gpr(vcpu, 3)) == OSI_SC_MAGIC_R3) && |
878 | vcpu->stat.syscall_exits++; | 878 | (((u32)kvmppc_get_gpr(vcpu, 4)) == OSI_SC_MAGIC_R4)) { |
879 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); | 879 | u64 *gprs = run->osi.gprs; |
880 | r = RESUME_GUEST; | 880 | int i; |
881 | |||
882 | run->exit_reason = KVM_EXIT_OSI; | ||
883 | for (i = 0; i < 32; i++) | ||
884 | gprs[i] = kvmppc_get_gpr(vcpu, i); | ||
885 | vcpu->arch.osi_needed = 1; | ||
886 | r = RESUME_HOST_NV; | ||
887 | |||
888 | } else { | ||
889 | vcpu->stat.syscall_exits++; | ||
890 | kvmppc_book3s_queue_irqprio(vcpu, exit_nr); | ||
891 | r = RESUME_GUEST; | ||
892 | } | ||
881 | break; | 893 | break; |
882 | case BOOK3S_INTERRUPT_FP_UNAVAIL: | 894 | case BOOK3S_INTERRUPT_FP_UNAVAIL: |
883 | case BOOK3S_INTERRUPT_ALTIVEC: | 895 | case BOOK3S_INTERRUPT_ALTIVEC: |