From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF27C00449 for ; Fri, 5 Oct 2018 05:08:05 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5550C20875 for ; Fri, 5 Oct 2018 05:08:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="a9OBMyn7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5550C20875 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42RHnv3jyfzDqfd for ; Fri, 5 Oct 2018 15:08:03 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="a9OBMyn7"; dkim-atps=neutral Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42RGjW5WwrzF3JK for ; Fri, 5 Oct 2018 14:19:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="a9OBMyn7"; dkim-atps=neutral Received: by ozlabs.org (Postfix) id 42RGjW4fQDz9sBk; Fri, 5 Oct 2018 14:19:11 +1000 (AEST) Received: by ozlabs.org (Postfix, from userid 1007) id 42RGjW3YGQz9sB5; Fri, 5 Oct 2018 14:19:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1538713151; bh=etlexjHkKKXqDgYONK2eDqquzDcttqfaSG3VPsncgvY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a9OBMyn7MKyprO7mCa/lCsdwZTQy+D5y1c8xNEeGxZOaW2a3yugb9NXOJsR010jZ8 8+iMarhv+KCZ2ZYWjcTY0+zmLb8uwaqXcXWZth4q0hovbTTiN/mAysPXAornnRYF0i wAJEmAYZ8QKszepl2/9q0VpyLsFErnZ0NBB3oJX8= Date: Fri, 5 Oct 2018 13:05:46 +1000 From: David Gibson To: Paul Mackerras Subject: Re: [PATCH v4 30/32] KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode Message-ID: <20181005030546.GG7004@umbus.fritz.box> References: <1538654169-15602-1-git-send-email-paulus@ozlabs.org> <1538654169-15602-31-git-send-email-paulus@ozlabs.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1XWsVB21DFCvn2e8" Content-Disposition: inline In-Reply-To: <1538654169-15602-31-git-send-email-paulus@ozlabs.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" --1XWsVB21DFCvn2e8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 04, 2018 at 09:56:07PM +1000, Paul Mackerras wrote: > With this, the KVM-HV module can be loaded in a guest running under > KVM-HV, and if the hypervisor supports nested virtualization, this > guest can now act as a nested hypervisor and run nested guests. >=20 > This also adds some checks to inform userspace that HPT guests are not > supported by nested hypervisors, and to prevent userspace from > configuring a guest to use HPT mode. >=20 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson > --- > arch/powerpc/kvm/book3s_hv.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) >=20 > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index 7561c99..7f89b22 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -4214,6 +4214,10 @@ static int kvm_vm_ioctl_get_smmu_info_hv(struct kv= m *kvm, > { > struct kvm_ppc_one_seg_page_size *sps; > =20 > + /* If we're a nested hypervisor, we only support radix guests */ > + if (kvmhv_on_pseries()) > + return -EINVAL; > + > /* > * POWER7, POWER8 and POWER9 all support 32 storage keys for data. > * POWER7 doesn't support keys for instruction accesses, > @@ -4799,11 +4803,15 @@ static int kvmppc_core_emulate_mfspr_hv(struct kv= m_vcpu *vcpu, int sprn, > =20 > static int kvmppc_core_check_processor_compat_hv(void) > { > - if (!cpu_has_feature(CPU_FTR_HVMODE) || > - !cpu_has_feature(CPU_FTR_ARCH_206)) > - return -EIO; > + if (cpu_has_feature(CPU_FTR_HVMODE) && > + cpu_has_feature(CPU_FTR_ARCH_206)) > + return 0; > =20 > - return 0; > + /* POWER9 in radix mode is capable of being a nested hypervisor. */ > + if (cpu_has_feature(CPU_FTR_ARCH_300) && radix_enabled()) > + return 0; > + > + return -EIO; > } > =20 > #ifdef CONFIG_KVM_XICS > @@ -5121,6 +5129,10 @@ static int kvmhv_configure_mmu(struct kvm *kvm, st= ruct kvm_ppc_mmuv3_cfg *cfg) > if (radix && !radix_enabled()) > return -EINVAL; > =20 > + /* If we're a nested hypervisor, we currently only support radix */ > + if (kvmhv_on_pseries() && !radix) > + return -EINVAL; > + > mutex_lock(&kvm->lock); > if (radix !=3D kvm_is_radix(kvm)) { > if (kvm->arch.mmu_ready) { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --1XWsVB21DFCvn2e8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlu21QcACgkQbDjKyiDZ s5KsaQ/+Ow+lQ5xLI53QVFh1NXAYQoROTwORbZJo9AIFaDJOTYNJU3HC6uzS7h52 4r0h7o9YNrgX9ehoioO7ftO1BuR2+v76QhaeAV2Ivz/p1fTZ3Lg0tWMIBc51vt7U qAVRb4roYSw2UuHwMnQH+L6cNdZTXIAgaHCNBVVb2/mW1ijjOSSpGLxaL9EEL4IZ QdH/0Q2JCLXtdhCgbNC8RhtK79DCtttP3mCXAhf+Qr62UZc6rZNF+RsAsPR//KU+ b20g2YnkmIfcnXkLyW88OhBXftoWhb5upQg8us6KQujpfMtiwicaMOx46YBcSR5y ctSSuQSZG8A6OjuFLG57vqYBodnJTKOZoq8ZwT0HsJB9D1/1TmZ50Ua+AOxSlwoh 6uo9vZIZoYJUnYqhpG+HZF9c3MD+aQpMDGbRG/s45n1TOagP0OH6sJ3EE3E4yt6d uqyVLGUQmuF5jCCpHjfQkD4KoAAWUzk6GlGIk+hlFCLFOAgiODSCZoz21js9DHMm 6httcAg2ZLsc3frTHw/L+ZpoKS6phovRq5Ywlohe+UZnuLa/Gm3tyGyjcoTwVSyB V2NXulzfGvlvsP3yLvIMcsTgRPtHUYQfS76aRqUDFAdTjVXJVeXIjSCzYblkuJ0p TwjLXzxB4lKRI8XmCxk1GLQdbnjm+upo5rt0CZ16URsEShdGe1g= =5YiM -----END PGP SIGNATURE----- --1XWsVB21DFCvn2e8--