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

Paul Mackerras paulus at ozlabs.org
Thu Oct 4 19:48:26 AEST 2018


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. :)

Paul.



More information about the Linuxppc-dev mailing list