summaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/book3s_pr.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@ozlabs.org>2018-05-18 21:49:28 +1000
committerPaul Mackerras <paulus@ozlabs.org>2018-05-18 21:49:28 +1000
commitec531d027ab29b0cfa1c80c8af561b0e74bd4283 (patch)
treee81d19c6c070f993afab12e844e6695c739a0115 /arch/powerpc/kvm/book3s_pr.c
parent7c1bd80cc216e7255bfabb94222676b51ab6868e (diff)
KVM: PPC: Book3S PR: Enable use on POWER9 inside HPT-mode guests
This relaxes the restriction on using PR KVM on POWER9. The existing code does work inside a guest partition running in HPT mode, because hypercalls such as H_ENTER use the old HPTE format, not the new format used by POWER9, and so no change to PR KVM's HPT manipulation code is required. PR KVM will still refuse to run if the kernel is using radix translation or if it is running bare-metal. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/kvm/book3s_pr.c')
-rw-r--r--arch/powerpc/kvm/book3s_pr.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 67061d399cd9..3d0251edc13c 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1735,9 +1735,16 @@ static void kvmppc_core_destroy_vm_pr(struct kvm *kvm)
static int kvmppc_core_check_processor_compat_pr(void)
{
/*
- * Disable KVM for Power9 untill the required bits merged.
+ * PR KVM can work on POWER9 inside a guest partition
+ * running in HPT mode. It can't work if we are using
+ * radix translation (because radix provides no way for
+ * a process to have unique translations in quadrant 3)
+ * or in a bare-metal HPT-mode host (because POWER9
+ * uses a modified HPTE format which the PR KVM code
+ * has not been adapted to use).
*/
- if (cpu_has_feature(CPU_FTR_ARCH_300))
+ if (cpu_has_feature(CPU_FTR_ARCH_300) &&
+ (radix_enabled() || cpu_has_feature(CPU_FTR_HVMODE)))
return -EIO;
return 0;
}