hw/mips/cputimer: Don't start periodic timer in KVM mode
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 <sanjayl@kymasys.com> [james.hogan@imgtec.com: Update after "target-mips: Reset CPU timer consistently" which moves timer start to reset time] Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									4b69c7e265
								
							
						
					
					
						commit
						353a243e22
					
				| 
						 | 
					@ -23,6 +23,7 @@
 | 
				
			||||||
#include "hw/hw.h"
 | 
					#include "hw/hw.h"
 | 
				
			||||||
#include "hw/mips/cpudevs.h"
 | 
					#include "hw/mips/cpudevs.h"
 | 
				
			||||||
#include "qemu/timer.h"
 | 
					#include "qemu/timer.h"
 | 
				
			||||||
 | 
					#include "sysemu/kvm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TIMER_FREQ	100 * 1000 * 1000
 | 
					#define TIMER_FREQ	100 * 1000 * 1000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -146,5 +147,11 @@ static void mips_timer_cb (void *opaque)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cpu_mips_clock_init (CPUMIPSState *env)
 | 
					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);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue