Subject: [PATCH] x86: printk_time to use tsc before cpu_clock is ready

so can get tsc value on printk

need to apply after
	[PATCH] printk_time: prepare stub for using other than cpu_clock

-v2: refresh on v3.10

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/cpu/common.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
+++ linux-2.6/arch/x86/kernel/cpu/common.c
@@ -737,6 +737,25 @@ static void __init early_identify_cpu(st
 	setup_force_cpu_cap(X86_FEATURE_ALWAYS);
 }
 
+static u64 __initdata tsc_clock_base;
+
+static __init u64 tsc_clock_offset(void)
+{
+	unsigned long long t;
+
+	rdtscll(t);
+
+	return t - tsc_clock_base;
+}
+
+static __init void early_printk_time_init(void)
+{
+	if (cpu_has_tsc) {
+		rdtscll(tsc_clock_base);
+		set_printk_time_clock(tsc_clock_offset);
+	}
+}
+
 void __init early_cpu_init(void)
 {
 	const struct cpu_dev *const *cdev;
@@ -761,6 +780,8 @@ void __init early_cpu_init(void)
 	}
 
 	early_identify_cpu(&boot_cpu_data);
+
+	early_printk_time_init();
 }
 
 /*
