|
@@ -52,7 +52,6 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
-#ifndef CONFIG_KVM_BOOK3S_64_HV
|
|
|
/*
|
|
|
* Common checks before entering the guest world. Call with interrupts
|
|
|
* disabled.
|
|
@@ -127,7 +126,6 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
-#endif /* CONFIG_KVM_BOOK3S_64_HV */
|
|
|
|
|
|
int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
|
|
|
{
|
|
@@ -194,11 +192,9 @@ int kvmppc_sanity_check(struct kvm_vcpu *vcpu)
|
|
|
if ((vcpu->arch.cpu_type != KVM_CPU_3S_64) && vcpu->arch.papr_enabled)
|
|
|
goto out;
|
|
|
|
|
|
-#ifdef CONFIG_KVM_BOOK3S_64_HV
|
|
|
/* HV KVM can only do PAPR mode for now */
|
|
|
- if (!vcpu->arch.papr_enabled)
|
|
|
+ if (!vcpu->arch.papr_enabled && kvmppc_ops->is_hv_enabled)
|
|
|
goto out;
|
|
|
-#endif
|
|
|
|
|
|
#ifdef CONFIG_KVM_BOOKE_HV
|
|
|
if (!cpu_has_feature(CPU_FTR_EMB_HV))
|
|
@@ -322,22 +318,26 @@ int kvm_dev_ioctl_check_extension(long ext)
|
|
|
case KVM_CAP_DEVICE_CTRL:
|
|
|
r = 1;
|
|
|
break;
|
|
|
-#ifndef CONFIG_KVM_BOOK3S_64_HV
|
|
|
case KVM_CAP_PPC_PAIRED_SINGLES:
|
|
|
case KVM_CAP_PPC_OSI:
|
|
|
case KVM_CAP_PPC_GET_PVINFO:
|
|
|
#if defined(CONFIG_KVM_E500V2) || defined(CONFIG_KVM_E500MC)
|
|
|
case KVM_CAP_SW_TLB:
|
|
|
#endif
|
|
|
-#ifdef CONFIG_KVM_MPIC
|
|
|
- case KVM_CAP_IRQ_MPIC:
|
|
|
-#endif
|
|
|
- r = 1;
|
|
|
+ /* We support this only for PR */
|
|
|
+ r = !kvmppc_ops->is_hv_enabled;
|
|
|
break;
|
|
|
+#ifdef CONFIG_KVM_MMIO
|
|
|
case KVM_CAP_COALESCED_MMIO:
|
|
|
r = KVM_COALESCED_MMIO_PAGE_OFFSET;
|
|
|
break;
|
|
|
#endif
|
|
|
+#ifdef CONFIG_KVM_MPIC
|
|
|
+ case KVM_CAP_IRQ_MPIC:
|
|
|
+ r = 1;
|
|
|
+ break;
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
|
case KVM_CAP_SPAPR_TCE:
|
|
|
case KVM_CAP_PPC_ALLOC_HTAB:
|
|
@@ -348,32 +348,37 @@ int kvm_dev_ioctl_check_extension(long ext)
|
|
|
r = 1;
|
|
|
break;
|
|
|
#endif /* CONFIG_PPC_BOOK3S_64 */
|
|
|
-#ifdef CONFIG_KVM_BOOK3S_64_HV
|
|
|
+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
|
|
|
case KVM_CAP_PPC_SMT:
|
|
|
- r = threads_per_core;
|
|
|
+ if (kvmppc_ops->is_hv_enabled)
|
|
|
+ r = threads_per_core;
|
|
|
+ else
|
|
|
+ r = 0;
|
|
|
break;
|
|
|
case KVM_CAP_PPC_RMA:
|
|
|
- r = 1;
|
|
|
+ r = kvmppc_ops->is_hv_enabled;
|
|
|
/* PPC970 requires an RMA */
|
|
|
- if (cpu_has_feature(CPU_FTR_ARCH_201))
|
|
|
+ if (r && cpu_has_feature(CPU_FTR_ARCH_201))
|
|
|
r = 2;
|
|
|
break;
|
|
|
#endif
|
|
|
case KVM_CAP_SYNC_MMU:
|
|
|
-#ifdef CONFIG_KVM_BOOK3S_64_HV
|
|
|
- r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0;
|
|
|
+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
|
|
|
+ if (kvmppc_ops->is_hv_enabled)
|
|
|
+ r = cpu_has_feature(CPU_FTR_ARCH_206) ? 1 : 0;
|
|
|
+ else
|
|
|
+ r = 0;
|
|
|
#elif defined(KVM_ARCH_WANT_MMU_NOTIFIER)
|
|
|
r = 1;
|
|
|
#else
|
|
|
r = 0;
|
|
|
- break;
|
|
|
#endif
|
|
|
-#ifdef CONFIG_KVM_BOOK3S_64_HV
|
|
|
+ break;
|
|
|
+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
|
|
|
case KVM_CAP_PPC_HTAB_FD:
|
|
|
- r = 1;
|
|
|
+ r = kvmppc_ops->is_hv_enabled;
|
|
|
break;
|
|
|
#endif
|
|
|
- break;
|
|
|
case KVM_CAP_NR_VCPUS:
|
|
|
/*
|
|
|
* Recommending a number of CPUs is somewhat arbitrary; we
|
|
@@ -381,11 +386,10 @@ int kvm_dev_ioctl_check_extension(long ext)
|
|
|
* will have secondary threads "offline"), and for other KVM
|
|
|
* implementations just count online CPUs.
|
|
|
*/
|
|
|
-#ifdef CONFIG_KVM_BOOK3S_64_HV
|
|
|
- r = num_present_cpus();
|
|
|
-#else
|
|
|
- r = num_online_cpus();
|
|
|
-#endif
|
|
|
+ if (kvmppc_ops->is_hv_enabled)
|
|
|
+ r = num_present_cpus();
|
|
|
+ else
|
|
|
+ r = num_online_cpus();
|
|
|
break;
|
|
|
case KVM_CAP_MAX_VCPUS:
|
|
|
r = KVM_MAX_VCPUS;
|