Merge branch 'mti-next' of git://git.linux-mips.org/pub/scm/sjhill/linux-sjhill into...
[firefly-linux-kernel-4.4.55.git] / arch / mips / mti-malta / malta-time.c
index 79e5169eabd39056864612cb28628ee96d169267..0ad305f75802bc64250ad01be6e76b1826ea95a2 100644 (file)
@@ -75,6 +75,21 @@ static void __init estimate_frequencies(void)
        unsigned int giccount = 0, gicstart = 0;
 #endif
 
+#if defined (CONFIG_KVM_GUEST) && defined (CONFIG_KVM_HOST_FREQ)
+       unsigned int prid = read_c0_prid() & 0xffff00;
+
+       /*
+        * 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;
+#endif
+
        local_irq_save(flags);
 
        /* Start counter exactly on falling edge of update flag. */