diff options
author | Scott Wood <scottwood@freescale.com> | 2013-04-12 10:08:47 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-04-26 14:27:24 -0400 |
commit | eb1e4f43e0f47f2655372c7d32c43db9711c278e (patch) | |
tree | ac084d48a5590f6ca712242e0ca139abf57250a5 /arch/powerpc/kvm/powerpc.c | |
parent | 5df554ad5b7522ea62b0ff9d5be35183494efc21 (diff) |
kvm/ppc/mpic: add KVM_CAP_IRQ_MPIC
Enabling this capability connects the vcpu to the designated in-kernel
MPIC. Using explicit connections between vcpus and irqchips allows
for flexibility, but the main benefit at the moment is that it
simplifies the code -- KVM doesn't need vm-global state to remember
which MPIC object is associated with this vm, and it doesn't need to
care about ordering between irqchip creation and vcpu creation.
Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: add stub functions for kvmppc_mpic_{dis,}connect_vcpu]
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 88d69cf1f953..5d046bbdf11f 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/hrtimer.h> | 25 | #include <linux/hrtimer.h> |
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/file.h> | ||
28 | #include <asm/cputable.h> | 29 | #include <asm/cputable.h> |
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <asm/kvm_ppc.h> | 31 | #include <asm/kvm_ppc.h> |
@@ -327,6 +328,9 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
327 | #if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) | 328 | #if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC) |
328 | case KVM_CAP_SW_TLB: | 329 | case KVM_CAP_SW_TLB: |
329 | #endif | 330 | #endif |
331 | #ifdef CONFIG_KVM_MPIC | ||
332 | case KVM_CAP_IRQ_MPIC: | ||
333 | #endif | ||
330 | r = 1; | 334 | r = 1; |
331 | break; | 335 | break; |
332 | case KVM_CAP_COALESCED_MMIO: | 336 | case KVM_CAP_COALESCED_MMIO: |
@@ -460,6 +464,13 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
460 | tasklet_kill(&vcpu->arch.tasklet); | 464 | tasklet_kill(&vcpu->arch.tasklet); |
461 | 465 | ||
462 | kvmppc_remove_vcpu_debugfs(vcpu); | 466 | kvmppc_remove_vcpu_debugfs(vcpu); |
467 | |||
468 | switch (vcpu->arch.irq_type) { | ||
469 | case KVMPPC_IRQ_MPIC: | ||
470 | kvmppc_mpic_disconnect_vcpu(vcpu->arch.mpic, vcpu); | ||
471 | break; | ||
472 | } | ||
473 | |||
463 | kvmppc_core_vcpu_free(vcpu); | 474 | kvmppc_core_vcpu_free(vcpu); |
464 | } | 475 | } |
465 | 476 | ||
@@ -787,6 +798,25 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, | |||
787 | break; | 798 | break; |
788 | } | 799 | } |
789 | #endif | 800 | #endif |
801 | #ifdef CONFIG_KVM_MPIC | ||
802 | case KVM_CAP_IRQ_MPIC: { | ||
803 | struct file *filp; | ||
804 | struct kvm_device *dev; | ||
805 | |||
806 | r = -EBADF; | ||
807 | filp = fget(cap->args[0]); | ||
808 | if (!filp) | ||
809 | break; | ||
810 | |||
811 | r = -EPERM; | ||
812 | dev = kvm_device_from_filp(filp); | ||
813 | if (dev) | ||
814 | r = kvmppc_mpic_connect_vcpu(dev, vcpu, cap->args[1]); | ||
815 | |||
816 | fput(filp); | ||
817 | break; | ||
818 | } | ||
819 | #endif | ||
790 | default: | 820 | default: |
791 | r = -EINVAL; | 821 | r = -EINVAL; |
792 | break; | 822 | break; |