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/powerpc.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/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 646bfd256e5d..9a4dd8146d39 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -151,6 +151,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
151 | case KVM_CAP_PPC_PAIRED_SINGLES: | 151 | case KVM_CAP_PPC_PAIRED_SINGLES: |
152 | case KVM_CAP_PPC_UNSET_IRQ: | 152 | case KVM_CAP_PPC_UNSET_IRQ: |
153 | case KVM_CAP_ENABLE_CAP: | 153 | case KVM_CAP_ENABLE_CAP: |
154 | case KVM_CAP_PPC_OSI: | ||
154 | r = 1; | 155 | r = 1; |
155 | break; | 156 | break; |
156 | case KVM_CAP_COALESCED_MMIO: | 157 | case KVM_CAP_COALESCED_MMIO: |
@@ -433,6 +434,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
433 | if (!vcpu->arch.dcr_is_write) | 434 | if (!vcpu->arch.dcr_is_write) |
434 | kvmppc_complete_dcr_load(vcpu, run); | 435 | kvmppc_complete_dcr_load(vcpu, run); |
435 | vcpu->arch.dcr_needed = 0; | 436 | vcpu->arch.dcr_needed = 0; |
437 | } else if (vcpu->arch.osi_needed) { | ||
438 | u64 *gprs = run->osi.gprs; | ||
439 | int i; | ||
440 | |||
441 | for (i = 0; i < 32; i++) | ||
442 | kvmppc_set_gpr(vcpu, i, gprs[i]); | ||
443 | vcpu->arch.osi_needed = 0; | ||
436 | } | 444 | } |
437 | 445 | ||
438 | kvmppc_core_deliver_interrupts(vcpu); | 446 | kvmppc_core_deliver_interrupts(vcpu); |
@@ -475,6 +483,10 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, | |||
475 | return -EINVAL; | 483 | return -EINVAL; |
476 | 484 | ||
477 | switch (cap->cap) { | 485 | switch (cap->cap) { |
486 | case KVM_CAP_PPC_OSI: | ||
487 | r = 0; | ||
488 | vcpu->arch.osi_enabled = true; | ||
489 | break; | ||
478 | default: | 490 | default: |
479 | r = -EINVAL; | 491 | r = -EINVAL; |
480 | break; | 492 | break; |