Skip to content

Commit eda3d33

Browse files
James Hoganbonzini
authored andcommitted
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>
1 parent e30492b commit eda3d33

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

‎arch/mips/Kconfig‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,14 +1756,14 @@ config KVM_GUEST
17561756
help
17571757
Select this option if building a guest kernel for KVM (Trap & Emulate) mode
17581758

1759-
config KVM_HOST_FREQ
1760-
int "KVM Host Processor Frequency (MHz)"
1759+
config KVM_GUEST_TIMER_FREQ
1760+
int "Count/Compare Timer Frequency (MHz)"
17611761
depends on KVM_GUEST
1762-
default 500
1762+
default 100
17631763
help
1764-
Select this option if building a guest kernel for KVM to skip
1765-
RTC emulation when determining guest CPU Frequency. Instead, the guest
1766-
processor frequency is automatically derived from the host frequency.
1764+
Set this to non-zero if building a guest kernel for KVM to skip RTC
1765+
emulation when determining guest CPU Frequency. Instead, the guest's
1766+
timer frequency is specified directly.
17671767

17681768
choice
17691769
prompt "Kernel page size"

‎arch/mips/mti-malta/malta-time.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,8 @@ static void __init estimate_frequencies(void)
7474
unsigned int giccount = 0, gicstart = 0;
7575
#endif
7676

77-
#if defined (CONFIG_KVM_GUEST) && defined (CONFIG_KVM_HOST_FREQ)
78-
unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
79-
80-
/*
81-
* XXXKYMA: hardwire the CPU frequency to Host Freq/4
82-
*/
83-
count = (CONFIG_KVM_HOST_FREQ * 1000000) >> 3;
84-
if ((prid != (PRID_COMP_MIPS | PRID_IMP_20KC)) &&
85-
(prid != (PRID_COMP_MIPS | PRID_IMP_25KF)))
86-
count *= 2;
87-
88-
mips_hpt_frequency = count;
77+
#if defined(CONFIG_KVM_GUEST) && CONFIG_KVM_GUEST_TIMER_FREQ
78+
mips_hpt_frequency = CONFIG_KVM_GUEST_TIMER_FREQ * 1000000;
8979
return;
9080
#endif
9181

0 commit comments

Comments
 (0)