Commit a722076e authored by Fabiano Rosas's avatar Fabiano Rosas Committed by Paul Mackerras

KVM: PPC: Don't always report hash MMU capability for P9 < DD2.2

These machines don't support running both MMU types at the same time,
so remove the KVM_CAP_PPC_MMU_HASH_V3 capability when the host is
using Radix MMU.

[paulus@ozlabs.org - added defensive check on
 kvmppc_hv_ops->hash_v3_possible]
Signed-off-by: default avatarFabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
parent 25edcc50
...@@ -315,6 +315,7 @@ struct kvmppc_ops { ...@@ -315,6 +315,7 @@ struct kvmppc_ops {
int (*enable_svm)(struct kvm *kvm); int (*enable_svm)(struct kvm *kvm);
int (*svm_off)(struct kvm *kvm); int (*svm_off)(struct kvm *kvm);
int (*enable_dawr1)(struct kvm *kvm); int (*enable_dawr1)(struct kvm *kvm);
bool (*hash_v3_possible)(void);
}; };
extern struct kvmppc_ops *kvmppc_hv_ops; extern struct kvmppc_ops *kvmppc_hv_ops;
......
...@@ -5625,6 +5625,15 @@ static int kvmhv_enable_dawr1(struct kvm *kvm) ...@@ -5625,6 +5625,15 @@ static int kvmhv_enable_dawr1(struct kvm *kvm)
return 0; return 0;
} }
static bool kvmppc_hash_v3_possible(void)
{
if (radix_enabled() && no_mixing_hpt_and_radix)
return false;
return cpu_has_feature(CPU_FTR_ARCH_300) &&
cpu_has_feature(CPU_FTR_HVMODE);
}
static struct kvmppc_ops kvm_ops_hv = { static struct kvmppc_ops kvm_ops_hv = {
.get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv, .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
.set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv, .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
...@@ -5669,6 +5678,7 @@ static struct kvmppc_ops kvm_ops_hv = { ...@@ -5669,6 +5678,7 @@ static struct kvmppc_ops kvm_ops_hv = {
.enable_svm = kvmhv_enable_svm, .enable_svm = kvmhv_enable_svm,
.svm_off = kvmhv_svm_off, .svm_off = kvmhv_svm_off,
.enable_dawr1 = kvmhv_enable_dawr1, .enable_dawr1 = kvmhv_enable_dawr1,
.hash_v3_possible = kvmppc_hash_v3_possible,
}; };
static int kvm_init_subcore_bitmap(void) static int kvm_init_subcore_bitmap(void)
......
...@@ -611,8 +611,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) ...@@ -611,8 +611,8 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
r = !!(hv_enabled && radix_enabled()); r = !!(hv_enabled && radix_enabled());
break; break;
case KVM_CAP_PPC_MMU_HASH_V3: case KVM_CAP_PPC_MMU_HASH_V3:
r = !!(hv_enabled && cpu_has_feature(CPU_FTR_ARCH_300) && r = !!(hv_enabled && kvmppc_hv_ops->hash_v3_possible &&
cpu_has_feature(CPU_FTR_HVMODE)); kvmppc_hv_ops->hash_v3_possible());
break; break;
case KVM_CAP_PPC_NESTED_HV: case KVM_CAP_PPC_NESTED_HV:
r = !!(hv_enabled && kvmppc_hv_ops->enable_nested && r = !!(hv_enabled && kvmppc_hv_ops->enable_nested &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment