diff mbox

[04/12] KVM/MIPS: Do not start the periodic timer in KVM mode. Compare/Count timer interrupts are handled in-kernel.

Message ID 1362237527-23678-6-git-send-email-sanjayl@kymasys.com
State New
Headers show

Commit Message

Sanjay Lal March 2, 2013, 3:18 p.m. UTC
---
 hw/mips_timer.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/hw/mips_timer.c b/hw/mips_timer.c
index 83c400c..0c86a3b 100644
--- a/hw/mips_timer.c
+++ b/hw/mips_timer.c
@@ -19,11 +19,13 @@ 
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #include "hw.h"
 #include "mips_cpudevs.h"
 #include "qemu/timer.h"
 
+#include "sysemu/kvm.h"
+
+
 #define TIMER_FREQ	100 * 1000 * 1000
 
 /* XXX: do not use a global */
@@ -141,7 +143,10 @@  static void mips_timer_cb (void *opaque)
 
 void cpu_mips_clock_init (CPUMIPSState *env)
 {
-    env->timer = qemu_new_timer_ns(vm_clock, &mips_timer_cb, env);
-    env->CP0_Compare = 0;
-    cpu_mips_store_count(env, 1);
+    /* If we're in KVM mode, don't start the periodic timer, that is handled in kernel */
+    if (!kvm_enabled()) {
+        env->timer = qemu_new_timer_ns(vm_clock, &mips_timer_cb, env);
+        env->CP0_Compare = 0;
+        cpu_mips_store_count(env, 1);
+    }
 }