From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Subject: Re: [PATCH v3 33/33] KVM: PPC: Book3S HV: Add a VM capability to enable nested virtualization Date: Thu, 4 Oct 2018 19:48:26 +1000 Message-ID: <20181004094826.GC3255@fergus> References: <1538479892-14835-1-git-send-email-paulus@ozlabs.org> <1538479892-14835-34-git-send-email-paulus@ozlabs.org> <20181003062144.GY1886@umbus.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org To: David Gibson Return-path: Content-Disposition: inline In-Reply-To: <20181003062144.GY1886@umbus.fritz.box> 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 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.