KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode
Subsystems (2)
RFC PATCH 31/32 KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode
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 <[email protected]>
--- arch/powerpc/kvm/book3s_hv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/kvm/book3s_hv.c +8 -4
@@ -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
Signature · 1 line
2.7.4
Quoted 5 lines · Paul Mackerras
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 <[email protected]>
Reviewed-by David Gibson <[email protected]>
Quoted 28 lines
--- arch/powerpc/kvm/book3s_hv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)arch/powerpc/kvm/book3s_hv.c +8
-4@@ -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
Signature · 4 lines
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