]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/powerpc/kvm/powerpc.c
kvm: add stubs for arch specific debugfs support
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / kvm / powerpc.c
index 02416fea765301303c0130d3900a1f929319582f..70963c845e968e3feed8d5942e72f0329e34a2e4 100644 (file)
@@ -27,6 +27,8 @@
 #include <linux/slab.h>
 #include <linux/file.h>
 #include <linux/module.h>
+#include <linux/irqbypass.h>
+#include <linux/kvm_irqfd.h>
 #include <asm/cputable.h>
 #include <asm/uaccess.h>
 #include <asm/kvm_ppc.h>
@@ -119,7 +121,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
                        continue;
                }
 
-               __kvm_guest_enter();
+               guest_enter_irqoff();
                return 1;
        }
 
@@ -436,6 +438,16 @@ err_out:
        return -EINVAL;
 }
 
+bool kvm_arch_has_vcpu_debugfs(void)
+{
+       return false;
+}
+
+int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu)
+{
+       return 0;
+}
+
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        unsigned int i;
@@ -588,6 +600,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
                r = 1;
                break;
 #endif
+       case KVM_CAP_PPC_HTM:
+               r = cpu_has_feature(CPU_FTR_TM_COMP) &&
+                   is_kvmppc_hv_enabled(kvm);
+               break;
        default:
                r = 0;
                break;
@@ -735,6 +751,42 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
 #endif
 }
 
+/*
+ * irq_bypass_add_producer and irq_bypass_del_producer are only
+ * useful if the architecture supports PCI passthrough.
+ * irq_bypass_stop and irq_bypass_start are not needed and so
+ * kvm_ops are not defined for them.
+ */
+bool kvm_arch_has_irq_bypass(void)
+{
+       return ((kvmppc_hv_ops && kvmppc_hv_ops->irq_bypass_add_producer) ||
+               (kvmppc_pr_ops && kvmppc_pr_ops->irq_bypass_add_producer));
+}
+
+int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
+                                    struct irq_bypass_producer *prod)
+{
+       struct kvm_kernel_irqfd *irqfd =
+               container_of(cons, struct kvm_kernel_irqfd, consumer);
+       struct kvm *kvm = irqfd->kvm;
+
+       if (kvm->arch.kvm_ops->irq_bypass_add_producer)
+               return kvm->arch.kvm_ops->irq_bypass_add_producer(cons, prod);
+
+       return 0;
+}
+
+void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
+                                     struct irq_bypass_producer *prod)
+{
+       struct kvm_kernel_irqfd *irqfd =
+               container_of(cons, struct kvm_kernel_irqfd, consumer);
+       struct kvm *kvm = irqfd->kvm;
+
+       if (kvm->arch.kvm_ops->irq_bypass_del_producer)
+               kvm->arch.kvm_ops->irq_bypass_del_producer(cons, prod);
+}
+
 static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
                                       struct kvm_run *run)
 {
@@ -1163,6 +1215,19 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
        return r;
 }
 
+bool kvm_arch_intc_initialized(struct kvm *kvm)
+{
+#ifdef CONFIG_KVM_MPIC
+       if (kvm->arch.mpic)
+               return true;
+#endif
+#ifdef CONFIG_KVM_XICS
+       if (kvm->arch.xics)
+               return true;
+#endif
+       return false;
+}
+
 int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
                                     struct kvm_mp_state *mp_state)
 {