From: David Gibson Date: Thu, 27 Sep 2018 04:59:46 +0000 Subject: Re: [RFC PATCH 31/32] KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode Message-Id: <20180927045946.GR30868@umbus.fritz.box> MIME-Version: 1 Content-Type: multipart/mixed; boundary="O7V8ezaGjq23HET0" List-Id: References: <1537524123-9578-32-git-send-email-paulus@ozlabs.org> In-Reply-To: <1537524123-9578-32-git-send-email-paulus@ozlabs.org> To: kvm-ppc@vger.kernel.org --O7V8ezaGjq23HET0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 21, 2018 at 08:02:02PM +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 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson > --- > arch/powerpc/kvm/book3s_hv.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index e6e3a78..570aa93 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -4806,11 +4806,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; > + /* Can run as nested hypervisor on POWER9 in radix mode. */ > + if (cpu_has_feature(CPU_FTR_ARCH_300) && radix_enabled()) > + return 0; > + > + return -EIO; > } > =20 > #ifdef CONFIG_KVM_XICS --=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 --O7V8ezaGjq23HET0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlusY8IACgkQbDjKyiDZ s5JOvA/9FEH1qGWXUEyvjJrgtqZ8gTKCvPz4BoofP5NCeUBhUMQUKwaka4DdKblK 68PRLguun15k25lnDQuCI3ja4Tmfl7tCuihUE0VjVWh4sOH5PTLG35j0ZhA+DG6c glctZGY4W9eEmMgSTH6zUzW5wHQiNAbrcPouPJhEXYrO8MP5kKXDo1jWdx0eTTyK Za/7Vt8iFNyH84/AW4f9uSE0h+02hBPN1tmV/uO1AWPLV6CAae2O/fJGJPqY3B2O 8Xj72s5FOQ2V7VE9C0CqDNZjIxNnDC7vwjdQBDLzNkaIjeK9aQZbxZHV9IJxOi36 zTPg27Y0GeKx+lB95auKcl9/St93zrJVv0cB4jED81klHgKZKEZvucMkDTS/urmK 0L/OgyqN+Wv8fzAmyN3VKqVfTD5kMXBfiUlhhaX28Aa+D7kkZliT7kMSZA+98UVo WZiv7/45RDDWbg8UooySlNneLhwAFtWQx+VbeTa6Od1l7b34gmFgDRAQ1j9vu8yK 0S4hQa/OcAwNYtYgHj/T1kn9g+jH6JuSgHV96DJgZvyHYwj93O3YRNPF8811K6EJ N67IRlvxwmt1jF/FpWi/k179OAXebC+esW5d8GEWVllIA7SkMf3JtzcLL36OM0zG TeW3W8fNblDAofK1sur3WbZwS2ZP+rBH6hWEAC30N+sCO3heG/s= =T8/N -----END PGP SIGNATURE----- --O7V8ezaGjq23HET0--