Message ID | 1537524123-9578-32-git-send-email-paulus@ozlabs.org |
---|---|
State | Superseded |
Headers | show |
Series | KVM: PPC: Book3S HV: Nested HV virtualization | expand |
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. > > Signed-off-by: Paul Mackerras <paulus@ozlabs.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > arch/powerpc/kvm/book3s_hv.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > 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 kvm_vcpu *vcpu, int sprn, > > 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; > > - 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; > } > > #ifdef CONFIG_KVM_XICS
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 kvm_vcpu *vcpu, int sprn, 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; - 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; } #ifdef CONFIG_KVM_XICS
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. Signed-off-by: Paul Mackerras <paulus@ozlabs.org> --- arch/powerpc/kvm/book3s_hv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)