From patchwork Sat May 19 05:56:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 916766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="xS4oPJaW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40nvSM2YGnz9s4r for ; Sat, 19 May 2018 15:56:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750769AbeESF4u (ORCPT ); Sat, 19 May 2018 01:56:50 -0400 Received: from ozlabs.org ([203.11.71.1]:47333 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766AbeESF4t (ORCPT ); Sat, 19 May 2018 01:56:49 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 40nvSJ1k8lz9s5R; Sat, 19 May 2018 15:56:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1526709408; bh=Qlfu/UQlKCLzXDG+7DVHSbP++IV53ope11KPlb0DPws=; h=Date:From:To:Subject:From; b=xS4oPJaW3gu6UweZW6BK5BZPLJdnP440y6soQHqGpcvWrvfkd+zdAUwjAmac9u8cp K+/n1891IWrRruOXA1cJo3ntbPUDWUuSFVzcA7fwzawAxq0sjO41JLXoR+KBiMuB2J 6BP2S4sRcJw+6lW+n8koVeUWaaklV08sqVVUG26sLiAzzUYsucOeZudLnAbJRsKzvs wVP9rVbFg/H36FZOk3DmhxetNlwJNW9w/25RnWdoBTo7BWVSgBAE0QiYTdmGaMejYH uqoYuOroJ2eHNSeAM6e7e7g2eZJL5uhzV5DvO3mi3YqHhJVcUCVFnco9v8TQChxWpA TyLobZkLf/9GA== Date: Sat, 19 May 2018 15:56:38 +1000 From: Paul Mackerras To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH] KVM: PPC: Book3S PR: Enable use on POWER9 inside HPT-mode guests Message-ID: <20180519055638.GA24787@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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 Tested-by: Greg Kurz --- arch/powerpc/kvm/book3s_pr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 67061d3..3d0251e 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; }