diff mbox series

[1/2] acpi/cpufreq: Support CPU frequency driver for Zhaoxin cpu

Message ID 1554779175-3593-1-git-send-email-fionali-oc@zhaoxin.com (mailing list archive)
State New, archived
Headers show
Series [1/2] acpi/cpufreq: Support CPU frequency driver for Zhaoxin cpu | expand

Commit Message

FionaLi-oc April 9, 2019, 3:06 a.m. UTC
Implementation of Zhaoxin CPU frequency is compatible with Intel.
Zhaoxin CPU also supports EST.

Signed-off-by: FionaLi-oc <fionali-oc@zhaoxin.com>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 844ab85..9d86fa0 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -60,7 +60,8 @@  static int check_est_cpu(unsigned int cpuid)
 {
     struct cpuinfo_x86 *cpu = &cpu_data[cpuid];
 
-    if (cpu->x86_vendor != X86_VENDOR_INTEL ||
+    if ((cpu->x86_vendor != X86_VENDOR_INTEL &&
+        cpu->x86_vendor != X86_VENDOR_SHANGHAI) ||
         !cpu_has(cpu, X86_FEATURE_EIST))
         return 0;
 
@@ -600,7 +601,8 @@  acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
     /* Check for APERF/MPERF support in hardware
      * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+    if ((c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) ||
+        (c->x86_vendor == X86_VENDOR_SHANGHAI))
         on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
 
     /*
@@ -646,7 +648,8 @@  static int __init cpufreq_driver_init(void)
     int ret = 0;
 
     if ((cpufreq_controller == FREQCTL_xen) &&
-        (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
+        ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) ||
+         (boot_cpu_data.x86_vendor == X86_VENDOR_SHANGHAI)))
         ret = cpufreq_register_driver(&acpi_cpufreq_driver);
     else if ((cpufreq_controller == FREQCTL_xen) &&
         (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
@@ -660,9 +663,10 @@  int cpufreq_cpu_init(unsigned int cpuid)
 {
     int ret;
 
-    /* Currently we only handle Intel and AMD processor */
+    /* Currently we only handle Intel, AMD and ShangHai processor */
     if ( (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) ||
-         (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) )
+         (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) ||
+         (boot_cpu_data.x86_vendor == X86_VENDOR_SHANGHAI ) )
         ret = cpufreq_add_cpu(cpuid);
     else
         ret = -EFAULT;