[PATCH v3 33/33] KVM: PPC: Book3S HV: Add a VM capability to enable nested virtualization

David Gibson david at gibson.dropbear.id.au
Fri Oct 5 13:29:23 AEST 2018


On Thu, Oct 04, 2018 at 07:48:26PM +1000, Paul Mackerras wrote:
> On Wed, Oct 03, 2018 at 04:21:44PM +1000, David Gibson wrote:
> > On Tue, Oct 02, 2018 at 09:31:32PM +1000, Paul Mackerras wrote:
> > > With this, userspace can enable a KVM-HV guest to run nested guests
> > > under it.
> [snip]
> > > +/* If set, guests are allowed to create and control nested guests */
> > > +static bool enable_nested = true;
> > > +module_param(enable_nested, bool, S_IRUGO | S_IWUSR);
> > > +MODULE_PARM_DESC(enable_nested, "Enable nested virtualization (only on POWER9)");
> > 
> > I'd suggest calling the module parameter just "nested" to match x86.
> 
> OK.
> 
> > >  /* If set, the threads on each CPU core have to be in the same MMU mode */
> > >  static bool no_mixing_hpt_and_radix;
> > >  
> > > @@ -5188,6 +5193,17 @@ static int kvmhv_configure_mmu(struct kvm *kvm, struct kvm_ppc_mmuv3_cfg *cfg)
> > >  	return err;
> > >  }
> > >  
> > > +static int kvmhv_enable_nested(struct kvm *kvm, bool enable)
> > > +{
> > > +	if (!(enable_nested && cpu_has_feature(CPU_FTR_ARCH_300)))
> > > +		return -EINVAL;
> > 
> > Maybe EPERM, rather than EINVAL.  There's nothing invalid about the
> > ioctl() parameters - we just can't do what they want.
> 
> Just for pedantry's sake, I'll make it EPERM for !enable_nested and
> ENODEV for !POWER9. :)

Sounds fair.

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20181005/34d544a2/attachment-0001.sig>


More information about the Linuxppc-dev mailing list