Re: [PATCH 11/21] MIPS: KVM: Rewrite count/compare timer emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[...]
diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h
index f56bb699506e..57c1085fd6ab 100644
--- a/arch/mips/include/asm/kvm_host.h
+++ b/arch/mips/include/asm/kvm_host.h
@@ -404,8 +404,15 @@ struct kvm_vcpu_arch {

  	u32 io_gpr;		/* GPR used as IO source/target */

-	/* Used to calibrate the virutal count register for the guest */
-	int32_t host_cp0_count;
+	struct hrtimer comparecount_timer;
+	/* Count bias from the raw time */
+	uint32_t count_bias;
+	/* Frequency of timer in Hz */
+	uint32_t count_hz;

We are currently running with timer frequencies of over 2GHz, so the width of this variable is close to the limit.

Your follow-on patch exports this to user-space as part of the KVM ABI.

I would suggest, at least for the user-space ABI, to make this a 64-bit wide value.


+	/* Dynamic nanosecond bias (multiple of count_period) to avoid overflow */
+	s64 count_dyn_bias;
+	/* Period of timer tick in ns */
+	u64 count_period;

  	/* Bitmask of exceptions that are pending */
[...]


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux