Alexander Graf wrote:
> X86 CPUs need to have some magic happening to enable the
> virtualization 
> extensions on them. This magic can result in unpleasant results for
> users, like blocking other VMMs from working (vmx) or using invalid
> TLB 
> entries (svm).
> 
> Currently KVM activates virtualization when the respective kernel
> module 
> is loaded. This blocks us from autoloading KVM modules without
> breaking 
> other VMMs.
> 
> To circumvent this problem at least a bit, this patch introduces on
> demand activation of virtualization. This means, that instead
> virtualization is enabled on creation of the first virtual machine
> and disabled on removal of the last one.
> 
> So using this, KVM can be easily autoloaded, while keeping other
> hypervisors usable.
> 
> v2 adds returns to non-x86 hardware_enables and adds IA64 change
> 
> Signed-off-by: Alexander Graf <[EMAIL PROTECTED]>
> ---
>  arch/ia64/kvm/kvm-ia64.c   |    8 +++--
>  arch/powerpc/kvm/powerpc.c |    3 +-
>  arch/s390/kvm/kvm-s390.c   |    3 +-
>  arch/x86/kvm/svm.c         |   13 +++++--
>  arch/x86/kvm/vmx.c         |    7 ++++-
>  arch/x86/kvm/x86.c         |    4 +-
>  include/asm-x86/kvm_host.h |    2 +-
>  include/linux/kvm_host.h   |    2 +-
>  virt/kvm/kvm_main.c        |   72
>  +++++++++++++++++++++++++++++++------------ 9 files changed, 80
> insertions(+), 34 deletions(-) 
> 
> diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
> index c25c75b..2bd79db 100644
> --- a/arch/ia64/kvm/kvm-ia64.c
> +++ b/arch/ia64/kvm/kvm-ia64.c
> @@ -110,7 +110,7 @@ long ia64_pal_vp_create(u64 *vpd, u64 *host_iva,
> u64 *opt_handler) 
> 
>  static  DEFINE_SPINLOCK(vp_lock);
> 
> -void kvm_arch_hardware_enable(void *garbage)
> +int kvm_arch_hardware_enable(void *garbage)
>  {
>       long  status;
>       long  tmp_base;
> @@ -124,7 +124,7 @@ void kvm_arch_hardware_enable(void *garbage)
>       slot = ia64_itr_entry(0x3, KVM_VMM_BASE, pte, KVM_VMM_SHIFT);
>       local_irq_restore(saved_psr);
>       if (slot < 0)
> -             return;
> +             return -ENOMEM;

Return -EINVAL maybe more accurate. Here slot < 0 means invalid or uncorrect 
parameters are passed to ia64_itr_entry. 
Xiantao

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to