aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidwang <davidwang@zhaoxin.com>2018-01-22 05:14:17 -0500
committerThomas Gleixner <tglx@linutronix.de>2018-01-24 07:38:10 -0500
commitfe6daab1ee9dfe7f89974ee6c486cccb0f18a61d (patch)
tree7a8ad4a75e7aa384ae1011ed6abd7d6bd8d502b0
parentaa83c45762a242acce9b35020363225a7b59d7c9 (diff)
x86/centaur: Mark TSC invariant
Centaur CPU has a constant frequency TSC and that TSC does not stop in C-States. But because the corresponding TSC feature flags are not set for that CPU, the TSC is treated as not constant frequency and assumed to stop in C-States, which makes it an unreliable and unusable clock source. Setting those flags tells the kernel that the TSC is usable, so it will select it over HPET. The effect of this is that reading time stamps (from kernel or user space) will be faster and more efficent. Signed-off-by: davidwang <davidwang@zhaoxin.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: qiyuanwang@zhaoxin.com Cc: linux-pm@vger.kernel.org Cc: brucechang@via-alliance.com Cc: cooperyan@zhaoxin.com Cc: benjaminpan@viatech.com Link: https://lkml.kernel.org/r/1516616057-5158-1-git-send-email-davidwang@zhaoxin.com
-rw-r--r--arch/x86/kernel/cpu/centaur.c4
-rw-r--r--drivers/acpi/processor_idle.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 68bc6d9b3132..c578cd29c2d2 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -106,6 +106,10 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
106#ifdef CONFIG_X86_64 106#ifdef CONFIG_X86_64
107 set_cpu_cap(c, X86_FEATURE_SYSENTER32); 107 set_cpu_cap(c, X86_FEATURE_SYSENTER32);
108#endif 108#endif
109 if (c->x86_power & (1 << 8)) {
110 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
111 set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
112 }
109} 113}
110 114
111static void init_centaur(struct cpuinfo_x86 *c) 115static void init_centaur(struct cpuinfo_x86 *c)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index d50a7b6ccddd..5f0071c7e2e1 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -207,6 +207,7 @@ static void tsc_check_state(int state)
207 switch (boot_cpu_data.x86_vendor) { 207 switch (boot_cpu_data.x86_vendor) {
208 case X86_VENDOR_AMD: 208 case X86_VENDOR_AMD:
209 case X86_VENDOR_INTEL: 209 case X86_VENDOR_INTEL:
210 case X86_VENDOR_CENTAUR:
210 /* 211 /*
211 * AMD Fam10h TSC will tick in all 212 * AMD Fam10h TSC will tick in all
212 * C/P/S0/S1 states when this bit is set. 213 * C/P/S0/S1 states when this bit is set.