On 27.08.2011, at 01:31, Scott Wood wrote:

> KVM will respond to setting MSR[WE], no matter what is in HID0.
> 
> With KVM we also know it will take effect right away, so no need for
> a loop, TLF_NAPPING, etc.
> 
> KVM paravirt's initcall is moved before SMP init, to avoid any chance
> of a race when updating the idle loop handler.
> 
> Signed-off-by: Scott Wood <[email protected]>
> ---
> arch/powerpc/kernel/kvm.c |   21 ++++++++++++++++++++-
> 1 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index eb95a03..5e13500 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -30,6 +30,7 @@
> #include <asm/cacheflush.h>
> #include <asm/disassemble.h>
> #include <asm/ppc-opcode.h>
> +#include <asm/machdep.h>
> 
> #define KVM_MAGIC_PAGE                (-4096L)
> #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
> @@ -774,6 +775,13 @@ static __init void kvm_free_tmp(void)
>       }
> }
> 
> +#ifdef CONFIG_E500
> +static void kvm_msrwe_idle(void)
> +{
> +     mtmsr(mfmsr() | MSR_WE | MSR_EE);
> +}
> +#endif
> +
> static int __init kvm_guest_init(void)
> {
>       if (!kvm_para_available())
> @@ -789,6 +797,17 @@ static int __init kvm_guest_init(void)
>       /* Enable napping */
>       powersave_nap = 1;
> #endif
> +#ifdef CONFIG_E500
> +     /*
> +      * Skip the overhead of HID0 accesses that KVM ignores --
> +      * just write MSR[WE].
> +      *
> +      * We don't need _TLF_NAPPING, because under KVM we know
> +      * it will take effect right away.
> +      */
> +     if (ppc_md.power_save == e500_idle)
> +             ppc_md.power_save = kvm_msrwe_idle;

Why the if() here?


Alex

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

Reply via email to