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:
quoted
On Tue, Oct 02, 2018 at 09:31:32PM +1000, Paul Mackerras wrote:
quoted
With this, userspace can enable a KVM-HV guest to run nested guests
under it.
[snip]
quoted
quoted
+/* 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.
quoted
quoted
/* 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