MIPS: KVM: Override guest kernel timer frequency directly

The KVM_HOST_FREQ Kconfig symbol was used by KVM guest kernels to
override the timer frequency calculation to a value based on the host
frequency. Now that the KVM timer emulation is implemented independent
of the host timer frequency and defaults to 100MHz, adjust the working
of CONFIG_KVM_HOST_FREQ to match.

The Kconfig symbol now specifies the guest timer frequency directly, and
has been renamed accordingly to KVM_GUEST_TIMER_FREQ. It now defaults to
100MHz too and the help text is updated to make it clear that a zero
value will allow the normal timer frequency calculation to take place
(based on the emulated RTC).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: Sanjay Lal <sanjayl@kymasys.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
James Hogan 2014-05-29 10:16:36 +01:00 committed by Paolo Bonzini
parent e30492bbe9
commit eda3d33c68
2 changed files with 8 additions and 18 deletions

View file

@ -1756,14 +1756,14 @@ config KVM_GUEST
help help
Select this option if building a guest kernel for KVM (Trap & Emulate) mode Select this option if building a guest kernel for KVM (Trap & Emulate) mode
config KVM_HOST_FREQ config KVM_GUEST_TIMER_FREQ
int "KVM Host Processor Frequency (MHz)" int "Count/Compare Timer Frequency (MHz)"
depends on KVM_GUEST depends on KVM_GUEST
default 500 default 100
help help
Select this option if building a guest kernel for KVM to skip Set this to non-zero if building a guest kernel for KVM to skip RTC
RTC emulation when determining guest CPU Frequency. Instead, the guest emulation when determining guest CPU Frequency. Instead, the guest's
processor frequency is automatically derived from the host frequency. timer frequency is specified directly.
choice choice
prompt "Kernel page size" prompt "Kernel page size"

View file

@ -74,18 +74,8 @@ static void __init estimate_frequencies(void)
unsigned int giccount = 0, gicstart = 0; unsigned int giccount = 0, gicstart = 0;
#endif #endif
#if defined (CONFIG_KVM_GUEST) && defined (CONFIG_KVM_HOST_FREQ) #if defined(CONFIG_KVM_GUEST) && CONFIG_KVM_GUEST_TIMER_FREQ
unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); mips_hpt_frequency = CONFIG_KVM_GUEST_TIMER_FREQ * 1000000;
/*
* XXXKYMA: hardwire the CPU frequency to Host Freq/4
*/
count = (CONFIG_KVM_HOST_FREQ * 1000000) >> 3;
if ((prid != (PRID_COMP_MIPS | PRID_IMP_20KC)) &&
(prid != (PRID_COMP_MIPS | PRID_IMP_25KF)))
count *= 2;
mips_hpt_frequency = count;
return; return;
#endif #endif