From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxxfP-0007w5-HG for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxxfL-0001xs-06 for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:39 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:55867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxxfK-0001xn-P9 for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:34 -0400 Received: by mail-we0-f174.google.com with SMTP id u57so3679393wes.19 for ; Fri, 20 Jun 2014 05:11:34 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 20 Jun 2014 14:11:12 +0200 Message-Id: <1403266283-1517-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1403266283-1517-1-git-send-email-pbonzini@redhat.com> References: <1403266283-1517-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 03/14] hw/mips/cputimer: Don't start periodic timer in KVM mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Sanjay Lal , James Hogan , Aurelien Jarno From: Sanjay Lal Compare/Count timer interrupts are handled in-kernel for KVM. Therefore don't bother creating the timer at init time if KVM is enabled. This will conveniently avoid attempts to set the timeout when cpu_mips_store_count() is called at reset with KVM enabled, treating the timer as stopped so that CP0_Count is modified directly. Signed-off-by: Sanjay Lal [james.hogan@imgtec.com: Update after "target-mips: Reset CPU timer consistently" which moves timer start to reset time] Signed-off-by: James Hogan Cc: Aurelien Jarno Cc: Paolo Bonzini Signed-off-by: Paolo Bonzini --- hw/mips/cputimer.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/hw/mips/cputimer.c b/hw/mips/cputimer.c index 6900a74..577c9ae 100644 --- a/hw/mips/cputimer.c +++ b/hw/mips/cputimer.c @@ -23,6 +23,7 @@ #include "hw/hw.h" #include "hw/mips/cpudevs.h" #include "qemu/timer.h" +#include "sysemu/kvm.h" #define TIMER_FREQ 100 * 1000 * 1000 @@ -146,5 +147,11 @@ static void mips_timer_cb (void *opaque) void cpu_mips_clock_init (CPUMIPSState *env) { - env->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &mips_timer_cb, env); + /* + * If we're in KVM mode, don't create the periodic timer, that is handled in + * kernel. + */ + if (!kvm_enabled()) { + env->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &mips_timer_cb, env); + } } -- 1.7.1