Merge remote-tracking branches 'asoc/topic/cs4271', 'asoc/topic/cs53l30', 'asoc/topic...
[sfrench/cifs-2.6.git] / arch / powerpc / kvm / powerpc.c
index 1ee22a9100748f5cfbc276ea132a46279f8f8799..7f71ab5fcad1bbc20abaa43627c1220c3ff4e17b 100644 (file)
@@ -38,6 +38,8 @@
 #include <asm/irqflags.h>
 #include <asm/iommu.h>
 #include <asm/switch_to.h>
+#include <asm/xive.h>
+
 #include "timing.h"
 #include "irq.h"
 #include "../mm/mmu_decl.h"
@@ -697,7 +699,10 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
                kvmppc_mpic_disconnect_vcpu(vcpu->arch.mpic, vcpu);
                break;
        case KVMPPC_IRQ_XICS:
-               kvmppc_xics_free_icp(vcpu);
+               if (xive_enabled())
+                       kvmppc_xive_cleanup_vcpu(vcpu);
+               else
+                       kvmppc_xics_free_icp(vcpu);
                break;
        }
 
@@ -1522,8 +1527,12 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
 
                r = -EPERM;
                dev = kvm_device_from_filp(f.file);
-               if (dev)
-                       r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);
+               if (dev) {
+                       if (xive_enabled())
+                               r = kvmppc_xive_connect_vcpu(dev, vcpu, cap->args[1]);
+                       else
+                               r = kvmppc_xics_connect_vcpu(dev, vcpu, cap->args[1]);
+               }
 
                fdput(f);
                break;
@@ -1547,7 +1556,7 @@ bool kvm_arch_intc_initialized(struct kvm *kvm)
                return true;
 #endif
 #ifdef CONFIG_KVM_XICS
-       if (kvm->arch.xics)
+       if (kvm->arch.xics || kvm->arch.xive)
                return true;
 #endif
        return false;
@@ -1740,7 +1749,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
                r = kvm_vm_ioctl_enable_cap(kvm, &cap);
                break;
        }
-#ifdef CONFIG_PPC_BOOK3S_64
+#ifdef CONFIG_SPAPR_TCE_IOMMU
        case KVM_CREATE_SPAPR_TCE_64: {
                struct kvm_create_spapr_tce_64 create_tce_64;
 
@@ -1771,6 +1780,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
                r = kvm_vm_ioctl_create_spapr_tce(kvm, &create_tce_64);
                goto out;
        }
+#endif
+#ifdef CONFIG_PPC_BOOK3S_64
        case KVM_PPC_GET_SMMU_INFO: {
                struct kvm_ppc_smmu_info info;
                struct kvm *kvm = filp->private_data;