All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5] KVM: PPC: e500: eliminate a trap when entering idle
@ 2011-08-26 23:31 Scott Wood
  2011-09-05 22:30 ` Alexander Graf
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Scott Wood @ 2011-08-26 23:31 UTC (permalink / raw)
  To: kvm-ppc

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 <scottwood@freescale.com>
---
 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;
+#endif
 
 free_tmp:
 	kvm_free_tmp();
@@ -796,4 +815,4 @@ free_tmp:
 	return 0;
 }
 
-postcore_initcall(kvm_guest_init);
+early_initcall(kvm_guest_init);
-- 
1.7.6



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-19 18:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 23:31 [PATCH 4/5] KVM: PPC: e500: eliminate a trap when entering idle Scott Wood
2011-09-05 22:30 ` Alexander Graf
2011-09-15 21:36 ` Scott Wood
2011-09-19  9:33 ` Alexander Graf
2011-09-19 18:46 ` Scott Wood
2011-09-19 18:50 ` Alexander Graf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.