From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH v3 30/33] KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode Date: Fri, 5 Oct 2018 13:05:49 +1000 Message-ID: <20181005030549.GB13763@umbus.fritz.box> References: <1538479892-14835-1-git-send-email-paulus@ozlabs.org> <1538479892-14835-31-git-send-email-paulus@ozlabs.org> <20181003061514.GW1886@umbus.fritz.box> <20181004030321.GA16300@fergus> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kXdP64Ggrk/fb43R" Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: Paul Mackerras Return-path: Content-Disposition: inline In-Reply-To: <20181004030321.GA16300@fergus> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org --kXdP64Ggrk/fb43R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 04, 2018 at 01:03:21PM +1000, Paul Mackerras wrote: > On Wed, Oct 03, 2018 at 04:15:15PM +1000, David Gibson wrote: > > On Tue, Oct 02, 2018 at 09:31:29PM +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 > > > --- > > > 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_h= v.c > > > index f630e91..196bff1 100644 > > > --- a/arch/powerpc/kvm/book3s_hv.c > > > +++ b/arch/powerpc/kvm/book3s_hv.c > > > @@ -4237,6 +4237,10 @@ static int kvm_vm_ioctl_get_smmu_info_hv(struc= t kvm *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, > > > @@ -4822,11 +4826,15 @@ static int kvmppc_core_emulate_mfspr_hv(struc= t kvm_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; > > > + /* Can run as nested hypervisor on POWER9 in radix mode. */ > > > + if (cpu_has_feature(CPU_FTR_ARCH_300) && radix_enabled()) > >=20 > > Shouldn't we probe the parent hypervisor for ability to support nested > > guests before we say "yes" here? >=20 > Well, we do check that the parent hypervisor can support nested > hypervisors, it's just done later on. And to match nitpick with > nitpick, this is a function evaluating _processor_ compatibility, and > a POWER9 processor in radix mode does have everything necessary to > support nested hypervisors -- if the parent hypervisor doesn't support > nested hypervisors, that's not a deficiency in the processor. Fair enough. --=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 --kXdP64Ggrk/fb43R Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlu21Q0ACgkQbDjKyiDZ s5LaZQ/+ISOtAmfsFT9L5GpHWrKPPavsVVkD5knA5XNRSOL69Pyv8e+v/9nyfs+b 4U7JbgKpVuUz4rBzeMirkArDwPBQUjUhwWc3NORQMJtsTUG16k+FWb7WP/54iwHl zPeEwD2cihkQ97Akj/0OK5TI58/puaBG3/wF+c+BZPac3l0HSMSlECDWjEi3fG7v fpXYqKszFWQtCaP9lvvUvPSPFe9WzeQgGDANNo7Kh4BRXjTojc1ADL3tIMHv3FDu Uy+QiOh2jTtJ0D6xgUInKmUFIOeHjRwJ1S3R+fLIHZ14Lu0D52Ak25x14TtT5ZJw uGf8thFKcppUFh2rf5IuHvvwOgsiyLx6RHM+TY4isNnTpcF9M0jTVjDbHqDcdobm E6kf/kFzEzyAIswRB1Pe/3TTy9YGvxb0qv/Fte5qjBMHXbIEFpyXHmnPOtmtBS4V X1wrIsJpS/NDDnSZ3S842LjDYEJn/cqlY7aKyoFPaXR8vYYhJvQRn5VccGVi9Gtb pR9DBfeAFobEnonPXEUjixtH1tzPqZuOGoZD+wmmxM5d6SAD1hL8281mVF7q5Tkq R0Vqs8rTAJYkNrLl18FJ/3xcERuHM7wkt5GP3vIMh0lSOxgnS9Y6WAmJqG0qk7Tr uvyo3F3p/tWCGn7VLCheL9/zjITDyjs0LueseWEv59swVXr+Rio= =KyoE -----END PGP SIGNATURE----- --kXdP64Ggrk/fb43R--